From d8392c76539f8b59e9c77551e82b22a8a6e54e69 Mon Sep 17 00:00:00 2001 From: Han Ngo Date: Thu, 3 Dec 2026 05:43:07 +0700 Subject: [PATCH 1/4] fix(skill-curator): promote-digest test no longer needs sha256sum on PATH Case 6 wrote a sha256sum PATH stub that execs a binary absent from the nightly PATH (no /sbin), shadowing the shasum fallback and making promote refuse with rc=4. Create the stub only when a real sha256sum exists. --- .../skill-curator-promote-digest-test-path.md | 28 +++++++++++++++++++ .../tests/test-promote-digest.sh | 10 +++++-- 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 docs/verification/skill-curator-promote-digest-test-path.md diff --git a/docs/verification/skill-curator-promote-digest-test-path.md b/docs/verification/skill-curator-promote-digest-test-path.md new file mode 100644 index 00000000..ed89e573 --- /dev/null +++ b/docs/verification/skill-curator-promote-digest-test-path.md @@ -0,0 +1,28 @@ +# Verification: skill-curator-promote-digest-test-path + +Test-only change to `lib/skill-curator/tests/test-promote-digest.sh`, case [6]. No product code touched. + +Cause: case [6] writes a `sha256sum` PATH stub that execs `${REAL_SHA256:-/usr/bin/sha256sum}`. On a PATH with no real `sha256sum` (the Mini nightly job sets `PATH=$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin`, so no `/sbin`), `promote.sh` would have used `shasum -a 256`, but the stub shadows it and execs a missing binary. The digest comes back empty and promote refuses with rc=4. The fix creates the `sha256sum` stub only when a real one exists. + +## Green runs + +| Env | Command | Result | +|---|---|---| +| nightly PATH | `env -i PATH=$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin bash lib/skill-curator/tests/test-promote-digest.sh` | all 17 passed | +| nightly PATH plus /sbin | same with `:/sbin:/usr/sbin` | all 17 passed | +| login shell PATH | `bash lib/skill-curator/tests/test-promote-digest.sh` | all 17 passed | + +## Negative control + +The unfixed script from `HEAD` under the nightly PATH: + +```text + FAIL: mid-digest re-stage failed (rc=4, list='beta 2a0ad9d2324c tampered ... +test-promote-digest: 16 passed, 1 FAILED +``` + +This matches the nightly failure on 2026-12-03 04:38 ICT (first nightly after #1264 added the suite). + +## Not covered + +The full nightly run was not repeated; only this suite. diff --git a/lib/skill-curator/tests/test-promote-digest.sh b/lib/skill-curator/tests/test-promote-digest.sh index 7da889fa..96261c99 100755 --- a/lib/skill-curator/tests/test-promote-digest.sh +++ b/lib/skill-curator/tests/test-promote-digest.sh @@ -114,6 +114,11 @@ if [ ! -e "$TMP/fired-hash" ]; then fi exec "${REAL_SHASUM:-/usr/bin/shasum}" "\$@" EOF +STUB_HASHES=("$STUB1/shasum") +# A sha256sum stub is only valid where a real one exists; otherwise it would shadow +# the shasum fallback in promote.sh and exec a missing binary (nightly PATH has no /sbin). +if [[ -n "$REAL_SHA256" ]]; then +STUB_HASHES+=("$STUB1/sha256sum") cat > "$STUB1/sha256sum" < "$SKILL_CURATOR_PROPOSALS_DIR/race-mid/SKILL.md" fi -exec "${REAL_SHA256:-/usr/bin/sha256sum}" "\$@" +exec "$REAL_SHA256" "\$@" EOF -chmod +x "$STUB1/shasum" "$STUB1/sha256sum" +fi +chmod +x "${STUB_HASHES[@]}" PATH="$STUB1:$PATH" "$CLI" promote race-mid "$d_mid" >/dev/null 2>&1; rc_mid=$? lst_mid="$("$CLI" list)" if [[ $rc_mid -eq 0 ]] \ From 70fc6af5d8db07f75bd9156e8a4f568877221740 Mon Sep 17 00:00:00 2001 From: Han Ngo Date: Thu, 3 Dec 2026 05:43:55 +0700 Subject: [PATCH 2/4] docs(verification): record captured output for the promote-digest test fix --- .../skill-curator-promote-digest-test-path.md | 62 +++++++++++++++---- 1 file changed, 50 insertions(+), 12 deletions(-) diff --git a/docs/verification/skill-curator-promote-digest-test-path.md b/docs/verification/skill-curator-promote-digest-test-path.md index ed89e573..9e66f6ee 100644 --- a/docs/verification/skill-curator-promote-digest-test-path.md +++ b/docs/verification/skill-curator-promote-digest-test-path.md @@ -2,27 +2,65 @@ Test-only change to `lib/skill-curator/tests/test-promote-digest.sh`, case [6]. No product code touched. -Cause: case [6] writes a `sha256sum` PATH stub that execs `${REAL_SHA256:-/usr/bin/sha256sum}`. On a PATH with no real `sha256sum` (the Mini nightly job sets `PATH=$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin`, so no `/sbin`), `promote.sh` would have used `shasum -a 256`, but the stub shadows it and execs a missing binary. The digest comes back empty and promote refuses with rc=4. The fix creates the `sha256sum` stub only when a real one exists. +Cause: case [6] writes a `sha256sum` PATH stub that execs `${REAL_SHA256:-/usr/bin/sha256sum}`. On a PATH with no real `sha256sum` (the Mini nightly job sets `PATH=$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin`, no `/sbin`), `promote.sh` would fall back to `shasum -a 256`, but the stub shadows it and execs a missing binary. The digest comes back empty and promote refuses with rc=4. The fix creates the `sha256sum` stub only when a real one exists. -## Green runs +## Green run (nightly PATH) -| Env | Command | Result | -|---|---|---| -| nightly PATH | `env -i PATH=$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin bash lib/skill-curator/tests/test-promote-digest.sh` | all 17 passed | -| nightly PATH plus /sbin | same with `:/sbin:/usr/sbin` | all 17 passed | -| login shell PATH | `bash lib/skill-curator/tests/test-promote-digest.sh` | all 17 passed | +```text +Command: env -i HOME=$HOME PATH=$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin bash lib/skill-curator/tests/test-promote-digest.sh +Exit: 0 +Output: +[1] list prints 12-hex digest; added file and symlink target change it +[2] re-stage between list and promote is refused (rc=4), nothing moves +[3] no digest, --force in digest slot, and wrong digest all refuse (rc=4) +[4] right digest promotes exact reviewed draft including extra files and symlinks +[5] --force after digest replaces live skill and backs up previous live copy +[6] re-stage during promotion (PATH stub) publishes reviewed copy, newer draft stays visible +[7] late re-stage during promote (mkdir stub, Fault 2) does not hide newer draft +[8] re-stage during refused promotion preserves BOTH old and new drafts +[9] inherited temp variable does not recursively delete unrelated folder (Fault 1) +[10] auto mode promotes eligible draft from private copy and preserves concurrent newer draft +[11] curate_restore refuses over a live skill (rc=5), no nesting, manifest unchanged +[12] normal curate_restore moves archive back and removes only its manifest row +[13] file with newline in name added after list is refused (rc=4), not installed +[14] fifo added after list is refused (rc=4), not installed +[15] chmod +x after list changes digest and is refused (rc=4), not installed +[16] absolute symlink target swap after list is refused (rc=4), not installed +[17] curate_restore refuses traversal, slash, empty, and leading-dash slugs +test-promote-digest: all 17 passed +Verdict: PASS +``` ## Negative control -The unfixed script from `HEAD` under the nightly PATH: +The same command on the test script from before this change (`HEAD~1`), same PATH. It fails with the nightly assertion: ```text - FAIL: mid-digest re-stage failed (rc=4, list='beta 2a0ad9d2324c tampered ... +Command: env -i HOME=$HOME PATH=$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin bash +Exit: 1 +Output: +[1] list prints 12-hex digest; added file and symlink target change it +[2] re-stage between list and promote is refused (rc=4), nothing moves +[3] no digest, --force in digest slot, and wrong digest all refuse (rc=4) +[4] right digest promotes exact reviewed draft including extra files and symlinks +[5] --force after digest replaces live skill and backs up previous live copy +[6] re-stage during promotion (PATH stub) publishes reviewed copy, newer draft stays visible + FAIL: mid-digest re-stage failed (rc=4, list='beta 2a0ad9d2324c tampered +[7] late re-stage during promote (mkdir stub, Fault 2) does not hide newer draft +[8] re-stage during refused promotion preserves BOTH old and new drafts +[9] inherited temp variable does not recursively delete unrelated folder (Fault 1) +[10] auto mode promotes eligible draft from private copy and preserves concurrent newer draft +[11] curate_restore refuses over a live skill (rc=5), no nesting, manifest unchanged +[12] normal curate_restore moves archive back and removes only its manifest row +[13] file with newline in name added after list is refused (rc=4), not installed +[14] fifo added after list is refused (rc=4), not installed +[15] chmod +x after list changes digest and is refused (rc=4), not installed +[16] absolute symlink target swap after list is refused (rc=4), not installed +[17] curate_restore refuses traversal, slash, empty, and leading-dash slugs test-promote-digest: 16 passed, 1 FAILED +Verdict: FAIL (expected, proves the check bites) ``` -This matches the nightly failure on 2026-12-03 04:38 ICT (first nightly after #1264 added the suite). - ## Not covered -The full nightly run was not repeated; only this suite. +The full nightly run was not repeated; only this suite. With `/sbin` on PATH and in a login shell the suite also passed 17 of 17. From 178191ccee02a9c2afb9cdbe39c1643c16562dd8 Mon Sep 17 00:00:00 2001 From: Han Ngo Date: Thu, 3 Dec 2026 05:44:11 +0700 Subject: [PATCH 3/4] docs(verification): order the negative control before the green run --- .../skill-curator-promote-digest-test-path.md | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/verification/skill-curator-promote-digest-test-path.md b/docs/verification/skill-curator-promote-digest-test-path.md index 9e66f6ee..70f032d1 100644 --- a/docs/verification/skill-curator-promote-digest-test-path.md +++ b/docs/verification/skill-curator-promote-digest-test-path.md @@ -4,11 +4,13 @@ Test-only change to `lib/skill-curator/tests/test-promote-digest.sh`, case [6]. Cause: case [6] writes a `sha256sum` PATH stub that execs `${REAL_SHA256:-/usr/bin/sha256sum}`. On a PATH with no real `sha256sum` (the Mini nightly job sets `PATH=$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin`, no `/sbin`), `promote.sh` would fall back to `shasum -a 256`, but the stub shadows it and execs a missing binary. The digest comes back empty and promote refuses with rc=4. The fix creates the `sha256sum` stub only when a real one exists. -## Green run (nightly PATH) +## Negative control + +The same command on the test script from before this change (`HEAD~1`), same PATH. It fails with the nightly assertion: ```text -Command: env -i HOME=$HOME PATH=$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin bash lib/skill-curator/tests/test-promote-digest.sh -Exit: 0 +Command: env -i HOME=$HOME PATH=$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin bash +Exit: 1 Output: [1] list prints 12-hex digest; added file and symlink target change it [2] re-stage between list and promote is refused (rc=4), nothing moves @@ -16,6 +18,7 @@ Output: [4] right digest promotes exact reviewed draft including extra files and symlinks [5] --force after digest replaces live skill and backs up previous live copy [6] re-stage during promotion (PATH stub) publishes reviewed copy, newer draft stays visible + FAIL: mid-digest re-stage failed (rc=4, list='beta 2a0ad9d2324c tampered [7] late re-stage during promote (mkdir stub, Fault 2) does not hide newer draft [8] re-stage during refused promotion preserves BOTH old and new drafts [9] inherited temp variable does not recursively delete unrelated folder (Fault 1) @@ -27,17 +30,15 @@ Output: [15] chmod +x after list changes digest and is refused (rc=4), not installed [16] absolute symlink target swap after list is refused (rc=4), not installed [17] curate_restore refuses traversal, slash, empty, and leading-dash slugs -test-promote-digest: all 17 passed -Verdict: PASS +test-promote-digest: 16 passed, 1 FAILED +Result: RED as expected, proves the check bites ``` -## Negative control - -The same command on the test script from before this change (`HEAD~1`), same PATH. It fails with the nightly assertion: +## Green run (nightly PATH, after the fix) ```text -Command: env -i HOME=$HOME PATH=$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin bash -Exit: 1 +Command: env -i HOME=$HOME PATH=$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin bash lib/skill-curator/tests/test-promote-digest.sh +Exit: 0 Output: [1] list prints 12-hex digest; added file and symlink target change it [2] re-stage between list and promote is refused (rc=4), nothing moves @@ -45,7 +46,6 @@ Output: [4] right digest promotes exact reviewed draft including extra files and symlinks [5] --force after digest replaces live skill and backs up previous live copy [6] re-stage during promotion (PATH stub) publishes reviewed copy, newer draft stays visible - FAIL: mid-digest re-stage failed (rc=4, list='beta 2a0ad9d2324c tampered [7] late re-stage during promote (mkdir stub, Fault 2) does not hide newer draft [8] re-stage during refused promotion preserves BOTH old and new drafts [9] inherited temp variable does not recursively delete unrelated folder (Fault 1) @@ -57,8 +57,8 @@ Output: [15] chmod +x after list changes digest and is refused (rc=4), not installed [16] absolute symlink target swap after list is refused (rc=4), not installed [17] curate_restore refuses traversal, slash, empty, and leading-dash slugs -test-promote-digest: 16 passed, 1 FAILED -Verdict: FAIL (expected, proves the check bites) +test-promote-digest: all 17 passed +Verdict: PASS ``` ## Not covered From a8af7d486f14e1a3c8267952485bbb8dd428e59a Mon Sep 17 00:00:00 2001 From: Han Ngo Date: Thu, 3 Dec 2026 05:46:46 +0700 Subject: [PATCH 4/4] docs(verification): add Verdict RED line to the promote-digest proof --- docs/verification/skill-curator-promote-digest-test-path.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/verification/skill-curator-promote-digest-test-path.md b/docs/verification/skill-curator-promote-digest-test-path.md index 70f032d1..036ad277 100644 --- a/docs/verification/skill-curator-promote-digest-test-path.md +++ b/docs/verification/skill-curator-promote-digest-test-path.md @@ -34,6 +34,8 @@ test-promote-digest: 16 passed, 1 FAILED Result: RED as expected, proves the check bites ``` +Verdict: RED + ## Green run (nightly PATH, after the fix) ```text