Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .machine_readable/mint-verbatim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
`<child>#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
Expand Down
4 changes: 2 additions & 2 deletions docs/status/TEST-NEEDS.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: CC-BY-SA-4.0
// Copyright (c) Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
= TEST-NEEDS: bactrian
= TEST-NEEDS: rsr-template-repo

== CRG Grade: C — ACHIEVED 2026-04-04

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/aspect_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""

Expand Down
202 changes: 202 additions & 0 deletions tests/workflows/julia_library_test.sh
Original file line number Diff line number Diff line change
@@ -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'"

Check warning on line 20 in tests/workflows/julia_library_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_Bactrian&issues=AaHa_aEhd7dyvm3w8SO5&open=AaHa_aEhd7dyvm3w8SO5&pullRequest=28

Check warning on line 20 in tests/workflows/julia_library_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_Bactrian&issues=AaHa_aEhd7dyvm3w8SO2&open=AaHa_aEhd7dyvm3w8SO2&pullRequest=28

Check warning on line 20 in tests/workflows/julia_library_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_Bactrian&issues=AaHa_aEhd7dyvm3w8SO3&open=AaHa_aEhd7dyvm3w8SO3&pullRequest=28

Check warning on line 20 in tests/workflows/julia_library_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_Bactrian&issues=AaHa_aEhd7dyvm3w8SO4&open=AaHa_aEhd7dyvm3w8SO4&pullRequest=28

Check failure on line 20 in tests/workflows/julia_library_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_Bactrian&issues=AaHa_aEhd7dyvm3w8SO0&open=AaHa_aEhd7dyvm3w8SO0&pullRequest=28

Check warning on line 20 in tests/workflows/julia_library_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_Bactrian&issues=AaHa_aEhd7dyvm3w8SO1&open=AaHa_aEhd7dyvm3w8SO1&pullRequest=28
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'

Check failure on line 31 in tests/workflows/julia_library_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_Bactrian&issues=AaHa_aEhd7dyvm3w8SO6&open=AaHa_aEhd7dyvm3w8SO6&pullRequest=28

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" \

Check warning on line 50 in tests/workflows/julia_library_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_Bactrian&issues=AaHa_aEhd7dyvm3w8SO7&open=AaHa_aEhd7dyvm3w8SO7&pullRequest=28

Check warning on line 50 in tests/workflows/julia_library_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_Bactrian&issues=AaHa_aEhd7dyvm3w8SO8&open=AaHa_aEhd7dyvm3w8SO8&pullRequest=28

Check warning on line 50 in tests/workflows/julia_library_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_Bactrian&issues=AaHa_aEhd7dyvm3w8SO9&open=AaHa_aEhd7dyvm3w8SO9&pullRequest=28
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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Skip template-only checks when the archetype is absent

In this minted repository, build/just/repo-init.just deliberately removes the entire archetypes/ directory, so the newly advertised bash tests/workflows/julia_library_test.sh command always exits here with sed: can't read .../archetypes/julia-library/overlay/Project.toml.in; the later workflow check has the same missing-fixture dependency. Either avoid carrying this template-only test into minted trees or make it skip the overlay-specific assertions when archetypes/julia-library is absent.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified, and it is real: bactrian main has no archetypes/ directory (the mint removes it), while tests/workflows/julia_library_test.sh reads archetypes/julia-library/overlay/... at line 112 and line 176, so the test cannot pass in a minted tree. Two facts bound it: the file is carried byte-identical because mint-verbatim.txt lists it, and nothing in this repository's CI invokes it (only the template's own tests/e2e/julia_mint_test.sh does), so no check here goes red from it. The fix belongs at the source, not in this repository: the template either stops carrying template-only tests into children or lets them say so explicitly. That is a design choice for the owner, raised with the sweep; no local edit, since a divergent copy would break the byte-identity this PR exists to keep. Not claimed fixed.


Generated by Claude Code

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'

Check failure on line 146 in tests/workflows/julia_library_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_Bactrian&issues=AaHa_aEhd7dyvm3w8SO-&open=AaHa_aEhd7dyvm3w8SO-&pullRequest=28
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'

Check failure on line 160 in tests/workflows/julia_library_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_Bactrian&issues=AaHa_aEhd7dyvm3w8SO_&open=AaHa_aEhd7dyvm3w8SO_&pullRequest=28

# 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

Check failure on line 179 in tests/workflows/julia_library_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_Bactrian&issues=AaHa_aEhd7dyvm3w8SPA&open=AaHa_aEhd7dyvm3w8SPA&pullRequest=28
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"
Loading