diff --git a/tests/test-check-rtk-prefix.sh b/tests/test-check-rtk-prefix.sh index 580bc4f..fa18022 100644 --- a/tests/test-check-rtk-prefix.sh +++ b/tests/test-check-rtk-prefix.sh @@ -4,9 +4,16 @@ set -euo pipefail # Tests for scripts/check-rtk-prefix.sh — ADR-0023 clause 1. # # Case 1 is the one that earns the rest: it runs the gate against the corpus as -# it stood on `main` BEFORE the #113 sweep, and asserts it fails there. A gate -# that only passes on the already-fixed tree proves nothing about whether it -# would have caught the drift it was written for. +# it stood BEFORE the #113 sweep, and asserts it fails there. A gate that only +# passes on the already-fixed tree proves nothing about whether it would have +# caught the drift it was written for. +# +# Pinned to a commit SHA, not the `main` ref: `main` is the moving integration +# branch, and the #113 fix (ed8c99e) landed back on it, so querying live +# `main` for the "pre-sweep" corpus stopped reproducing the drift the moment +# that fix merged — the case silently started asserting the opposite of what +# it says. 598a7c3 is the last commit where gitea-issues/SKILL.md still had +# the bare `git remote get-url origin` call ed8c99e fixed. # # Everything after that is synthetic. The false-NEGATIVE cases (a bare command # the gate must catch) and the false-POSITIVE cases (correct content the gate @@ -48,12 +55,15 @@ expect() { fi } -echo "--- the pre-#113 corpus on main trips the gate ---" +echo "--- the pre-#113 corpus trips the gate ---" -# Derived from git, not hardcoded: the point is "the drift this gate exists for", -# and a hardcoded path list goes stale the moment a file is renamed. -if ! git -C "$REPO_ROOT" rev-parse --verify -q main >/dev/null; then - echo "SKIP: no local 'main' ref — the historical-corpus case cannot be reconstructed" +# The commit set is derived from git, not hardcoded, at this fixed SHA: the +# point is "the drift this gate exists for", and a hardcoded path list goes +# stale the moment a file is renamed. The SHA itself is deliberately hardcoded +# — see the header comment for why it must NOT be a moving ref like `main`. +PRE_SWEEP_REF="598a7c326a4bbfa4a39007eb95d944c4150686e8" +if ! git -C "$REPO_ROOT" rev-parse --verify -q "$PRE_SWEEP_REF" >/dev/null; then + echo "SKIP: pre-sweep commit $PRE_SWEEP_REF not reachable locally (shallow clone?) — the historical-corpus case cannot be reconstructed" exit 77 fi @@ -67,16 +77,16 @@ while IFS= read -r PRE_REL; do PRE_FILES+=("$PRE_REL") PRE_PATHS+=("$PRE/$PRE_REL") done < <( - git -C "$REPO_ROOT" ls-tree -r --name-only main -- 'plugins' \ + git -C "$REPO_ROOT" ls-tree -r --name-only "$PRE_SWEEP_REF" -- 'plugins' \ | grep -E '^plugins/[^/]+/\.apm/(skills/.*\.md|agents/.*\.agent\.md)$' \ | grep -v '/README\.md$' ) if [[ ${#PRE_FILES[@]} -eq 0 ]]; then - fail "no plugin skill/agent files found on main — the historical case checked nothing" + fail "no plugin skill/agent files found at $PRE_SWEEP_REF — the historical case checked nothing" else for f in ${PRE_FILES[@]+"${PRE_FILES[@]}"}; do mkdir -p "$PRE/$(dirname "$f")" - git -C "$REPO_ROOT" show "main:$f" > "$PRE/$f" + git -C "$REPO_ROOT" show "$PRE_SWEEP_REF:$f" > "$PRE/$f" done if bash "$SCRIPT" ${PRE_PATHS[@]+"${PRE_PATHS[@]}"} > "$RUN_TMP/pre.out" 2>&1; then fail "the pre-sweep corpus passed — the gate would not have caught the #113 drift"