Uh oh!
There was an error while loading. Please reload this page.
Census the self-test name anchor's accidental matches and pin their cost - #14284
Merged
Conversation
…n their cost Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WLJQhde67SeTccsmnBVarV
baozhoutao
marked this pull request as ready for review
September 1, 2026 23:45
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Sep 2, 2026
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 freeto 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#13941
Triage fixed the dispatch order into the card and it binds: census first, remedy second — the census result SELECTS the remedy, so no shape was chosen before the population was known. This PR reports the census, then ships what the census selected.
1. Premise re-check, on today's
origin/main#14004 (
81256734) added ~412 lines toscripts/pm/dispatch-gates.mjsafter the card's measurement, so everything below is re-measured rather than recalled. Base of this branch:812567346.The card's reading reproduces, and it understates the surface. When the module masks itself, six spans are blanked, not one:
maskSelfTestsselfTestOnlyCallablesbracedBodyEndvalueDeclEndtopLevelDeclsselfTestControls that make this a reading rather than an artifact:
extractWatchHints(7,884 non-whitespace chars) andisNonPathNamespace(1,992) survive the mask untouched. The card's named controlindexRefusalAccumulatorsno longer exists on this tree."Costs nothing today" still holds, and is now measured rather than asserted: no slash-bearing string literal appears anywhere in the five collision spans (the first one is at L9158, inside the genuine
selfTest), and this file's hint set is identical with and without the collision.2. The census — the ruled first step
209 code-position
SELF_TEST_DECLmatches over the tracked JS/TS corpus (5,659 files). 187 are the bareselfTest. The remaining 22 carry compound names over 21 distinct spellings — the population the card put a floor of 19/18 on. Classified:Genuine self-test batteries — 15 (the anchor working)
packages/lint/scripts/check-doc-formula-expressions.mjsspecSelfTestpackages/lint/scripts/check-doc-formula-expressions.mjsfieldRuleSelfTestscripts/check-comment-mask-corpus.mjsrunSelfTestCasesscripts/check-doc-authoring.mjsselfTestRule3scripts/check-doc-authoring.mjsselfTestPackagesProsescripts/check-durability-degradation-log-level.mjsselfTestReadSeamsscripts/check-platform-checklist.mjsselfTestTrapVocabularyscripts/check-platform-checklist.mjsselfTestProvisioningUsescripts/check-platform-checklist.mjsselfTestUnreferencedRecipesscripts/check-platform-checklist.mjsselfTestMetaCallSpellingscripts/check-platform-checklist.mjsselfTestSourceLineCitationsscripts/check-regen-pending.mjsfixtureSelfTestscripts/check-regen-pending.mjsprePushIsArmedSelfTestscripts/check-regen-pending.mjsdecisionTableSelfTestscripts/check-turbo-task-graph.mjsrunSelfTestAccidental — production code the anchor caught by its name — 7, over 4 files
scripts/check-self-test-wired.mjscarriesSelfTestscripts/check-self-test-workflow-commands.mjsrunSelfTest--self-testscripts/check-step-collectors.mjsselfTestTargetsrun:bodyscripts/check-step-collectors.mjsselfTestDiscoveriesscripts/measure-self-test-floor.mjsselfTestDefsscripts/pm/dispatch-gates.mjsselfTestOnlyCallablesscripts/pm/dispatch-gates.mjsmaskSelfTests⇒ The class has SEVEN members, not one. They cluster because every one of them is a gate that reasons about self-tests: a tool that finds, spawns, counts or masks other scripts' self-tests names its functions after the thing it handles, and a name-based anchor cannot tell "runs a self-test" from "is one".
Cost, measured per declaration
Each of the 22 was neutralised one at a time (the self-test token replaced inside the identifier, word-anchored) and the file's hints re-extracted, refusing unless the anchored-declaration count dropped by exactly one:
fixtureSelfTestdropspackages/spec/spec-changes.json,prePushIsArmedSelfTestdrops.githooks/pre-push— both fixture paths inscripts/check-regen-pending.mjs, both correctly refused by the mask.That asymmetry is load-bearing: "no compound-name match may contribute a hint" is false as a blanket invariant. The invariant holds only over the accidental half, and only a classification can name that half.
3. Remedy — and why both of triage's candidates are refuted by the census
Triage's decision table sent a MULTIPLE-member census to "narrowing
SELF_TEST_DECL, or a self-scan special case — pick with the measurement in hand". The measurement refutes both:runSelfTestis a genuine entry point inscripts/check-turbo-task-graph.mjs(reached only from that file's--self-testguard) and accidental inscripts/check-self-test-workflow-commands.mjs(exported, called from the gate body at line 264). One spelling, both classes. No predicate over the name separates them, so any narrowing that excludes the accidental one also unmasks a real self-test battery and readmits its fixture paths as hints — trading a silence that costs nothing for the fabricated-lead family this masker exists to refuse.⇒ What ships is neither shape. The anchor is unchanged, the mask still blanks all 22, no path is special-cased, and nothing is renamed. What changes is that the seven accidental members' cost is measured on every run instead of asserted in a docblock. Silence was the defect; the remedy is noise on the day it stops being free.
This is deliberately remedy-neutral — it forecloses none of the three shapes if triage still wants one. The fork is reported on the card.
4. What this PR contains
One file,
scripts/pm/dispatch-gates.mjs(+277 / -7):COMPOUND_ANCHOR_LEDGER— the census above as data: 22 rows of file, name, accidental. Keyed by file plus name becauserunSelfTestproves a name-keyed ledger cannot hold both verdicts at once.compoundAnchorDecls(source)— every compound-name anchor match at code positions only (comments masked first, string literals excluded viascanSource, so a fixture that builds a module source cannot enter the census).withoutAnchor(source, name)— the counterfactual rename, word-anchored sorunSelfTestdoes not rewriterunSelfTestCases.maskSelfTestsandselfTestOnlyCallablesare in the anchor's own population, so a rename that "fixes" either has to move the ledger row rather than the problem.SELF_TEST_DECL's docblock corrected — it said the collision was one declaration; it is seven.5. Verification
All at head
169cfb977.pnpm check:pm-dispatch-gates— the module's own battery, run under the shared verify lock:dispatch-gates self-test: 1179 cases pass.,VERDICT command-exit 0(held 676s). The five new cases are in it, all green.Ablation, both directions — mutation proved on disk before each reading, restored against
HEADand proved byte-exact by blob hash afterwards:maskSelfTests— assertion 2 goes red:scripts/pm/dispatch-gates.mjs::maskSelfTests hides ["packages/ablation-only/src"]. This is the card's exact scenario, made loud.function ablationSelfTestNewcomer()toscripts/check-turbo-task-graph.mjs— assertion 1 goes red:unlisted: scripts/check-turbo-task-graph.mjs::ablationSelfTestNewcomer.git hash-objectequals theHEADblob in both cases, zero residue,git status --porcelainempty.Derived families (
node scripts/pm/dispatch-gates.mjs, 15 matched) all green — exit codes captured before any pipe, verdict lines quoted in the terminal report.check-test-completeness.mjsexits 3 = PREREQUISITE NOT MET locally (it grades a saved turbo log CI tees); recorded as NOT MEASURED, not as a red.Changeset route:
skip-changeset. The diff is one file underscripts/pm/**— PM tooling, publishing nothing from any package — which is the label's closed list. Applied on open per the label's read-back discipline.Generated by Claude Code