From db2b27ce62a7301c13b3b5c9753d69ead0eaa672 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 17 Aug 2026 08:25:51 +0000 Subject: [PATCH 1/3] refactor(scripts): route hand-rolled git init through test-git-helpers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Five fixture-construction sites across three test suites duplicated the git init + identity config block that scripts/test-git-helpers.sh already publishes as git_init_test_repo, bypassing its inside-checkout safety guard (the class that bit as #2839) and its gpgsign/autocrlf hardening. Source the helper and call it at each site. Found by the first /coupling:reduce dogfood pass (apply lane; the route-lane findings are #2914). check-stale-base-overlap.test.sh is deliberately not converted: its fixture needs init -b, which the helper has no seam for yet — tracked in #2914. Verified: check-shell-portability.test.sh PASS=333 FAIL=0, check-skill-portability.test.sh PASS=89 FAIL=0, sync-standards-contract.test.sh PASS=12 FAIL=0, shellcheck clean. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_016CWMh6HAsgWWi9tLw76hZR --- scripts/check-shell-portability.test.sh | 9 +++------ scripts/check-skill-portability.test.sh | 5 ++--- scripts/sync-standards-contract.test.sh | 6 ++---- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/scripts/check-shell-portability.test.sh b/scripts/check-shell-portability.test.sh index 44143605d9..0a2397d41b 100755 --- a/scripts/check-shell-portability.test.sh +++ b/scripts/check-shell-portability.test.sh @@ -24,6 +24,7 @@ SELF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_ROOT="$(cd "$SELF_DIR/.." && pwd)" SCRIPT="$SELF_DIR/check-shell-portability.sh" REAL_TOKENS="$REPO_ROOT/scripts/shell-portability-tokens.txt" +. "$SELF_DIR/test-git-helpers.sh" PASS=0 FAIL=0 @@ -1543,9 +1544,7 @@ mkdir -p "$fx/scripts" "$fx/plugins/alpha/skills/demo/context" cp "$SCRIPT" "$fx/scripts/" out="$( cd "$fx" && - git -C "$fx" init -q && - git -C "$fx" config user.email test@example.com && - git -C "$fx" config user.name test && + git_init_test_repo "$fx" && git -C "$fx" commit -q --allow-empty -m base && base="$(git -C "$fx" rev-parse HEAD)" && printf '%s\n' 'stat -c %Y "$f"' >'plugins/alpha/skills/demo/context/mtime.md' && @@ -1639,9 +1638,7 @@ cp "$SCRIPT" "$fx/scripts/" quoted_name="$(printf 'quoted-\303\251.sh')" # trailing U+00E9 byte -- non-ASCII, triggers Git quoting out="$( cd "$fx" && - git -C "$fx" init -q && - git -C "$fx" config user.email test@example.com && - git -C "$fx" config user.name test && + git_init_test_repo "$fx" && git -C "$fx" commit -q --allow-empty -m base && base="$(git -C "$fx" rev-parse HEAD)" && printf '%s\n' 'grep -Eq "\\bfoo\\b" "$file"' >'plain.sh' && diff --git a/scripts/check-skill-portability.test.sh b/scripts/check-skill-portability.test.sh index 9d0ee0bdbb..6684b6bede 100755 --- a/scripts/check-skill-portability.test.sh +++ b/scripts/check-skill-portability.test.sh @@ -16,6 +16,7 @@ SELF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_ROOT="$(cd "$SELF_DIR/.." && pwd)" SCRIPT="$SELF_DIR/check-skill-portability.sh" REAL_TOKENS="$REPO_ROOT/scripts/skill-portability-tokens.txt" +. "$SELF_DIR/test-git-helpers.sh" # Minimal token list: just the active branch class, so a synthetic case is not # coupled to the shipping list's staged entries. @@ -669,9 +670,7 @@ cp "$SCRIPT" "$fx/scripts/" quoted_name="$(printf 'quoted-\303\251.md')" # trailing U+00E9 byte — non-ASCII, triggers Git quoting out="$( cd "$fx" && - git -C "$fx" init -q && - git -C "$fx" config user.email test@example.com && - git -C "$fx" config user.name test && + git_init_test_repo "$fx" && git -C "$fx" commit -q --allow-empty -m base && base="$(git -C "$fx" rev-parse HEAD)" && mkdir -p 'plugins/p/skills/s' && diff --git a/scripts/sync-standards-contract.test.sh b/scripts/sync-standards-contract.test.sh index 5ca82dd9e3..75f0e7b6d2 100755 --- a/scripts/sync-standards-contract.test.sh +++ b/scripts/sync-standards-contract.test.sh @@ -8,6 +8,7 @@ set -uo pipefail SELF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT="$SELF_DIR/sync-standards-contract.sh" +. "$SELF_DIR/test-git-helpers.sh" PASS=0 FAIL=0 @@ -76,10 +77,7 @@ base_fixture() { # git_fixture → init repo + commit everything as the base ref; prints base sha git_fixture() { local fixture="$1" - git -C "$fixture" init -q - git -C "$fixture" config core.autocrlf false - git -C "$fixture" config user.email test@example.com - git -C "$fixture" config user.name test + git_init_test_repo "$fixture" git -C "$fixture" add -A git -C "$fixture" commit -qm base git -C "$fixture" rev-parse HEAD From 10c0cc4373cb071cb40a20421044f6714806593c Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 17 Aug 2026 08:27:54 +0000 Subject: [PATCH 2/3] chore(scripts): drop paid fixture-git-isolation baseline debt for the three converted suites --- scripts/fixture-git-isolation-baseline.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/fixture-git-isolation-baseline.txt b/scripts/fixture-git-isolation-baseline.txt index e980c8b0c8..e977a9a458 100644 --- a/scripts/fixture-git-isolation-baseline.txt +++ b/scripts/fixture-git-isolation-baseline.txt @@ -61,7 +61,4 @@ plugins/testing/skills/audit/scripts/cant-fail-scan.test.sh plugins/typos-format/hooks/typos-format.test.sh plugins/work-items/skills/work/scripts/preflight.test.sh scripts/check-contract-slice-prune.test.sh -scripts/check-shell-portability.test.sh -scripts/check-skill-portability.test.sh scripts/check-stale-base-overlap.test.sh -scripts/sync-standards-contract.test.sh From 8e52e965693d3ce1f3774b07ab169b38c148da61 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 17 Aug 2026 08:30:35 +0000 Subject: [PATCH 3/3] fix(scripts): propagate git_init_test_repo refusal in git_fixture before add/commit can reach the real repo --- scripts/sync-standards-contract.test.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/sync-standards-contract.test.sh b/scripts/sync-standards-contract.test.sh index 75f0e7b6d2..7e1f14bc3a 100755 --- a/scripts/sync-standards-contract.test.sh +++ b/scripts/sync-standards-contract.test.sh @@ -77,7 +77,9 @@ base_fixture() { # git_fixture → init repo + commit everything as the base ref; prints base sha git_fixture() { local fixture="$1" - git_init_test_repo "$fixture" + # On refusal (e.g. TMPDIR inside the checkout) stop before add/commit can + # resolve to the enclosing real repository. + git_init_test_repo "$fixture" || return 1 git -C "$fixture" add -A git -C "$fixture" commit -qm base git -C "$fixture" rev-parse HEAD