fix(tests): pin test-check-rtk-prefix.sh's pre-#113 corpus to a fixed SHA

The "pre-#113 corpus on main trips the gate" case reconstructed the
historical (pre-sweep) corpus from the live `main` ref. `main` is the
moving integration branch, and the #113 fix (ed8c99e) landed back onto
it — so the moment that fix merged, `main` stopped containing the bare
`git remote get-url origin` drift the case exists to catch, and the
assertion "the gate should fail on this corpus" silently flipped to
false. This blocked `git push` on every branch via the run-tests
pre-push hook, unrelated to whatever was actually being pushed.

Pin to 598a7c3, the last commit before ed8c99e where
gitea-issues/SKILL.md still had the unprefixed call. A specific commit
SHA is immutable, unlike `main`.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PDj6F7SPXzh3FtPN78dZ88
This commit is contained in:
2026-09-09 19:23:38 +00:00
parent b7bec71b8f
commit 6ba29b696c

View File

@@ -4,9 +4,16 @@ set -euo pipefail
# Tests for scripts/check-rtk-prefix.sh — ADR-0023 clause 1. # 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 # 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 # it stood BEFORE the #113 sweep, and asserts it fails there. A gate that only
# that only passes on the already-fixed tree proves nothing about whether it # passes on the already-fixed tree proves nothing about whether it would have
# would have caught the drift it was written for. # 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 # 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 # the gate must catch) and the false-POSITIVE cases (correct content the gate
@@ -48,12 +55,15 @@ expect() {
fi 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", # The commit set is derived from git, not hardcoded, at this fixed SHA: the
# and a hardcoded path list goes stale the moment a file is renamed. # point is "the drift this gate exists for", and a hardcoded path list goes
if ! git -C "$REPO_ROOT" rev-parse --verify -q main >/dev/null; then # stale the moment a file is renamed. The SHA itself is deliberately hardcoded
echo "SKIP: no local 'main' ref — the historical-corpus case cannot be reconstructed" # — 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 exit 77
fi fi
@@ -67,16 +77,16 @@ while IFS= read -r PRE_REL; do
PRE_FILES+=("$PRE_REL") PRE_FILES+=("$PRE_REL")
PRE_PATHS+=("$PRE/$PRE_REL") PRE_PATHS+=("$PRE/$PRE_REL")
done < <( 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 -E '^plugins/[^/]+/\.apm/(skills/.*\.md|agents/.*\.agent\.md)$' \
| grep -v '/README\.md$' | grep -v '/README\.md$'
) )
if [[ ${#PRE_FILES[@]} -eq 0 ]]; then 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 else
for f in ${PRE_FILES[@]+"${PRE_FILES[@]}"}; do for f in ${PRE_FILES[@]+"${PRE_FILES[@]}"}; do
mkdir -p "$PRE/$(dirname "$f")" 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 done
if bash "$SCRIPT" ${PRE_PATHS[@]+"${PRE_PATHS[@]}"} > "$RUN_TMP/pre.out" 2>&1; then 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" fail "the pre-sweep corpus passed — the gate would not have caught the #113 drift"