diff --git a/.machine_readable/mint-verbatim.txt b/.machine_readable/mint-verbatim.txt index 53ac43a0..71b0cb20 100644 --- a/.machine_readable/mint-verbatim.txt +++ b/.machine_readable/mint-verbatim.txt @@ -27,7 +27,19 @@ scripts/strip-instruction-blocks.rs # names the marker it strips scripts/resolve-template-pin.sh # documents the template it resolves tests/e2e/template_instantiation_test.sh # token answer list; marker exemptions tests/e2e/use_template_mint_test.sh # mints a template copy: template literals +tests/e2e/chain_mint_test.sh # chain fixtures: parent names and paths tests/workflows/mint_cleanup_test.sh # instruction-block fixture tests/workflows/self_name_pass_test.sh # template-name fixtures tests/workflows/template_conformance_test.sh # template-slug fixtures +tests/workflows/julia_library_test.sh # PACKAGE_UUID brace-token fixture +tests/workflows/mint_gates_test.sh # names an unanswered token, on purpose +tests/e2e/language_profiles_mint_test.sh # minted-tree fixtures; keeps archetype paths tests/workflows/resolve_template_pin_test.sh # template-slug fixtures +tests/ffi_strings_test.sh # FFI token fixture, filled in a scratch copy +tests/workflows/container_kyaml_test.sh # container token fixtures (template only) +CHANGELOG.adoc # prose quotes the project-name brace token when it describes a mint failure +docs/reports/compliance/RSR-TEMPLATE-DAMAGE-2026-10-30.adoc # the report is about the unfilled project-name brace token +docs/status/TEST-NEEDS.adoc # prose records the lowercase brace placeholders it converted +scripts/survey-template-damage.sh # searches children for an unfilled project-name brace token +scripts/check-mint-tokens.sh # the gate's own comments name the tokens it checks +tests/aspect_tests.sh # a comment names the lowercase brace token that symbol names may carry diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index c4643bca..6afa75ef 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -606,7 +606,7 @@ https://semver.org/spec/v2.0.0.html[Semantic Versioning]. `relock-standards-pin.sh` at `75bd599` gave the nine records the same tags. No commit changes: each tag was checked to point at its recorded commit. * The mint's self-name pass keeps issue references. It rewrote - `bactrian#N`, a reference to this template's own issue, into + `rsr-template-repo#N`, a reference to this template's own issue, into `#N`, which names an issue of the child that does not exist or is unrelated. resource-algebra carried such references after its mint. `tests/workflows/self_name_pass_test.sh` (wired into Estate Rules) runs diff --git a/docs/status/TEST-NEEDS.adoc b/docs/status/TEST-NEEDS.adoc index 98877182..c6d2e512 100644 --- a/docs/status/TEST-NEEDS.adoc +++ b/docs/status/TEST-NEEDS.adoc @@ -1,6 +1,6 @@ // SPDX-License-Identifier: CC-BY-SA-4.0 // Copyright (c) Jonathan D.A. Jewell -= TEST-NEEDS: bactrian += TEST-NEEDS: rsr-template-repo == CRG Grade: C — ACHIEVED 2026-04-04 @@ -65,7 +65,7 @@ output only. === Zig FFI Tests ✅ * [x] `src/interface/ffi/test/integration_test.zig` — template with examples -** Converted from `bactrian` placeholders to "template" namespace +** Converted from `{{project}}` placeholders to "template" namespace ** Added comprehensive comments for how to instantiate ** Tests grouped by category (lifecycle, operations, strings, errors, version, memory safety, threading) ** Compiles and passes placeholder test diff --git a/tests/aspect_tests.sh b/tests/aspect_tests.sh index 813aad99..26c7e17d 100755 --- a/tests/aspect_tests.sh +++ b/tests/aspect_tests.sh @@ -39,7 +39,7 @@ fail() { red " FAIL: $1"; FAIL=$((FAIL + 1)); } warn() { yellow " WARN: $1"; WARN=$((WARN + 1)); } echo "═══════════════════════════════════════════════════════════════" -echo " BACTRIAN — Aspect Tests (Cross-Cutting Concerns)" +echo " {{PROJECT}} — Aspect Tests (Cross-Cutting Concerns)" echo "═══════════════════════════════════════════════════════════════" echo "" diff --git a/tests/workflows/julia_library_test.sh b/tests/workflows/julia_library_test.sh new file mode 100644 index 00000000..311cdb89 --- /dev/null +++ b/tests/workflows/julia_library_test.sh @@ -0,0 +1,202 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# Focused regressions for PR #240: package UUIDv8 minting and job timeouts. +# Executes the recipe's actual UUID block, with tool availability isolated +# from the host. No mint, network access, Bun or Julia installation is needed. +# Usage: bash tests/workflows/julia_library_test.sh +set -euo pipefail +repo=$(git rev-parse --show-toplevel) +fixture=$(mktemp -d) +trap 'rm -rf "$fixture"' EXIT +bash_bin=$(command -v bash) +sha_bin=$(command -v sha256sum) || { echo 'FAIL: sha256sum is needed to exercise the shipped fallback' >&2; exit 1; } +tr_bin=$(command -v tr) || { echo 'FAIL: tr is needed for owner normalization' >&2; exit 1; } +checks=0 +# Print all arguments as a failure message to stderr and exit the test with status 1. +fail() { echo "FAIL: $*" >&2; exit 1; } +# Compare actual $1 with expected $2, using $3 as the diagnostic label. +# Increment checks on equality; otherwise report the mismatch and exit with status 1. +equal() { + [ "$1" = "$2" ] || fail "$3: got '$1', expected '$2'" + checks=$((checks + 1)) +} + +# Match the outer indentation so the nested if/elif/else remains intact. +# Stop after the first block: a later Julia block handles .in renames. +# Strip the recipe's four spaces as Just does, including inside the generator block. +awk ' + /^ if \[ "\$ARCHETYPE" = "julia-library" \]; then$/ { copying = 1 } + copying { last = ($0 ~ /^ fi$/); sub(/^ /, ""); print; if (last) exit } +' "$repo/build/just/repo-init.just" > "$fixture/mint.sh" +[ -s "$fixture/mint.sh" ] || fail 'package UUID block not found in repo-init' + +mkdir -p "$fixture/common" "$fixture/shell" "$fixture/bun" "$fixture/bun-only" "$fixture/empty" "$fixture/broken" +# Every branch canonicalizes the owner, even when no UUID generator exists. +# Expose only tr as a shared utility so the host cannot supply a generator. +ln -s "$tr_bin" "$fixture/common/tr" +ln -s "$sha_bin" "$fixture/shell/sha256sum" +# An installed uuidgen must never restore the old v5 package mint. +printf '#!%s\nexit 91\n' "$bash_bin" > "$fixture/shell/uuidgen" +chmod +x "$fixture/shell/uuidgen" + +# derive TOOL_DIR OWNER REPO [STANDARDS_SCRIPT [ARCHETYPE [REPO_UUID]]] +# Execute the shipped UUID rule with the supplied identity and isolated tools. +# Print PACKAGE_UUID and write NUL-separated substitutions to fixture/sed.args; +# return the subprocess status, including generator failures. +# env -i prevents host Bun or SHA-256 tools, user config and exported functions from +# accidentally satisfying a branch. The subprocess only needs Bash builtins, +# tr and whichever generator this test explicitly places on PATH. +derive() { + env -i PATH="$1:$fixture/common" OWNER="$2" REPO="$3" \ + STANDARDS_UUID_V8_JS="${4:-}" ARCHETYPE="${5:-julia-library}" \ + REPO_UUID="${6:-UNASSIGNED}" RSR_PACKAGE_UUID="${7:-}" RSR_MINT_REPLAY="${8:-0}" BUN_LOG="$fixture/bun.args" \ + "$bash_bin" -c ' + set -euo pipefail + LB="{{" RB="}}" PACKAGE_UUID=UNTOUCHED + SED_ARGS=() + cd "$3" + source "$1" >/dev/null + printf "%s\n" "$PACKAGE_UUID" + if [ "${#SED_ARGS[@]}" -gt 0 ]; then + printf "%s\0" "${SED_ARGS[@]}" > "$2" + else + : > "$2" + fi + ' _ "$fixture/mint.sh" "$fixture/sed.args" "$repo" +} + +# Assert a generator's exact failure status so missing utilities or syntax +# errors cannot masquerade as successful negative controls. +fails_with() { + local expected_status=$1 + shift + if derive "$@" > /dev/null; then + fail "generator succeeded; expected exit $expected_status" + else + equal "$?" "$expected_status" 'generator failure status is preserved' + fi +} + +# Fixed vectors independently calculated with Node crypto (SHA-256). These +# exercise version/variant replacement AND preservation of the remaining bits. +# Additional short/numeric identity and quoting vectors use sha256sum. +while read -r owner name expected; do + equal "$(derive "$fixture/shell" "$owner" "$name")" "$expected" "UUID for $owner/$name" +done <<'VECTORS' +hyperpolymath mintcheck b4839a75-05b9-8c83-a497-2aa751ab7f19 +example-owner MintCheck.jl 9271df15-3174-8475-ac0b-136d649c1f76 +other-owner MintCheck.jl a77b0d36-98a4-81aa-9457-25af7f040243 +example-owner OtherPackage.jl 86fa698a-692e-88c1-82ad-c1a986e8700d +example-owner mint-check 88f60d1e-793d-8026-8c30-5ceb4c99a728 +a a 737a297a-72a8-87df-afe7-622f2c0db843 +123 1 dc555c1d-cf7b-8cbc-a0b5-76ab2aa4e8fb +O'Brien MintCheck.jl 55719f5a-ef9d-819a-a8ee-24cf43f886eb +VECTORS +expected=9271df15-3174-8475-ac0b-136d649c1f76 +# GitHub owner spelling must not change package identity. Keep the repository +# spelling intact: the registered preimage includes the supplied package name. +for owner in EXAMPLE-OWNER Example-Owner eXaMpLe-OwNeR; do + equal "$(derive "$fixture/shell" "$owner" MintCheck.jl)" "$expected" "owner casing for $owner" +done +# Owner is passed as an argument to uuid-v8.sh, never interpolated into shell code. +# These malformed logins deliberately probe that boundary without executing it. +equal "$(derive "$fixture/shell" 'owner-$(exit 97)-`exit 98`' MintCheck.jl)" \ + b665f02d-54bf-88c2-99cd-94a7963df9ea 'owner shell expressions remain literal data' +equal "$(derive "$fixture/shell" example-owner MintCheck.jl)" "$expected" 're-mint is deterministic' +equal "$(derive "$fixture/shell" example-owner MintCheck.jl '' julia-library 00000000-0000-8000-8000-000000000000)" \ + "$expected" 'package identity is independent of the repository UUID' + +# Verify the real substitution expression reaches Project.toml, including +# every occurrence of the token in the new explanatory comment. +mapfile -d '' -t sed_args < "$fixture/sed.args" +sed "${sed_args[@]}" "$repo/archetypes/julia-library/overlay/Project.toml.in" > "$fixture/Project.toml" +equal "$(sed -n 's/^uuid = "\([^"]*\)"$/\1/p' "$fixture/Project.toml")" "$expected" 'minted Project.toml UUID' +if grep -qF '{{PACKAGE_UUID}}' "$fixture/Project.toml"; then fail 'package UUID token survived substitution'; fi + +# Bun is preferred only when the standards implementation exists. The stub +# checks the invocation contract; the shell implementation above (uuid-v8.sh) owns +# the digest assertions. A path with spaces must remain a single argument. +standards="$fixture/standards tools/uuid-v8.js" +mkdir -p "$(dirname "$standards")" +: > "$standards" +{ + printf '#!%s\n' "$bash_bin" + cat <<'BUN' +set -euo pipefail +printf '%s\n' "$@" > "$BUN_LOG" +printf '%s\n' '9271df15-3174-8475-ac0b-136d649c1f76' +BUN +} > "$fixture/bun/bun" +printf '#!%s\nexit 92\n' "$bash_bin" > "$fixture/bun/sha256sum" +chmod +x "$fixture/bun/bun" "$fixture/bun/sha256sum" +equal "$(derive "$fixture/bun" example-owner MintCheck.jl "$standards")" "$expected" 'Bun takes precedence over uuid-v8.sh' +equal "$(cat "$fixture/bun.args")" "$(printf '%s\n' "$standards" c julia-package-identity github.com/example-owner/MintCheck.jl)" \ + 'Bun receives the standards path, profile, domain and preimage' +equal "$(derive "$fixture/bun" ExAmPlE-OWNER MintCheck.jl "$standards")" "$expected" 'mixed-case owner uses Bun' +equal "$(cat "$fixture/bun.args")" "$(printf '%s\n' "$standards" c julia-package-identity github.com/example-owner/MintCheck.jl)" \ + 'Bun receives the canonical owner and original repository spelling' + +# Bun without a usable standards file falls back to uuid-v8.sh, including when +# the setting names a missing file or a directory rather than a regular file. +ln -s "$fixture/bun/bun" "$fixture/shell/bun" +ln -s "$fixture/missing.js" "$fixture/dangling.js" +for unavailable in '' "$fixture/missing.js" "$fixture/standards tools" "$fixture/dangling.js"; do + rm -f "$fixture/bun.args" + equal "$(derive "$fixture/shell" example-owner MintCheck.jl "$unavailable")" "$expected" 'unavailable standards script uses uuid-v8.sh' + [ ! -e "$fixture/bun.args" ] || fail 'Bun ran without a standards file' +done + +# A standards file on its own is insufficient when Bun is absent. +rm "$fixture/shell/bun" +equal "$(derive "$fixture/shell" example-owner MintCheck.jl "$standards")" "$expected" 'standards script without Bun uses uuid-v8.sh' +equal "$(derive "$fixture/empty" example-owner MintCheck.jl)" UNASSIGNED 'no generator leaves identity unassigned' +mapfile -d '' -t sed_args < "$fixture/sed.args" +equal "$(sed "${sed_args[@]}" <<< 'uuid = "{{PACKAGE_UUID}}"')" 'uuid = "UNASSIGNED"' 'unassigned fallback reaches the package manifest' +ln -s "$fixture/bun/bun" "$fixture/bun-only/bun" +equal "$(derive "$fixture/bun-only" example-owner MintCheck.jl "$standards")" "$expected" 'Bun with standards works without uuid-v8.sh' +equal "$(derive "$fixture/bun-only" example-owner MintCheck.jl)" UNASSIGNED 'Bun without standards or a SHA-256 tool leaves identity unassigned' +equal "$(derive "$fixture/empty" ExAmPlE-OWNER MintCheck.jl "$standards")" UNASSIGNED 'standards without either generator leaves identity unassigned' +equal "$(derive "$fixture/bun" example-owner MintCheck.jl '' other-archetype)" UNTOUCHED 'other archetypes do not mint a package UUID' +[ ! -s "$fixture/sed.args" ] || fail 'other archetype gained a package UUID substitution' + +# A failing generator must fail loudly rather than emitting a successful mint. +printf '#!%s\nexit 93\n' "$bash_bin" > "$fixture/broken/sha256sum" +chmod +x "$fixture/broken/sha256sum" +fails_with 2 "$fixture/broken" example-owner MintCheck.jl +printf '#!%s\nexit 94\n' "$bash_bin" > "$fixture/broken/bun" +chmod +x "$fixture/broken/bun" +fails_with 94 "$fixture/broken" example-owner MintCheck.jl "$standards" +# Even an available working SHA-256 tool must not hide a failing preferred generator. +ln -s "$fixture/broken/bun" "$fixture/shell/bun" +fails_with 94 "$fixture/shell" example-owner MintCheck.jl "$standards" +rm "$fixture/shell/bun" + +# Inspect only direct job fields: a timeout on another job or nested step +# must not satisfy a missing timeout. Duplicate timeout keys also fail. +workflow="$repo/archetypes/julia-library/overlay/.github/workflows/julia-ci.yml.in" +for job in fmt jet test; do + minutes=10 + [ "$job" != test ] || minutes=15 + actual=$(awk -v job="$job" ' + /^ [A-Za-z0-9_-]+:/ { selected = ($0 == " " job ":") } + selected && /^ timeout-minutes:/ { print $2 } + ' "$workflow") + equal "$actual" "$minutes" "$job job timeout" +done +# A replay supplies the recorded uuid (mint-answers :package-uuid), so the +# drift gate gives the same answer on a host with neither bun nor a SHA-256 tool +# (Codex review of #275). A recorded UNASSIGNED replays as UNASSIGNED even +# where a generator exists; a malformed value is ignored, not trusted. +equal "$(derive "$fixture/empty" example-owner MintCheck.jl '' julia-library UNASSIGNED "$expected" 1)" "$expected" \ + 'a recorded package uuid replays without bun or a SHA-256 tool' +equal "$(derive "$fixture/shell" example-owner MintCheck.jl '' julia-library UNASSIGNED UNASSIGNED 1)" UNASSIGNED \ + 'a recorded UNASSIGNED replays as UNASSIGNED' +equal "$(derive "$fixture/empty" example-owner MintCheck.jl '' julia-library UNASSIGNED 'not-a-uuid' 1)" UNASSIGNED \ + 'a malformed recorded uuid is ignored' +# Outside a replay the value is never trusted (Codex review of #275): an +# ordinary mint derives the uuid even when the environment carries one. +equal "$(derive "$fixture/shell" example-owner MintCheck.jl '' julia-library UNASSIGNED 00000000-0000-8000-8000-000000000000)" "$expected" \ + 'an ordinary mint ignores RSR_PACKAGE_UUID and derives the uuid' +equal "$(derive "$fixture/shell" example-owner MintCheck.jl '' julia-library UNASSIGNED UNASSIGNED)" "$expected" \ + 'an ordinary mint ignores a stray UNASSIGNED' +echo "PASS: $checks Julia library UUID and timeout checks; generator failures rejected"