b2b651779a45ecc50058643f9be89de5b064ffe6
4
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b2b651779a |
fix(785): close the re-review's BLOCKER — the leak guard pinned the FIX, not the property
Third cold review, this one scoped to the previous two fix commits. Its central finding is the one worth reading, because the guard it faults is the guard I added to stop exactly this class of thing. BLOCKER — `test_the_subprocess_env_CARRIES_the_isolated_hook_fire_log_dir` asserted on `_env()`'s RETURN VALUE. `_env()` can be perfectly correct while a call site passes something else, and that is the reintroduction a future tidy-up actually produces. Demonstrated: leave `_env()` exactly as shipped, restore a module-level snapshot and point one `env=` at it — 13 tests pass and 58 records leak. I reproduced it before acting. The guard was pinned to the SHAPE OF THE FIX rather than to the property, which is `verify-against-the-REAL-predecessor`: it was witnessed red against a hand-written revert, so "pins it" and #809's "witnessed red by reintroducing the snapshot" were both overclaims. `test_driving_a_hook_LANDS_its_records_in_the_ISOLATED_dir` asserts the EFFECT instead — drive a real hook through the real `_run()`, records must land in the fixture's dir — with an anti-vacuity check that the hook reached a decision first. Measured: green at head, RED under the call-site reintroduction that the old guard passed. MEDIUM x3 — the workflow extractor was a text scanner and review broke it three ways in one pass. A `run: |` block scalar was invisible, so reformatting the step to the form its own sibling in that job already uses produced a FALSE RED whose message asserts a CI regression that has not happened. A job or step switched off with `if: false` or `continue-on-error: true` still read as wired — 7 green with the guard not gating at all. And `run:` inside block-scalar TEXT was extracted and executed, so an `echo we no longer run: PYTHONPATH=. python3 ... --check` left the subprocess proof green while the real step was deleted. Two of the three are false greens. `fixing-a-parser-bug-introduces-the-next-one` says the second round of a string predicate is not the last. The structure is available — pyyaml is installed by the `script-tests` job and four sibling suites already parse this workflow with it — so the scanner is replaced by `yaml.safe_load`, and "would actually execute" is now three explicit conditions: the job exists, the job is not disabled, the step is neither disabled nor allowed to fail. The six ways it can stop gating are a parametrised test, and the block-scalar REFORMAT is a negative control, because a detector that cannot tell a reformat from a removal trains its readers to ignore it. LOW — `_hook_calls` skipped whole-line comments but not inline ones, and broadening the marker in the previous commit is what made that reachable: a trailing `# ... .claude/hooks/removed-helper.sh` reddened a correct `pre-push`. The fix for one over-match introduced another. Verified both directions. NIT — a section header still said "three clauses" after the fourth mutation was added. Docs. Two accuracy fixes, both verified against the files rather than reasoned about: `test_hook_fire_log.py` proves THREE clauses (coverage, transparency, placement), not two, and its row's Blocks column already claims two of them — the single `Proof ref` is a column limit, not a coverage statement. And the "1,488 stray records" figure was unreproducible in a durable doc, the same commit having deleted the evidence. Replaced with the reproduction and a figure that survives it: 58 records per run, measured identically on macOS/git 2.55 and Linux/git 2.47.3. Also corrects a count in 88832047b's own message: it says the inversion reddens "8 of 12"; that file had 13 tests at that commit. Third mislabelled figure in this branch, all three in messages about mislabelled figures. Refs: #785 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
4822003004 |
fix(785): stop the tests writing to the PRODUCTION hook-fire log, and correct a mislabelled count
Two independent cold reviews, both against the real subjects rather than the diff. Five
findings; the first is the serious one.
HIGH — `test_worktree_ownership_guard.py` was defeating conftest's isolation. `_ENV` was a
module-level `{**os.environ, ...}` snapshot, taken at IMPORT time, which is before the
autouse `isolate_hook_fire_log` fixture monkeypatches `ETV_HOOK_FIRE_LOG_DIR`. So every
hook subprocess logged to the real `$HOME/.cache/ersatztv/hook-fire/`. Measured: 1,488
records for the two synthetic session ids, and one further run added 28 more.
That is #776's defect reintroduced inside the file meant to prove #776's hooks, and it
corrupts the surface `docs/guard-inventory.md` cites as the observability claim for every
guard still graded NONE. Nothing surfaced it because the fire-log library is fail-open by
design — a logging failure must leave the hook behaving exactly as an uninstrumented one.
The env is now built per call. Measured after: a full run of the file adds 0 records. The
stray records were deleted; `s1`/`unknown-session` were left alone, not being ours.
`test_the_subprocess_env_CARRIES_the_isolated_hook_fire_log_dir` pins it, witnessed red by
reintroducing the snapshot. It is per-file, which is the same narrowness as the guard that
should have caught this: `test_hook_fire_log.py::test_the_suite_does_not_write_to_the_
PRODUCTION_log` says conftest "must isolate every test, not just this file's" but checks
only the running test and its own sandbox. Recorded in the inventory and tracked in #809,
including why the obvious general check (diff the log dir per test) is racy against a real
session's hooks firing concurrently.
MEDIUM — a9433d5cb's commit message mislabels a measurement. It reports the ownership
comparison mutation as "2 failed, 8 passed (inverted)". Reproduced both: INVERTING the
clause reddens 8 of 12 at today's head; 2 failed / 8 passed is what DELETING it produces
(2 of 10 at that commit's head). The number is real but belongs to the mutation the
parenthetical says was rejected. The shipped test is unaffected — inversion genuinely
reddens `test_MUTATION_inverting_the_OWNERSHIP_COMPARISON_blocks_the_owner`. Corrected
here rather than by amending, since the history is the record.
LOW — `docs/guard-inventory.md` described the unproven set as "every PreToolUse hook
except ..." two paragraphs above a standing list of eight hooks spanning four events. Both
sentences named the same set. `design-sync-reminder.sh` is registered on BOTH PreToolUse
and Stop in `.claude/settings.json`, so any "every X hook" phrasing double-counts it; the
set is now named by enumeration.
LOW — a truncated sentence ("`test_hook_fire_log.py` asserts TWO clauses", no verb, no
closing bold) orphaned the following paragraph's "That unproven set". Completed with both
clauses and their proofs.
NIT — `_hook_calls` matched comment lines and only the `./` invocation form. A commented
ghost hook would have reddened a correct tree; a `bash .claude/hooks/x.sh` form would have
gone unstubbed and exited 127, which two tests read as "drift caught". Both verified.
Refs: #785
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
77317e5c71 |
test(785): pin the pre-push premise to both platforms, measured not assumed
The docstring said "git 2.55, macOS; the same holds on Linux". The second half was an assertion, and this repo's canonical disaster (#775, the BOM guard) is precisely a guard that behaved differently on the platform nobody measured — macOS had `xxd`, the Linux runner did not, and it was fail-open there for months. So it was measured on the runner host (Linux, git 2.47.3) rather than reasoned about: * git exports GIT_DIR=<repo>/.git/worktrees/<wt> to pre-push on a push from a worktree * `git rev-parse --show-toplevel` from web/ with that GIT_DIR answers `<wt>/web` * the nested `git diff --exit-code` reports exit 0 on a drifted file and all three new suites were run there: 25 passed. Disarming the `unset` on that host reddens 4 of the 9, the same four as on macOS. Refs: #785 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
d05d6623d1 |
test(785): pin .husky/pre-push's unset GIT_DIR ..., and measure why it matters
The one-line fix at pre-push:11 had nothing pinning it, and #785 ranks it third because the regression is a relocation rather than a deletion — a tidy-up that reads as a no-op. What the investigation established, since the comment above it asserts the mechanism without stating when it applies (git 2.55): * git exports GIT_DIR to pre-push when the push comes FROM A WORKTREE, and exports nothing from the main tree. `process.shared-tree-readonly` makes the worktree the mandated way to work here, so the exposed path is the normal one, not an edge case. * with GIT_DIR set and GIT_WORK_TREE unset, git stops discovering the repo and treats the CURRENT DIRECTORY as the work tree: `git rev-parse --show-toplevel` from web/ answers `<wt>/web`. * so `cd web && npm run check:api`'s `git diff --exit-code` compares against index paths that do not exist there and reports NO DIFF, exit 0. Generated-API drift ships and the gate prints success. The test drives the real pre-push file unedited, in a real worktree, with that exact environment; the hook calls are stubs (DERIVED from the file, so a new hook cannot leave the harness dying at a missing script and calling that a red) and `npm` is a stand-in whose `run check:api` performs the nested diff. Both mutations witnessed red against the real file: deletion -> 4 failed, 5 passed; relocation to the end -> 5 failed, 4 passed. The relocation mutation was wrong in the first draft. Appending the `unset` at the end also makes it the script's last statement, and a bare `unset` succeeds — so a `returncode == 0` assertion held for a reason unrelated to the nested git call. The stand-in npm now records the nested diff's OWN exit code and the mutations assert on that. Verified by making the mutation a no-op: the test fails, as it must. Refs: #785 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |