diff --git a/scripts/check-init-service-contract.mjs b/scripts/check-init-service-contract.mjs index cfd16b4eca..fe7638a779 100644 --- a/scripts/check-init-service-contract.mjs +++ b/scripts/check-init-service-contract.mjs @@ -974,7 +974,15 @@ function selfTest() { process.exit(1); } - console.log('✓ self-test: 19 cases'); + // The verdict DERIVES its number from `batterySeen` — the very ledger the floor + // above just evaluated — so the printed count and the floor can never disagree. + // What "cases" counts here is BATTERIES that actually ran (the named + // scenarios), not `assert(` call sites: the floor above guarantees + // `batterySeen.size` equals `declaredBatteries.length` by this point, so + // reading it off the runtime ledger rather than the static roster is a + // distinction without a difference — and it is the ledger, not the roster, + // that a stopped-running battery would actually shrink (#16664). + console.log(`✓ self-test: ${batterySeen.size} cases`); return SELF_TEST_VERDICT; } diff --git a/scripts/check-kernel-hook-pairs.mjs b/scripts/check-kernel-hook-pairs.mjs index 9d913a0eb3..316adf4d16 100644 --- a/scripts/check-kernel-hook-pairs.mjs +++ b/scripts/check-kernel-hook-pairs.mjs @@ -557,7 +557,15 @@ function selfTest() { } assert(!floorBreached, floorMessages.join('\n ')); - console.log('✓ self-test: 10 cases'); + // The verdict DERIVES its number from `batterySeen` — the very ledger the + // floor above just evaluated — so the printed count and the floor can never + // disagree. What "cases" counts here is BATTERIES that actually ran (the + // named scenarios), not `check(` call sites: the floor above guarantees + // `batterySeen.size` equals `declaredBatteries.length` by this point, so + // reading it off the runtime ledger rather than the static roster is a + // distinction without a difference — and it is the ledger, not the roster, + // that a stopped-running battery would actually shrink (#16664). + console.log(`✓ self-test: ${batterySeen.size} cases`); return SELF_TEST_VERDICT; } diff --git a/scripts/check-quick-reference-counts.mjs b/scripts/check-quick-reference-counts.mjs index ce2b2de37f..19d42057d3 100644 --- a/scripts/check-quick-reference-counts.mjs +++ b/scripts/check-quick-reference-counts.mjs @@ -925,7 +925,15 @@ function selfTest() { for (const f of failures) console.error(f); process.exit(1); } - console.log('✓ check-quick-reference-counts self-test: 22 cases pass.'); + // The verdict DERIVES its number from `batterySeen` — the very ledger the + // floor above just evaluated — so the printed count and the floor can never + // disagree. What "cases" counts here is BATTERIES that actually ran (the + // named scenarios), not `expect(` call sites: the floor above guarantees + // `batterySeen.size` equals `declaredBatteries.length` by this point, so + // reading it off the runtime ledger rather than the static roster is a + // distinction without a difference — and it is the ledger, not the roster, + // that a stopped-running battery would actually shrink (#16664). + console.log(`✓ check-quick-reference-counts self-test: ${batterySeen.size} cases pass.`); selfTestReachedVerdict = true; } diff --git a/scripts/check-spec-parsed-alias.mjs b/scripts/check-spec-parsed-alias.mjs index 353f8d4fe7..f0943acc4c 100644 --- a/scripts/check-spec-parsed-alias.mjs +++ b/scripts/check-spec-parsed-alias.mjs @@ -558,7 +558,18 @@ export type Iso0 = Assert, z.infer< typeof for (const f of failures) console.error(' - ' + f); process.exit(1); } - console.log('check-spec-parsed-alias --self-test: 18 assertions passed'); + // The verdict DERIVES its number from `batterySeen` — the very ledger the + // floor above just evaluated — so the printed count and the floor can never + // disagree, and a block that stops running shrinks the number instead of + // leaving a transcribed literal standing (#16664). Unlike the other three + // files in this class, this roster holds a SINGLE battery, and what it + // counts is assertions that actually RAN this run (every `check(` call), not + // `check(` call sites in the source — those are two different facts, and + // only the first one is measured here. Summing the whole ledger is exact + // because reaching this line means every battery that registered is a + // declared one — the set difference above reds otherwise. + const assertionsRun = [...batterySeen.values()].reduce((total, count) => total + count, 0); + console.log(`check-spec-parsed-alias --self-test: ${assertionsRun} assertions passed`); return SELF_TEST_VERDICT; }