Repository navigation
Description
A guard is only as good as the test that fails without it, and this repository's own scripts/README.md already says the equivalent for gates: "A gate nobody has watched fail is a gate nobody knows works." The technique that discharges that for a unit test is to remove the guard, run the one test that claims to cover it, and require a failure.
It is practiced repeatedly and stated in no committed file. grep -rniE 'mutation[- ]test|guard is removed' over the tree returns nothing.
Why writing it down is worth more than it looks
On #1423, twenty-one guards were checked this way and every one held. The value was not the twenty-one passes, it was the two failures the technique produced that nothing else would have:
-
A test that did not test what it claimed. One guard read as unguarded. Chasing it found the harness rather than the code: two mutations that delete equal-length text produce equal-sized files, and CPython validates a cached
.pycon modification time and size alone, so within one modification-time tick the second run imported the first mutation's bytecode. Any hand-rolled harness of this shape has that defect until it clears__pycache__and setsPYTHONDONTWRITEBYTECODE=1. -
A test hollowed out by its own fix. A reviewer asked that a test stop pinning a literal and read the constant instead, which is correct. Deriving a test's expectation from the same constant the code uses can also make it assert nothing. Re-running the removal check is what proved it still failed without the guard.
Neither is discoverable by reading the test. Both are one command away when the technique is written down and nobody's to find when it is not.
What this asks for
A decision on where it belongs, then the text. Candidates, in the order they seem to fit:
code-review's "Review the Change" criteria already ask whether a new guard has a test that fails when the guard is removed. That is the reviewer's question. This is the author's technique for answering it before a reviewer asks, so it may belong beside it rather than in it.GOVERNANCE.md"Verification Discipline", which owns what counts as proof that work happened.scripts/README.md, beside the gate sentence quoted above, scoped to this repository's own tests.
Whether a harness belongs in scripts/ at all is a separate and larger question, and this issue deliberately does not ask for one. Every instance so far has been a throwaway script, which is the same shape #1401 described for the verbatim section re-vendor before it got a tool: cheap each time, and correct only when whoever wrote it happened to get the details right. The two failures above are what that costs. Worth measuring how often the technique is actually run before deciding a tool is owed.
Filed from #1423's work rather than kept as a session note.
Activity
[-]Proving a Guard by Removing It Is Practised Every Time and Written Down Nowhere[/-][+]Proving a Guard by Removing It Is Practiced Every Time and Written Down Nowhere[/+]ptr727 commentedon Oct 23, 2026
Closed under the maintainer's decision (ptr727, 2026-10-23) on #3391: the backlog keeps real bugs with a stated failure, features the maintainer wants, and open decisions. A finding the review loop filed on code or text a change did not touch, a refactor or consolidation chore, a tracker, a wording item, or a guard shape no session has produced is closed rather than worked. Reopen with the input and the wrong result if this issue states one.