From 0c5938dd603c6ecba9ca7094e4c8b41bbc7673f3 Mon Sep 17 00:00:00 2001 From: Timothy Date: Thu, 13 Aug 2026 22:26:25 +0200 Subject: [PATCH] fix(774): the wiring check counted a MENTION, reproducing inside the fix the defect it closed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Self-audit before re-review, and it found one. `wired_hook_files()` was added to stop hook EXISTENCE standing in for hook WIRING — but it substring-matched the filename against the whole husky text, and `.husky/pre-commit:7` reads # CI where a base ref exists). Fail-open shim — see .claude/hooks/decisions-guard.sh. one line above the real invocation. Delete line 8, keep line 7, and the hook still reads as wired. That is mention-for-invocation, which is the exact substitution the function exists to prevent, one line inside the fix for it. Comment lines are now stripped from the husky hooks first; settings.json needs no stripping because JSON has no comments. Proven both ways: with the invocation removed and the comment left, the guard names decisions-guard.sh as unwired; clean tree stays green. Also verified rather than assumed, since a fix round is where adjacent defects live: - a stale SELF-referencing proof ref is still caught (the self-reference escape hatch skips only the PROOF-row classification check, not the def-existence check); - a reworded summary is LOUD, not vacuous — an unparsed summary fails with a message saying so, rather than silently checking nothing. ruff clean, pyright clean (0 errors) on the three new files. Deliberately NOT ruff-format-ed: the pre-existing scripts/tests corpus is not formatted either, so reformatting only these three would diverge them from every sibling and bake in a format derived from an un-versioned config on one machine — which is the divergence #780 exists to settle. 580 script-tests pass. Refs #774 Co-Authored-By: Claude Opus 5 (1M context) --- scripts/tests/test_ci_image_pin_population.py | 2 +- scripts/tests/test_guard_inventory.py | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/scripts/tests/test_ci_image_pin_population.py b/scripts/tests/test_ci_image_pin_population.py index b7a635751..b30a8d08b 100644 --- a/scripts/tests/test_ci_image_pin_population.py +++ b/scripts/tests/test_ci_image_pin_population.py @@ -197,7 +197,7 @@ def test_the_registry_partitions_every_job_in_the_workflow(): "always a recorded decision rather than an omission." ) assert not (TOOLCHAIN_JOBS & BARE_RUNNER_JOBS), "a job cannot be in both lists" - assert TOOLCHAIN_JOBS | BARE_RUNNER_JOBS == all_jobs, ( + assert all_jobs == TOOLCHAIN_JOBS | BARE_RUNNER_JOBS, ( f"the registry names jobs that do not exist: " f"{sorted((TOOLCHAIN_JOBS | BARE_RUNNER_JOBS) - all_jobs)}" ) diff --git a/scripts/tests/test_guard_inventory.py b/scripts/tests/test_guard_inventory.py index 1ff662274..34282ee8a 100644 --- a/scripts/tests/test_guard_inventory.py +++ b/scripts/tests/test_guard_inventory.py @@ -99,11 +99,24 @@ def wired_hook_files() -> set[str]: its file, keeps its inventory row, and stops running — and the table would go on describing a working guard. That is #631 and #719's shape ("wired is not running") one level down, and it was the derivation's blind spot until cold review named it. + + COMMENT LINES ARE STRIPPED from the husky hooks first, and that is not a refinement — the first + version of this function counted a mention anywhere, and `.husky/pre-commit:7` reads + + # CI where a base ref exists). Fail-open shim — see .claude/hooks/decisions-guard.sh. + + one line above the real invocation. Delete line 8 and keep line 7 and the hook would still have + read as wired, which is the exact substitution of mention for invocation this function exists to + stop, reproduced inside the fix for it. `.claude/settings.json` needs no stripping: JSON has no + comments, so every occurrence there is in a real command string. """ text = (REPO_ROOT / ".claude" / "settings.json").read_text() for husky in HUSKY_DIR.iterdir(): if husky.is_file(): - text += husky.read_text() + text += "\n".join( + line for line in husky.read_text().splitlines() + if not line.lstrip().startswith("#") + ) return { str(p.relative_to(REPO_ROOT)) for p in HOOKS_DIR.glob("*.sh") if p.name in text }