Skip to content

Commit 3185352

Browse files
committed
fix(tooling): derive check-wildcard-fallthrough's self-test case count from its own ledger
The self-test verdict printed a transcribed `17 cases` while the body ran 18 assertions and the battery roster pinned 18 — a number nothing derived and nothing compared. The literal was left wrong deliberately when the floor landed, so that change could prove byte-identical output; correcting it is this change. The line now sums `batterySeen`, the same ledger the floor immediately above evaluates, so the printed number and the floor can no longer disagree and a block that stops running shrinks the count instead of leaving a stale literal standing. What it counts is assertions that RAN, not `assert(` call sites in the source — today both are 18, and the comment says which one is meant. The in-place comment that explained why the literal was knowingly wrong, and the roster's present-tense description of the verdict as transcribed, are both rewritten: left standing next to a derived line they would tell the next reader the opposite of what the file does. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vbw3RPgdtqesx4azk9SbW8
1 parent 0a61db1 commit 3185352

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

scripts/check-wildcard-fallthrough.mjs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,11 @@ const SELF_TEST_VERDICT = 'check-wildcard-fallthrough self-test reached its verd
460460
//
461461
// "no assertion threw" used to be this self-test's ONLY success condition, so
462462
// "every case held" and "the cases never ran" printed the same line — and this
463-
// file's verdict spells a TRANSCRIBED count (`17 cases`), which is evidence, not
464-
// proof: nothing compared it, so a deleted block shrank the real count while the
465-
// literal stayed put. Closed the way PR #13487 validated on check-doc-authoring:
463+
// file's verdict once spelled a TRANSCRIBED count (a literal `17` against a real
464+
// 18), which is evidence, not proof: nothing compared it, so a deleted block
465+
// shrank the real count while the literal stayed put. The verdict now derives
466+
// its number from the ledger this roster floors (#15231). Closed the way PR
467+
// #13487 validated on check-doc-authoring:
466468
// what is pinned is the registered NAMES, not a number, and the floor requires
467469
// the OPENED set to equal the DECLARED set with each battery at or above its own
468470
// count.
@@ -625,13 +627,16 @@ function selfTest() {
625627
process.exit(1);
626628
}
627629

628-
// ⚠️ MEASURED at 18, not 17: this transcribed literal had already drifted one
629-
// below the real count before this floor existed, which is precisely why a
630-
// printed number is evidence and not proof. It is left as-is here so this
631-
// change stays a pure no-op on output; the correction is filed separately, and
632-
// the floor above is what makes the drift harmless — the count can no longer
633-
// shrink in silence.
634-
console.log('✓ self-test: 17 cases');
630+
// The verdict DERIVES its number from `batterySeen` — the very ledger the floor
631+
// above just evaluated — so the printed count and the floor can never disagree,
632+
// and a block that stops running shrinks the number instead of leaving a
633+
// transcribed literal standing (#15231). What it counts is assertions that
634+
// actually RAN this run, not `assert(` call sites in the source: those are two
635+
// different facts, and only the first one is measured here. Summing the whole
636+
// ledger is exact because reaching this line means every battery that
637+
// registered is a declared one — the set difference above reds otherwise.
638+
const casesRun = [...batterySeen.values()].reduce((total, count) => total + count, 0);
639+
console.log(`✓ self-test: ${casesRun} cases`);
635640

636641
return SELF_TEST_VERDICT;
637642
}

0 commit comments

Comments
 (0)