test(hooks): the installed-hook parity check saw one repository, not every governed root (BACKLOG #1376) - #787
test(hooks): the installed-hook parity check saw one repository, not every governed root (BACKLOG #1376)#787wshallwshall wants to merge 1 commit into
Conversation
…every governed root (BACKLOG #1376) tests/test_installed_coord_hooks.py rooted its git-hook half at this checkout, so a second primary checkout on the worktree gate's machine allowlist could run a months-old payload with nothing anywhere reporting it. It now reads the allowlist and audits every governed root. The comparison is per-root and self-referential: each root's installed payload is judged against that root's own committed scripts/hooks/ source, using that root's own installer to say which payloads it manages. Nothing is compared across roots, so this decides nothing about which checkout's copy of a shared script is authoritative -- that stays an open owner ruling, and it is the named blocker on porting the three instruments into the vault. Three controls: the audit is driven against constructed roots in tmp_path in both conditions, one whose installed payload matches its committed source and one whose does not, and a third pins that an installer whose payload list cannot be read reports UNAUDITABLE rather than clean. No real installed hook and no machine allowlist is touched. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Lander, routing this back rather than fixing it. I re-ran it first, so this is not a flake. WHAT IS RED. THE CAUSE, and it is why only Linux fails. The test feeds Windows-style paths to the reader and then takes WHY IT IS YOURS AND NOT MINE OR MAIN'S. Three checks:
I have not touched it. The fix is a design call about what the reader is meant to accept -- whether Windows-style paths belong in a governed-roots file that a Linux runner also parses, or whether the test should use NOTE: another open pull request fails this exact test the same way and also edits this file. If you are the same author or the same work, they may want fixing together; if not, whichever lands second will need a rebase. AFTER YOU PUSH, do the label sequence or you will lose a merge silently: wait for this branch's Send me the number when it is pushed and I will land it. |
BACKLOG #1376, engine-side half.
tests/test_installed_coord_hooks.pyrooted its git-hook parity check at THIS repository, so a second primary checkout on the worktree gate's machine allowlist could run a months-old hook payload with nothing anywhere reporting it. It now reads the allowlist and audits every governed root.The ruling this PR does not make, and cannot
Which checkout's copy of a shared governance script is authoritative -- the engine's or the vault's? That is an owner ruling. It is the named blocker on the rest of #1376: the three parity instruments cannot be ported into the vault until it is answered, because every one of their assertions compares an installed copy against a source, and in the vault they would fire on day one against older sources. That decides the question by landing rather than by ruling.
Nothing here presumes an answer. The audit is per-root and self-referential: each root's installed payload is judged against that root's own committed
scripts/hooks/source, using that root's own installer to say which payloads it manages. No copy is compared across roots.The measurement, re-run at HEAD with controls
Engine
origin/mainfd44b0f17, vaultorigin/mainb2ca63d16.scripts/worktree/install-gate.ps1scripts/worktree/install-selfheal.ps1scripts/coord/install-git-hooks.ps1tests/test_gate_installed_parity.pytests/test_selfheal_installed_parity.pytests/test_installed_coord_hooks.pyPositive control on the absence claim: the same
git ls-tree -r --name-only origin/main -- testsfilter that returned none of the three returned four other*_parity.pyfiles in the vault, so the search can see a present case. The vaulttests/tree holds 527 entries, so this is not a repo-shape artifact.Two figures in the item have moved, and the finding has not. The vault's
scripts/hooks/worktree_gate.ps1is 23,042 bytes at itsorigin/main, last touched 2026-07-24, against the engine's 205,331, last touched 2026-09-01 -- not the 23,430 against 208,171 the scoring line records. Only the byte counts moved, because both files moved. The vault still ships a July build of the gate. I left the scoring line and its summary-table copy alone rather than edit another seat's dated measurement; the correction is a dated note on the item.The gap was live, not latent. The vault's own
.git/hookscarries an installedclaim_check.py, and before this change nothing in either checkout compared it against anything.What the widened test found on the reference box
The vault's
install-git-hooks.ps1declares no$payloadslist the engine's parser can read, so the audit reports that root UNAUDITABLE rather than clean. That is a true finding and it is why the port is more than a copy: the repair is either an edit to that installer or a wider parser, and choosing between them is the same open ruling. I deliberately did not widen the parser to guess -- a wrong payload list reports confident parity over the wrong files, which is worse than reporting nothing. I also did not read the vault's installer to learn its shape; the scope bound on this brief limits vault reads toroles/, and everything above came from read-only ref reads.The pre-existing red is host state, and it was not silenced
The brief flagged a run reporting content drift on
claim_check.pyandpush_guard.py. It reproduces, it is correct, and it is host state, not a repository defect. The copies installed under the engine's shared.git/hooksare exact but older revisions of this repository's sources:claim_check.pymatches commita729131dc(2026-08-24), so it lacks the fail-closed fix from68f7cd699(BACKLOG #1383)push_guard.pymatches commit29eae2a2e(2026-08-27)I found which commit each installed copy is by hashing every historical revision of the source with the same CRLF-folded basis the test uses, so this is not an inference from dates. The repair is an operator running
scripts\coord\install-git-hooks.ps1from a plain terminal in the primary checkout. Nothing in this PR touches it.tests/test_gate_installed_parity.py::test_the_installed_gate_matches_the_committed_sourcealso fails on this box for the same class of reason. I did not touch that file.Anti-vacuity
Three controls, all in
tmp_path, none touching a real installed hook or the machine allowlist at~/.claude/hooks/worktree-gate.repos.txt:Verified the CI shape too: with
USERPROFILEpointed at an empty directory the new test skips with its reason printed, so CI stays green by construction, as the rest of this module already does.Checks run
ruff format --check(changed file)ruff check(changed file)mypy messagefoundrymypy tests/test_installed_coord_hooks.pypytest tests/test_installed_coord_hooks.pypyteston 4 backlog/ledger modulespytest tests/test_selfheal_installed_parity.pypytest tests/test_gate_installed_parity.pyscripts/docs/backlog_status_check.pyNot run: the full suite. This worktree has no
.venvand a fresh install fails onwatchfiles, which has no cp314 wheel; I ran the modules above through the primary checkout's interpreter. Hosted-runner legs,windows-service-smokeamong them, must be read after this process exits.Open questions for whoever picks this up
The authoritative-copy ruling is the blocker and it is not mine to make. Until an owner rules, the three instruments stay unported and the vault's
install-git-hooks.ps1stays unauditable by this parser.Second, smaller: the governed-root set is not knowable from this repository alone. It lives in
~/.claude/hooks/worktree-gate.repos.txt, a machine file outside git, which is why this test skips on CI. I built what is knowable -- the audit reads that file at run time on a developer box, the same posture every other test in this module already has. If the governed set should also be asserted from something checked in, that is a separate item and it needs a decision about where such a list would live.Third: this test now goes red on a developer box for a condition in a repository this PR may not touch. I judged a red the right posture, because an informational print inside a green test restores the exact blindness #1376 was filed for, and the module's own precedent for a genuinely foreign entry (another tool's settings hook) is narrower than a checkout on our own governance allowlist. If a reviewer disagrees, the change is one assertion.
🤖 Generated with Claude Code