fix(tooling): derive check-wildcard-fallthrough's self-test case count from its own ledger - #16669
Merged
baozhoutao merged 1 commit intoSep 7, 2026
Conversation
…t 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
baozhoutao
marked this pull request as ready for review
September 7, 2026 17:41
baozhoutao
enabled auto-merge
September 7, 2026 17:41
This was referenced Sep 7, 2026
baozhoutao
deleted the
claude/issue-15231-wildcard-selftest-derived-count
branch
September 7, 2026 18:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #15231
The self-test verdict of
scripts/check-wildcard-fallthrough.mjsprinted atranscribed
17 caseswhile the body ran 18 assertions and the battery rosterpinned 18. Nothing derived that number and nothing compared it — the fourth
instance of a class already filed twice (#13963, #13536) and once more in
#16007. Per triage, the route is option 2: derive the count, not correct the
literal.
Before / after
Re-derived on this branch's base, not taken from the card: the literal was at
scripts/check-wildcard-fallthrough.mjs:634, andgrep -c "^\s*assert("overthat file returns 18.
Which number is printed, and why that one
The line now prints assertions that actually RAN this run — the sum of
batterySeen, the same ledger the battery floor immediately above alreadyevaluates. It does not print
assert(call sites in the source.Today both facts are 18, so a reader would otherwise assume whichever one was
not meant. The runtime ledger is the honest choice for a line whose words are
"cases": a call site that never executes is not a case that held, and the whole
reason this class exists is that a printed number must be produced by the run
it describes. It also makes the printed number and the floor structurally
incapable of disagreeing, since they read one ledger.
Summing the whole ledger is exact rather than approximate: reaching the verdict
means the set-difference check above found every battery that registered to be
a declared one, so the sum has no unattributed remainder.
No new floor is introduced.
SELF_TEST_BATTERIESkeeps its existing pinnedvalue of 18 and is untouched — this change does not convert a printed number
into a gate.
Two comments rewritten, deliberately
Both would have become false on landing, standing next to a derived line:
17was knowinglywrong and "left as-is here so this change stays a pure no-op on output" —
that sentence was about the PR that added the floor, not this one;
spelling a transcribed count.
Both now describe what the file does.
Nothing outside the file pinned this stdout
git grep -n "17 cases"at the base returns 10 hits: CHANGELOG prose and testfixtures about unrelated 17-case corpora, plus this file's own two lines. None
is an expectation of this file's output. The instrument was controlled — the
same pattern scoped to the file finds line 634 — so the zero is a real zero.
docs/audits/2026-09-self-test-shape-census.mdnames this script but recordsits failure line, not the success line. This change deliberately moves output,
so it could not have ridden the byte-identical batch that left the literal wrong.
Verification
Positive and negative controls, each mutated on disk (blob hash shown to differ
from the HEAD blob), run, then restored under a trap and proven restored by
hash equality plus an empty
git diff HEAD:✓ self-test: 18 cases(exit 0)✓ self-test: 19 cases(exit 0)✓ self-test: 18 cases(exit 0)registered 17 case(s), below its pinned floor of 18(exit 1)And the same positive control against the pre-change code, to show what the
literal could not do:
origin/main's version of the file plus a deliberatelyadded 19th case still prints
✓ self-test: 17 cases, exit 0.Restore proof for every leg:
git checkout HEAD -- path, thengit hash-object pathequal togit rev-parse HEAD:path(
bf00750b2d11cb8b0af7c4c0216d9c355fca5e4a) andgit diff HEADempty.Gates —
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 31 commands; all 31 were run and all exited 0 (exit code captured before
any pipe), reconciled with
--ran:✓ dispatch-gates --ran: 31 derived famil(ies) accounted for — 31 run, 0 NOT-MEASURED.Repo-wide lint at final HEAD
3185352ffc:pnpm exec eslint . --no-inline-config --format json— 6309 files, 0 errors, 0 warnings, exit 0. No narrowing claimed.Control-character self-scan over the changed file is clean, and
pnpm check:nul-bytesis green.Changeset
skip-changesetapplies and is set on this PR: the diff is one repo-internalgate script under
scripts/, which publishes from no package.Generated by Claude Code