wip: 891 review round 13 — pin the two unpinned arms instead of describing them
Seven rounds of prose defects around one guard, each fix spawning the next. The mechanism was an arm defended by a hand-maintained list rather than by a test, so the list had to be believed and kept being wrong. Both unpinned arms now carry a proof asserting their OWN fault message: test_a_hook_that_LOSES_its_begin_CALL_is_DETECTED and test_a_begin_call_NAMING_NO_STDOUT_MODE_is_DETECTED. Disarming either with `pass` reddens exactly its own test on 13/13 hooks and nothing else. Decisions-Edit: yes
This commit is contained in:
@@ -72,6 +72,8 @@ by regex, so the guard stopped trying: every non-comment line mentioning the var
|
||||
the two canonical lines, byte for byte. The lexical arms over the preamble survive only to say WHY a
|
||||
line is wrong — that includes the pattern matching the sourcing line, which byte-identity
|
||||
necessarily matches and which therefore decides nothing on its own. The arms judging other things —
|
||||
a self-disabled hook, the begin call's name, mode and ordering — are not subsumed and still decide.
|
||||
a self-disabled hook, and the begin call's PRESENCE, name, mode and ordering — are not subsumed and
|
||||
still decide. Each is pinned by its own test asserting its own fault message, so this sentence is a
|
||||
map and not the guard: deleting an arm on the strength of this list reddens the suite.
|
||||
The cost is that a future rewrite of the line must edit one constant and all the hooks together,
|
||||
which is the property #891 exists to hold.
|
||||
|
||||
@@ -460,8 +460,9 @@ could, and what remains is only what nothing beside the code already says.
|
||||
|
||||
Read the artifacts instead. The row's `Proof ref` and `scripts/tests/mutation_manifest.py` are held
|
||||
against each other and EXECUTED by `test_mutation_harness.py`, so a stale ref there is a red rather
|
||||
than a reading error. The arms are enumerated and explained in `scripts/tests/test_hook_fire_log.py`
|
||||
itself — the ENUMERATED list inside `instrumentation_faults`, plus per-arm comments at most of them.
|
||||
than a reading error. The arms are explained in `scripts/tests/test_hook_fire_log.py` itself, in the
|
||||
comments through `instrumentation_faults`; the list partway down that function enumerates the arms
|
||||
byte-identity does NOT subsume, and every one of those is pinned by its own test.
|
||||
|
||||
One thing no artifact records, so it is written here: **the `Blocks` column is not machine-checked at
|
||||
all.** `inventory_rows()` parses that cell into a discard variable and nothing else reads it, so a
|
||||
|
||||
@@ -172,13 +172,14 @@ def instrumentation_faults(text: str, name: str) -> list[str]:
|
||||
#
|
||||
# ENUMERATED, not counted: a count here has been wrong twice. The arms judging OTHER THINGS are
|
||||
# NOT subsumed — `ETV_HOOK_FIRE_DISABLE`, and the begin call's PRESENCE, name, mode and stdin
|
||||
# ordering. PRESENCE is the one to watch: it is unsubsumed AND UNPINNED. Measured 2026-08-30 —
|
||||
# neutralising `if not m:` below leaves the whole file green (186 passed, baseline identical),
|
||||
# because `…_LOSES_its_instrumentation_…` asserts only that the fault list is NON-EMPTY and a
|
||||
# stripped hook trips four arms, so removing one still leaves three answering. Disarm it with
|
||||
# `pass`, never `if False:` — that falls through to `m.group(1)` on None and reds with an
|
||||
# AttributeError, a red for the wrong reason that reads as a proof. Being unpinned is why it must
|
||||
# stay ENUMERATED here: nothing else would notice its deletion. A
|
||||
# ordering. Every one of them is now pinned by a test asserting ITS OWN fault message, so this
|
||||
# list no longer has to be believed — delete an arm and the suite reddens. It did have to be
|
||||
# believed: PRESENCE and the no-mode-token arm were unsubsumed AND unpinned, because
|
||||
# `…_LOSES_its_instrumentation_…` looks like their proof and is not (it asserts only that the
|
||||
# fault list is NON-EMPTY, and a stripped hook trips four arms, so removing one leaves three
|
||||
# answering). Disarm an arm here with `pass`, never `if False:` — several fall through to a
|
||||
# `.group(1)` on None and red with an AttributeError, a red for the wrong reason that reads like
|
||||
# a proof and cost this branch two review rounds. A
|
||||
# hook carrying both canonical lines plus `ETV_HOOK_FIRE_DISABLE=1` trips exactly one fault, and
|
||||
# it is not byte-identity's, so a reader who sorts those into "already covered" deletes a live
|
||||
# detector.
|
||||
@@ -432,6 +433,40 @@ def test_a_hook_that_BEGINS_UNDER_ANOTHER_HOOKS_NAME_is_DETECTED(hook):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("hook", hook_scripts(), ids=lambda h: h.stem)
|
||||
def test_a_hook_that_LOSES_its_begin_CALL_is_DETECTED(hook):
|
||||
"""PINS the begin-call PRESENCE arm, which was unsubsumed AND unpinned until ersatztv#891.
|
||||
|
||||
`…_LOSES_its_instrumentation_…` above looks like this arm's proof and is not: it strips the whole
|
||||
preamble, which trips FOUR arms on every hook, and it asserts only that the fault list is
|
||||
non-empty — so deleting this arm leaves it green with three arms still answering. An arm nothing
|
||||
reddens for is one a reader can delete on the strength of a prose list, which is how the
|
||||
enumeration beside the arms became load-bearing. This asserts the arm's OWN message instead.
|
||||
"""
|
||||
mutated = re.sub(r"^etv_hook_fire_begin .*\n", "", hook.read_text(), count=1, flags=re.M)
|
||||
faults = instrumentation_faults(mutated, hook.stem)
|
||||
assert any("never calls etv_hook_fire_begin" in f for f in faults), (
|
||||
f"{hook.name} lost its begin call and the check stayed green, so nothing would notice this "
|
||||
f"arm being deleted. faults={faults}"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("hook", hook_scripts(), ids=lambda h: h.stem)
|
||||
def test_a_begin_call_NAMING_NO_STDOUT_MODE_is_DETECTED(hook):
|
||||
"""PINS the arm beside the one above, found unpinned by the same sweep rather than by a report.
|
||||
|
||||
The MODE MISMATCH arm has a proof; the arm that fires when there is no mode token to compare had
|
||||
none, and the two fail differently — a mismatch is a wrong mode, this is no mode at all. The
|
||||
mutation is a DOUBLED SPACE, so the token count changes without the line looking edited; that is
|
||||
the shape a reflow or a careless sed produces, and it silently disables the mode check below it.
|
||||
"""
|
||||
mutated = re.sub(rf"^(etv_hook_fire_begin {re.escape(hook.stem)}) ", r"\1 ", hook.read_text(), count=1, flags=re.M)
|
||||
faults = instrumentation_faults(mutated, hook.stem)
|
||||
assert any("names no stdout mode" in f for f in faults), (
|
||||
f"{hook.name}'s begin call lost its stdout mode token and the check stayed green. faults={faults}"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("hook", hook_scripts(), ids=lambda h: h.stem)
|
||||
def test_a_hook_that_BEGINS_IN_THE_WRONG_STDOUT_MODE_is_DETECTED(hook):
|
||||
"""And another. Flipping a Claude hook to `stream` stops its stdout being read, so every decision
|
||||
|
||||
Reference in New Issue
Block a user