Skip to content

fix(scripts): measure-self-test-floor recognises a ternary process.exit as a failure producer (#15339) - #15413

Merged
baozhoutao merged 2 commits into
mainfrom
claude/issue-15339-produces-failure-ternary
Sep 4, 2026
Merged

fix(scripts): measure-self-test-floor recognises a ternary process.exit as a failure producer (#15339)#15413
baozhoutao merged 2 commits into
mainfrom
claude/issue-15339-produces-failure-ternary

Conversation

@claude

@claude claude Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #15339

classifyFloor() in scripts/measure-self-test-floor.mjs awards ROSTER only when BOTH
halves match: a roster comparison and a failure production. The failure half read five
literal spellings (failures.push, a literal process.exit(1), throw new Error,
exitCode = 1, ok(false), none of which covers a ternary exit — an ordinary way to
spell a verdict. So a file could carry a complete, working roster floor whose ablations all
fired and still classify NONE.

Nothing on main is mis-reported today (the one ternary carrier was respelled as an
explicit 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:

  • NAMED — the five spellings above, unchanged.
  • TERNARY — the exit code is the verdict: process.exit(COND ? 0 : 1), the same with
    any non-zero failing arm (? 0 : N), and the inverted process.exit(COND ? 1 : 0). A
    failing 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. Source
text 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:

control fixture expected
setup TERNARY_EXIT_GATE carries none of the NAMED spellings asserted, so the rows below cannot pass for the wrong reason
positive recall roster floor whose only failure production is ? 0 : 1 ROSTER
arm value same, failing arm ? 0 : 2 ROSTER
inverted arm same, ? 1 : 0 ROSTER
boundary same, dispatch replaced by a bare process.exit(EXPR) NONE
other half same, roster renamed to a name the criterion does not know NONE
reuse pin the ACCIDENT fixture's own dispatch line still matches the TERNARY half asserted

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 would
not isolate the ternary — hence the dedicated fixture, written in the existing convention.

Ablation — the recogniser, measured

scripts/check-regen-pending.mjs as it stood at 7706a50bd (roster floor present, verdict
spelled process.exit(failures === 0 ? 0 : 1)) checked out into the worktree, both
recognisers read against the same bytes:

recogniser that file census tallies over the same 170 rows
base (5b2ad1b41) NONE 162 ROSTER / 7 NONE / 1 COUNT
this PR ROSTER 163 ROSTER / 6 NONE / 1 COUNT

Mutation proven on disk before reading (git hash-object moved off the HEAD blob; one
ternary-exit line, zero explicit-branch process.exit(1) lines). Restore proven after:
on-disk hash 9f0342101f5f861eab335d1a304cdca7fdf9ca31 equals HEAD:scripts/check-regen-pending.mjs,
git diff HEAD empty, git status --porcelain empty. The restore leg ran from a
trap ... EXIT INT TERM with 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 --jsonbyte-identical before/after
    (diff exit 0); tallies 163 ROSTER / 6 NONE / 1 COUNT over 170 rows, as asserted. No key
    renamed; the change is additive.
  • Probe path untouched: the diff's three hunks all sit in Instrument 1 and the controls.
    probeEarlyReturn run from the base and the patched module over the three handshake
    spellings 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 if dispatch) returns identical rows, HELD in all six runs.
    A full --probe sweep is CI's; this is the declared narrowing.
  • Derived gate family (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 reads
    VERDICT 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 the
PR carries skip-changeset.


🤖 Generated with Claude Code

https://claude.ai/code/session_012zGPuVVX3deAx9LdjK8jCk


Generated by Claude Code

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s skip-changeset PR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

measure-self-test-floor: PRODUCES_FAILURE does not recognise a ternary process.exit(cond ? 0 : 1), so a sound roster floor classifies NONE

2 participants