check-figures: the guard's body belongs behind the entry-point check
The fold exported scanDocument for the string tests, and importing it also ran the guard. check-behaviour imports that module, so a figure defect called process.exit(1) inside check-behaviour: it reported check-figures' failure under its own name having run zero of its 108 tests. The build went red, which is why this was survivable, but it went red in the wrong place and every behavioural test was silently not running while appearing to. A guard that stops another guard from running, and cannot say so, is the worst version of the fault this file exists to catch. Body now sits behind import.meta.main, the idiom step5-split.mjs already uses. Importing yields the four readers and nothing else. Tested by spawning a fresh process, because the property is "importing has no effect" and a source assertion would pass on a file that grew a second side effect elsewhere. Reverting the check fails exactly one test. With a defect planted, check-behaviour runs 108 green and check-figures fails in its own slot. Mine, introduced by R-307. R-309. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
bd9b3bdd27
commit
d0db7954bc
@@ -7791,3 +7791,47 @@ rounds"* fails, the ratchet trips, **the cited-figure-with-duplicate case is now
|
||||
the clean tree is silent.
|
||||
|
||||
**State:** 21 guards, one merged reader, CLEAN GROUND v0.24.
|
||||
|
||||
---
|
||||
|
||||
## R-309 — a guard that stopped another guard from running
|
||||
|
||||
**The fold exported `scanDocument` so the readers could be tested on strings, and for two
|
||||
commits importing it ran the whole guard.** `check-behaviour` imports that module. So:
|
||||
|
||||
```
|
||||
$ # with the historical 24 restored
|
||||
$ node tools/check-behaviour.mjs
|
||||
check-figures: FAILED — measured figures are printed with nothing holding them
|
||||
docs/scenarios/CLEAN_GROUND.md:1277 — "**24**" carries no citation marker …
|
||||
exit=1
|
||||
```
|
||||
|
||||
**A figure defect called `process.exit(1)` inside check-behaviour, which reported another
|
||||
guard's failure under its own name having run zero of its 108 tests.** The build still went
|
||||
red, which is the only reason this was survivable — but it went red in the wrong place, and
|
||||
every behavioural test in the repo was silently not running while appearing to.
|
||||
|
||||
**This is the sharpest form yet of the fault this log keeps recording.** R-300 found a check
|
||||
that passed for a reason unrelated to what it claimed. This is a check that *did not run at
|
||||
all* and could not say so, because the thing that stopped it was a different guard's verdict
|
||||
arriving through an import. A guard is a claim we are still checking; this one had quietly
|
||||
stopped being checked, and the evidence that it had was indistinguishable from a failure.
|
||||
|
||||
**Fixed with the idiom already in `step5-split.mjs`** — the executable body sits behind
|
||||
`import.meta.main || process.argv[1]?.endsWith(...)`, so importing the module yields the four
|
||||
readers and nothing else.
|
||||
|
||||
**The test is a spawn, not a source assertion.** The property is *importing has no effect*,
|
||||
and only a fresh process can tell you that; asserting the source contains the idiom would
|
||||
pass on a file that had grown a second side effect elsewhere. Importing must print nothing
|
||||
and exit 0.
|
||||
|
||||
**Proved both ways.** Reverting the guard to `if (true)` fails exactly one test — the new one.
|
||||
With a figure defect planted, `check-behaviour` now runs all 108 tests green and
|
||||
`check-figures` fails in its own slot with its own message.
|
||||
|
||||
**It arrived with the fold and it is mine.** It exists because R-307 needed an export for the
|
||||
string tests, and it was found because those same tests print their own name — the second
|
||||
time in one evening that the string tests paid for themselves in a way nobody designed. The
|
||||
general rule for this repo: **a module a guard imports must not be a guard that runs.**
|
||||
|
||||
Reference in New Issue
Block a user