fix(scripts): measure-self-test-floor recognises a ternary process.exit as a failure producer (#15339) - #15413
Merged
Conversation
…it as a failure producer `classifyFloor` awards ROSTER only when a roster comparison AND a failure production both match. The failure half read five literal spellings, none of which covers `process.exit(cond ? 0 : 1)` -- so a file could carry a complete, working roster floor and still classify NONE. Measured on `scripts/check-regen-pending.mjs` before its verdict was respelled as an explicit branch; the cost is prospective, since nothing on main mis-classifies today. The criterion is now published in two halves, NAMED and TERNARY, so each can be controlled on its own. TERNARY reads a ternary exit whose failing arm is a non-zero literal, in both orders. A bare `process.exit(<expr>)` stays unrecognised on purpose: over a self-test that returned early it is `process.exit(undefined)` -- exit 0, the accident shape this instrument exists to tell apart from a handshake. Six inline controls come with it, run on every invocation like the rest: a roster floor whose only failure production is the ternary reads ROSTER (with a setup control proving the fixture carries no other recognised spelling), the non-1 and inverted arms read ROSTER, a bare opaque exit reads NONE, the same fixture with the roster renamed reads NONE, and the recognised shape is pinned to the dispatch line the ACCIDENT fixture already carries. Census tallies are unchanged: 170 rows, 163 ROSTER / 6 NONE / 1 COUNT, with `--json` byte-identical before and after. No key renamed; additive. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012zGPuVVX3deAx9LdjK8jCk
…omment The ACCIDENT fixture is defined above `runControls`, not below it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012zGPuVVX3deAx9LdjK8jCk
baozhoutao
marked this pull request as ready for review
September 4, 2026 14:51
baozhoutao
enabled auto-merge
September 4, 2026 14:51
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 #15339
classifyFloor()inscripts/measure-self-test-floor.mjsawards ROSTER only when BOTHhalves match: a roster comparison and a failure production. The failure half read five
literal spellings (
failures.push, a literalprocess.exit(1),throw new Error,exitCode = 1,ok(false), none of which covers a ternary exit — an ordinary way tospell a verdict. So a file could carry a complete, working roster floor whose ablations all
fired and still classify NONE.
Nothing on
mainis mis-reported today (the one ternary carrier was respelled as anexplicit branch while the card was being filed), so the cost is prospective: the next
Tier C author who floors a file whose verdict is a ternary exit gets a green ablation
sweep and an instrument that still says NONE.
What changed
The criterion is now published in two halves, so a control can test each on its own:
process.exit(COND ? 0 : 1), the same withany non-zero failing arm (
? 0 : N), and the invertedprocess.exit(COND ? 1 : 0). Afailing arm that is a non-zero literal produces a failure exactly as
process.exit(1)does.
Boundary, deliberate: a bare
process.exit(EXPR)is still not a failure producer,however likely the expression is to be non-zero. That is the accident shape this
instrument exists to tell apart from a handshake — over a self-test that returned early it
is
process.exit(undefined), which is exit 0, nothing produced and nothing noticed. Sourcetext can read a non-zero literal in the failing arm; it cannot read an opaque expression.
Six inline controls come with it — inline, like the rest, so they run on every
invocation and cannot become unrun:
TERNARY_EXIT_GATEcarries none of the NAMED spellings? 0 : 1? 0 : 2? 1 : 0process.exit(EXPR)The last one keeps the criterion pinned to a spelling measured in this tree rather than an
invented one: the ACCIDENT fixture dispatches with exactly this ternary. It could not serve
as the positive fixture itself — it carries
failures.push, so a ROSTER verdict on it wouldnot isolate the ternary — hence the dedicated fixture, written in the existing convention.
Ablation — the recogniser, measured
scripts/check-regen-pending.mjsas it stood at7706a50bd(roster floor present, verdictspelled
process.exit(failures === 0 ? 0 : 1)) checked out into the worktree, bothrecognisers read against the same bytes:
5b2ad1b41)Mutation proven on disk before reading (
git hash-objectmoved off the HEAD blob; oneternary-exit line, zero explicit-branch
process.exit(1)lines). Restore proven after:on-disk hash
9f0342101f5f861eab335d1a304cdca7fdf9ca31equalsHEAD:scripts/check-regen-pending.mjs,git diff HEADempty,git status --porcelainempty. The restore leg ran from atrap ... EXIT INT TERMwith absolute paths.Verification (exit codes captured before any pipe)
Against
9ccd3cdc4:node scripts/measure-self-test-floor.mjs— exit 0, inline controls pass:170 file(s) under scripts/ dispatch on --self-test/6 of 170. Floored: 163 roster, 1 count-candidate(s) to read.Identical before and after the change.
node scripts/measure-self-test-floor.mjs --json— byte-identical before/after(
diffexit 0); tallies 163 ROSTER / 6 NONE / 1 COUNT over 170 rows, as asserted. No keyrenamed; the change is additive.
probeEarlyReturnrun from the base and the patched module over the three handshakespellings in this tree (
scripts/invoked-as.mjs— a reached-verdict flag;scripts/js-comment-mask.mjs—!== SELF_TEST_VERDICT;scripts/check-nul-bytes.mjs—the same inside an
else ifdispatch) returns identical rows, HELD in all six runs.A full
--probesweep is CI's; this is the declared narrowing.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack— 20 commands, every one run) plus the always-runs tail (8) plus whole-repo
pnpm lint:29 of 29 exit 0 at
9d98ef60a, the final commit; the wrapper's own line readsVERDICT command-exit 0 · held the lock 643s. Sample verdicts:✓ dispatch-gates self-test: 1392 cases pass.scope: 233 file(s) under scripts/, 182 carrying --self-test in code (comments masked); 168 of those are run by 30 workflow(s); 164 have their self-test run through the flag, 4 through a recorded route.(check-self-test-wired.mjs)✓ check:declared-population-live — 201 of 252 famil(ies) declare a path population, and every one of them reaches this tree's 7474 tracked file(s).check-nul-bytes: OK (scanned 7467 text file(s) ... no raw ASCII control bytes).OK check-ratchet-remedy-authority: 202 scripts swept ...pnpm lint(eslint . --no-inline-config) printed no findings, exit 0.No changeset: this touches
scripts/**only and publishes nothing from any package, so thePR carries
skip-changeset.🤖 Generated with Claude Code
https://claude.ai/code/session_012zGPuVVX3deAx9LdjK8jCk
Generated by Claude Code