THE FOLD / GLITCH / RACE CONDITION / THE GUARD, NOT THE TEST
THE GUARD, NOT THE TEST
an invariant that lives in flight
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
The same predicate, written in two places, is two different things. In a test file it runs once, at test time, and reports what it saw then. Moved inside the function it guards, it runs on every call and throws the moment the condition breaks. Identical arithmetic; entirely different lifetime — and the gap between them is every defect that occurs after the suite went green.
LIT verified live over 3,000 trials of each arrangement. When the defect happens inside the tested window both catch it, 3,000 of 3,000 each. When the defect happens after the test has already passed, the test catches 0 of 3,000 — it has finished and reported success — and the guard catches 3,000 of 3,000, because it is still running.
LIT verified live over 3,000 trials of each arrangement. When the defect happens inside the tested window both catch it, 3,000 of 3,000 each. When the defect happens after the test has already passed, the test catches 0 of 3,000 — it has finished and reported success — and the guard catches 3,000 of 3,000, because it is still running.
2 HOW IT WAS WEAVED · AI + HUMAN
David (human) logged the move under REPAIRED: “the invariant became a GUARD. compiles == distinct positions fired is now asserted inside pedal() and throws in flight. it used to live only in a test file, where speculative compilation would have been invisible between runs. proved by forging the counter: caught.” The last four words matter — he attacked his own guard to confirm it was a guard.
AVAN (AI) measured the split and should also name the cost, which the repair note does not. A test runs once and is free thereafter; an invariant asserted in flight is paid for on every single call, forever. That is the trade, and it is why guards live on cheap predicates and tests live on expensive ones. The choice is not “which is better” but “is this predicate cheap enough to afford continuously” — a counter comparison is; re-running a proof is not.
AVAN (AI) measured the split and should also name the cost, which the repair note does not. A test runs once and is free thereafter; an invariant asserted in flight is paid for on every single call, forever. That is the trade, and it is why guards live on cheap predicates and tests live on expensive ones. The choice is not “which is better” but “is this predicate cheap enough to afford continuously” — a counter comparison is; re-running a proof is not.
3 ONE DIMENSION
The same predicate, two lifetimes.
4 TWO DIMENSIONS · INTERACTIVE
Move the defect along the timeline and see who notices.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: a timeline, with the test as a window and the guard as a rail.
AVAN’s addition (the inverse-companion): the forward reading is “assert invariants in flight.” The inverse is that a guard converts a silent wrong answer into a loud stop, which is not always the trade you want. A test failing costs a build; a guard firing costs whatever was running at the time, and a guard on a predicate that is almost always right will eventually take down something important for a case nobody anticipated. Read backwards, choosing a guard is choosing availability against correctness, and the fact that it is the right choice for a compile counter says nothing about whether it is right for anything else.
LIT over 1,500 trials of each arrangement, when the defect happens inside the tested window both catch it at essentially 100%; when the defect happens after the test has already passed the test catches 0 of 1,500 - it has finished and reported success - and the guard catches 1,500 of 1,500 because it is still running
FIG David logged the move under REPAIRED: 'the invariant became a GUARD. compiles == distinct positions fired is now asserted inside pedal() and throws in flight. it used to live only in a test file, where speculative compilation would have been invisible between runs. proved by forging the counter: caught.' The last four words matter - he attacked his own guard to confirm it was one. AVAN measured the split and names the cost the repair note does not: a test runs once and is free thereafter, while an invariant asserted in flight is paid for on EVERY CALL, FOREVER. That is why guards live on cheap predicates and tests on expensive ones.
FIG David logged the move under REPAIRED: 'the invariant became a GUARD. compiles == distinct positions fired is now asserted inside pedal() and throws in flight. it used to live only in a test file, where speculative compilation would have been invisible between runs. proved by forging the counter: caught.' The last four words matter - he attacked his own guard to confirm it was one. AVAN measured the split and names the cost the repair note does not: a test runs once and is free thereafter, while an invariant asserted in flight is paid for on EVERY CALL, FOREVER. That is why guards live on cheap predicates and tests on expensive ones.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of RACE CONDITION · David Lee Wise (ROOT0), with AVAN