wip: 891 review round 9 fixes

This commit is contained in:
2026-08-30 22:15:16 +02:00
parent d65b5c0a7e
commit d84289aaea
2 changed files with 41 additions and 63 deletions
+25 -50
View File
@@ -387,7 +387,7 @@ it had to go rather than be carried on. Because the set is now empty, TWO things
the survivor runner `test_every_SURVIVING_clause_mutation_still_does`, and the `unevidenced` arm of
`test_every_entry_declares_a_known_granularity_and_DETECTOR_entries_CARRY_their_survivor`. Both
self-arm the moment an entry is graded `DETECTOR`. `verify_mutation`'s "still PASSED" verdict path is
NOT one of them — an earlier revision listed it, wrongly: it is not `DETECTOR`-gated, and
NOT one of them, though it looks like it belongs: it is not `DETECTOR`-gated, and
`test_an_INERT_mutation_is_REPORTED_rather_than_passed` drives it every run. Recorded here rather
than implied to be covered, and asserted by `test_the_DETECTOR_survivor_set_is_empty_ON_PURPOSE` so
the empty set stays a decision rather than an unread skip.
@@ -449,53 +449,28 @@ lines flagged wrongly — and cold review then constructed more of both (`[[ "$x
a backslash continuation, a `>` inside a quoted string). Deleted rather than patched a fifth time,
on the same reasoning as the vocabulary-parity withdrawal above.
**`test_hook_fire_log.py` proves NINE clauses, and its row claims three of them.** Enumerated
individually and never as the remainder of a subtraction. Three successive revisions mis-sorted, and
the last one is the instructive case: it did not touch this paragraph at all — proofs landed in
`test_hook_fire_log.py` and nobody came back here. So the trigger is not "when editing this list" but
"when a proof lands anywhere in that file":
**`test_hook_fire_log.py` proves more clauses than its row claims, and this file no longer tries to
enumerate them.** Four successive revisions of a hand-written list mis-sorted it — a count that
drifted from the proofs, an arm credited with proofs it does not exercise, an unclaimed list missing
members, and a scope sentence that did not partition the file. That is the same shape as the two
withdrawals recorded above: a hand-maintained prose copy of something machine-checked elsewhere,
patched until the next reader believed it.
1. **Coverage** — every hook reports that it fired — `test_a_hook_that_LOSES_its_instrumentation_is_DETECTED`.
2. **Transparency** — the wrapper changes nothing the harness can see —
`test_instrumentation_changes_NOTHING_the_harness_can_see`, with
`test_DELETING_the_replay_makes_the_differential_go_RED` as its mutation proof.
3. **Placement** — `etv_hook_fire_begin` precedes the stdin read —
`test_begin_placed_AFTER_the_stdin_read_is_DETECTED`.
4. **ROOT** — the sourced sink is the one in the hook's own tree (ersatztv#891) — the parametrized
pair `test_CLAUDE_PROJECT_DIR_cannot_choose_the_SOURCED_sink` and its negative control
`test_the_sink_decoy_IS_sourced_when_it_genuinely_is_the_repo_root`, plus the husky relative-launch
pair, over a STATIC arm pinning the preamble's two lines byte-for-byte. Its mutation proof is
`…_a_LATER_reassignment_the_regex_cannot_see…`, for the indented/exported shape only byte-identity
sees. The DIAGNOSTIC arms beside it — which no longer decide, but say WHY a line is wrong — carry
their own: `…_ENV_VAR_resolved_sink_path…` for the pre-#891 form and
`…_the_NEXT_env_var_to_be_invented…` for its lexical successor. Bound to the arm each actually
exercises: an earlier revision credited all three to byte-identity, overstating its evidence 3:1.
5. **Suite isolation** — added in ersatztv#809/#822, described in the section below.
6. **The report's own root** (ersatztv#891) — `etv_hook_fire_repo_root` ignores `$CLAUDE_PROJECT_DIR`
and refuses a root that does not own this sink —
`test_CLAUDE_PROJECT_DIR_cannot_choose_which_trees_hooks_the_REPORT_describes` with its control,
and `test_the_report_REFUSES_a_root_that_does_not_OWN_this_sink`.
7. **Self-disablement** — a hook that sets `ETV_HOOK_FIRE_DISABLE=1` reads as instrumented and is
silent — `test_a_hook_that_DISABLES_its_own_reporting_is_DETECTED`. Its coverage boundary is
recorded below.
8. **Begin identity** — a hook that reports under another hook's name —
`test_a_hook_that_BEGINS_UNDER_ANOTHER_HOOKS_NAME_is_DETECTED`.
9. **Begin stdout mode** — a Claude hook flipped to `stream` records decisions from an exit status it
never uses — `test_a_hook_that_BEGINS_IN_THE_WRONG_STDOUT_MODE_is_DETECTED`.
So it is withdrawn rather than re-derived. The authorities are the row's own `Blocks` and `Proof ref`
columns, `scripts/tests/mutation_manifest.py`, and the test names in the file itself — all
machine-compared, none of which can drift from the code without a red. What is worth saying in prose
is only what those cannot express:
SCOPE, so the count stops drifting: these nine are the clauses about a hook's INSTRUMENTATION —
whether it reports, reports as itself, and sources the right sink — plus the suite's own isolation.
`test_hook_fire_log.py` also proves properties OUTSIDE that set and they are deliberately not
numbered here: decision fidelity (that the recorded decision is the one the hook emitted, and is not
laundered by odd exits, empty values, fd-4 writes or invalid UTF-8), log-directory containment, and
the report's anti-vacuity half. Those belong to the sink's behaviour, not to a hook's preamble.
The row's `Blocks` column covers 1, 2 and 4, and the `Proof ref` column holds one ref because the
column holds one. Clauses 3, 5, 6, 7, 8 and 9 are proved and unclaimed. SORTED BY MECHANISM, NOT BY
OUTCOME — stated because 7 and 8 sort differently under the two readings: a self-disabled hook and a
hook reporting under another name both END in "stops reporting that it fired", which is the `Blocks`
text, but neither is the MECHANISM that column names (losing the preamble). Read the column as the
defect it blocks, not the symptom.
- The row's `Proof ref` column holds ONE ref because the column holds one, not because the other
clauses are unproven.
- Read `Blocks` as the DEFECT MECHANISM, not the symptom. A self-disabled hook and a hook reporting
under another hook's name both end in "stops reporting that it fired", but neither is the mechanism
that column names (losing the preamble), so neither is claimed by it.
- ROOT (the sourced sink is the one in the hook's own tree, ersatztv#891) is the clause carrying a
NEGATIVE CONTROL, because its assertion is an ABSENCE and an inert fixture produces the same
absence. Its static half pins the preamble byte-for-byte; the diagnostic arms beside it, which no
longer decide, carry separate proofs. Which proof binds to which arm is settled by disarming the
arm and seeing which test reddens — not by this paragraph.
**Clause 7's arm is narrow, and that is recorded rather than implied.** It matches
`^\s*(export\s+)?ETV_HOOK_FIRE_DISABLE=1`, so it sees the bare and `export`ed forms. Measured
@@ -506,8 +481,8 @@ NOT because widening is impossible: the mechanism clause 4 already ships transfe
the non-comment lines mentioning the variable and require the list EMPTY, which refuses all four
spellings and anything not yet imagined. That is a whole-artifact pin, not a fifth alternation, and
it is the shape ersatztv#891 withdrew a lexical predicate in favour of. It is not done here only
because this change is already large and the hole is recorded; whoever needs the net should add that
check rather than another `|`-arm.
because ersatztv#891 was already large and the hole is recorded; whoever needs the net should add
that check rather than another `|`-arm.
ROOT carries a NEGATIVE CONTROL because its assertion is an ABSENCE — the decoy's marker must not
appear — which is also exactly what an inert fixture produces. (That is the distinguishing property,
@@ -522,8 +497,8 @@ the same tree by construction; husky starts `./.claude/hooks/…` by a path RELA
tree, so self-location resolves through the CWD and the two roots can genuinely disagree. The husky
half (`test_the_HUSKY_RELATIVE_launch_resolves_to_the_pushed_tree`, with its own control) derives
its population from the `.husky/*` wiring and is guarded against an empty one by
`test_the_husky_launched_population_is_not_empty`, since a `@parametrize` over nothing reports as
full coverage.
`test_the_husky_launched_population_is_not_empty` — a `@parametrize` over nothing does not fail, it
collects one SKIPPED placeholder that is indistinguishable from coverage in a full run.
**`test_the_suite_does_not_write_to_the_PRODUCTION_log` is a structural check, and deliberately
reads nothing under `$HOME`.** It asserts that the environment a module sees at IMPORT time already
+16 -13
View File
@@ -271,11 +271,9 @@ def strip_instrumentation(text: str) -> str:
made the reconstruction differ from the original by one blank line in all 13 hooks — harmless
behaviourally, but the A/B control is only trustworthy insofar as it IS the original, and
"differs only in ways I judged harmless" is a claim, not a property.
`test_the_stripper_removes_EXACTLY_the_preamble_and_nothing_else` turns it into a property — it
checks the property structurally (every removed line is a preamble line, nothing is added) rather
than against a historical copy. The name cited here before it does not exist anywhere in the
repo; it is pre-existing on `origin/main` and corrected in passing because this file is heavily
rewritten by ersatztv#891 and a citation to a missing test is the same stale-reference class.
`test_the_stripper_removes_EXACTLY_the_preamble_and_nothing_else` turns it into a property,
checked structurally — every removed line is a preamble line and nothing is added — rather than
against a historical copy.
"""
out, skipping = [], False
for line in text.splitlines(keepends=True):
@@ -559,10 +557,14 @@ def husky_launched_hooks() -> list[Path]:
def test_the_husky_launched_population_is_not_empty():
"""ANTI-VACUITY for the pair below. `@parametrize` over an empty list collects one SKIPPED
placeholder — measured, pytest's default `empty_parameter_set_mark` — which in a full run reads
as full coverage — the characteristic failure of a derived population that stops matching, which
this file has already shipped once (#631, #751)."""
"""ANTI-VACUITY for the pair below.
`@parametrize` over an empty list does not fail. Measured: pytest's default
`empty_parameter_set_mark` collects one placeholder reported as SKIPPED, which in a full run is a
single `s` among the dots — not a false green, but indistinguishable from coverage unless someone
reads the skip list. That is the characteristic failure of a derived population that stops
matching, and this file has already shipped it once (#631, #751).
"""
found = husky_launched_hooks()
assert found, (
f"no tracked hook under {HOOKS_DIR} is named by any file in .husky/, so the husky-launch "
@@ -656,10 +658,11 @@ def test_the_HUSKY_RELATIVE_launch_DOES_source_its_own_trees_sink(hook, sandbox,
def test_an_ENV_VAR_resolved_sink_path_is_DETECTED():
"""THE MUTATION PROOF for the static arm: reintroduce the pre-#891 line into each real hook in
turn and the checker must report it. Built by editing the hook's OWN assignment rather than from
a hand-written fixture, so the check is measured against the shape the repo actually shipped
(`verify against the REAL predecessor`).
"""THE MUTATION PROOF for the `CLAUDE_PROJECT_DIR` DIAGNOSTIC arm — not for byte-identity, which
has its own in `test_a_LATER_reassignment_the_regex_cannot_see_is_DETECTED`. Reintroduce the
pre-#891 line into each real hook in turn and the checker must report it. Built by editing the
hook's OWN assignment rather than from a hand-written fixture, so the check is measured against
the shape the repo actually shipped (`verify against the REAL predecessor`).
"""
predecessor = (
'ETV_HOOK_FIRE_LIB="${CLAUDE_PROJECT_DIR:-'