dispatch-gates: declare check:route-envelope's wide population, admit exact-file hints - #17048
Merged
os-trump merged 1 commit intoSep 9, 2026
Merged
Conversation
check:route-envelope's real population is an AST-content filter over every non-test .ts file under packages/ (does it write a Hono/Express JSON response?), not a filename convention -- no glob spells it short of the whole subtree. bare-root-worklist.mjs's own CENSUS_REFUSE_WIDE ledger had already measured and recorded this verdict (37.4% of tracked packages/ files, REFUSE-WIDE) but the gate's own source never acted on it, so a brand-new response-writing module matched none of its 30 declared MODULES hints and fell into dispatch-gates' Silent bucket -- the weakest verdict, excluded from the runnable union -- instead of the "Declared WIDE population" bucket a reader is explicitly told not to read as clearance. Adding the wide-population marker as-is was refused: widePopulationRefusal treated ANY named hint as a contradiction, but all 10 gates that carry the marker today have zero hints, so deleting check:route-envelope's 30 MODULES keys to fit was the wrong trade -- it would turn a precise MATCHED lead on every already-known route module into an undifferentiated wide-population one. placeFamily's own runtime placement already handles hints coexisting with a wide-population marker correctly (matched stays matched; everything else promotes out of Silent); only the validation-only widePopulationRefusal was stricter than the mechanism it guards. Refined widePopulationRefusal: an exact-file hint (matched only by equality, per hintCovers' own plain branch) never contradicts "no glob places this" -- it is an enumerated member, not a population claim. A hint that reaches beyond itself (a bare directory, or a glob) is compatible only when the marker's own reason text names it, the same "the reason is what a reader trusts" bar wholeTreePopulationRefusal already holds a repo-root walk to. check:route-envelope's one such hint, DISPATCHER_DOMAIN_DIR, is a second, independently audited surface named in the reason for exactly that reason. A glob is never exempt this way, named or not. No change to placeFamily's existing runtime behaviour and no change to check:route-envelope's own audited behaviour -- same files error, same files pass. New self-test coverage for every branch of the refined predicate. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012zTkyNHJ7TkuN2oXtP5x37
This was referenced Sep 9, 2026
os-trump
marked this pull request as ready for review
September 9, 2026 05:58
os-trump
enabled auto-merge
September 9, 2026 05:58
os-trump
deleted the
claude/issue-16828-declare-whole-tree-walk-populations
branch
September 9, 2026 06:26
This was referenced Sep 9, 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 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 #16828
Which side the fix belongs to, and the reading that decided it
The gate, via the
wide-populationchannel — not aROOT_DIR_WATCH_HINTSsubtree literal, and not the deriver's placement logic.check:route-envelope's real population (discover()+discoverResponseWriters()) is an AST-content filter over every non-test.tsfile underpackages/— does it write a Hono/Express JSON response? — not a filename convention, so no glob spells it short of the whole subtree.scripts/pm/bare-root-worklist.mjs's ownCENSUS_REFUSE_WIDEledger had already measured and recorded this exact verdict:check:route-envelope packages,REFUSE-WIDE, 2181/5837 trackedpackages/files opened (37.4%, base2aa8456cf) — the same width trade ascheck:authz-resolver(39%). Re-measured fresh on HEAD: 2403/6491 non-test.tsfiles underpackages/(37.0%), corroborating it. The ledger recorded the verdict; the gate's own source never acted on it.A wrinkle the ledger didn't anticipate, found by trying it:
widePopulationRefusalrefused ANY named hint, andcheck:route-envelopehas 30 (theMODULEStable's own keys) that must stay — deleting them to fit the marker would turn a precisematchedlead on every already-known route module into an undifferentiatedwide-populationone, a real precision loss. All 10 gates that carry the marker today have zero hints, so this case was untested.placeFamily's own runtime logic already does the right thing with hints + a wide-population marker (matched stays matched; everything else is promoted out of Silent) — only the validation-onlywidePopulationRefusalwas stricter than the mechanism it guards. Refined it (see Files below).Files
scripts/check-route-envelope.mjs— onedispatch-gates: wide-population --marker, citing the measured population fraction and the ledger row.scripts/pm/dispatch-gates.mjs—widePopulationRefusalrefined via a newwidePopulationHintCompatiblehelper: an exact-file hint (matched only by equality) never contradicts the marker; a hint that reaches beyond itself (a directory, or a glob) is compatible only when the marker's own reason text names it (check:route-envelope's one such hint,DISPATCHER_DOMAIN_DIR, is a second, independently-audited surface named in the reason for exactly that reason); a glob is never exempt this way, named or not. New self-test coverage for every branch. No change toplaceFamily's existing runtime behaviour and no change tocheck:route-envelope's own audited behaviour — same files error, same files pass.Positive control (#16730 situation) — predicted before running, then measured
Predicted: a brand-new response-writing module outside
MODULESshowsSilentin--residuebefore the fix,Declared WIDE populationafter — and an existing declared module staysmatchedeither way (no precision lost).Measured,
node scripts/pm/dispatch-gates.mjs --residue packages/plugins/plugin-auth/src/some-brand-new-notification-endpoint.ts(a synthetic new file, not the originallist-user-invitations-verification.ts, which is now itself an already-declaredMODULESmember and no longer reproduces the bug):git stash):Declared WIDE population — 10 famil(ies);Silent (…): 188 famil(ies), andcheck:route-envelopeprints under Silent, byte-identical to the card's own quoted symptom (names: packages/services/service-storage/src/storage-routes.ts, …).Declared WIDE population — 11 famil(ies);Silent (…): 187 famil(ies), andcheck:route-envelopeprints under Declared WIDE population with the full reason text.--residue packages/services/service-storage/src/storage-routes.ts(an existingMODULESmember) still printscheck:route-envelope … matched via … ⇢ gate source 'packages/services/service-storage/src/storage-routes.ts'after the fix — the precise lead on known modules is unchanged.Restore verified by
git hash-objectequality (761a3b0e5…before mutation = after restore) and an emptygit diffagainst the pre-mutation working tree.The sweep (mandatory per the card)
Two instances individually confirmed (not merely heuristic):
check:route-envelope— fixed here.check:generatedfamily, which wrapscheck:migration-registryinternally — re-verified independently (not just trusted from the card/PRs feat(service-analytics)!: refuse an aggregate a datetime measure's field type cannot carry, and reconcile the storage-form annotations to one measured statement #16778, fix(deps): take the fix for the fifteen OSV advisories blocking every PR #17029):check:generated's own dispatch-gates hints (10) name neitherpackages/spec/src/migrations/registry.tsnor anyentries/path;placeFamilyplaces both a direct edit toregistry.tsand a newentries/filesilent. Root cause read from source:check-generated.ts'sGATEDarray spells that entry'sartifactfield as prose ('src/migrations/registry.ts — its generated regions, from src/migrations/entries/'), which failsextractWatchHints's path-shaped admission regex outright — a formatting gap, not a width one, and precisely spellable (nowide-populationmarker needed). Filed as dispatch-gates: check:generated's hints never name the migration-registry artifact it wraps, so the family reads Silent on the diffs that regenerate it #17049 — different file, different package's gate pipeline, doesn't meet this card's bounded in-place-fix bar (④: not the same gate family).A broader heuristic sweep (Silent-bucket family with
hints.length > 0whose own script shows a recursive-readdirSync/scoped-git ls-fileswalk signature) found 12 more distinct scripts (23 rows counting--self-testpairs); 2 already tracked inbare-root-worklist.mjs(check-position-name-fold-loaders,check-whole-set-label-write); the other 10 unlisted anywhere. Reading their headers, most look like uniform invariant scans with no per-file "declared-conformant members" table — a different, already-recognised species (undeclared wide/subtree population), not this card's specific self-concealing-registry shape.check-system-context-census.mjs(30 hints,git ls-files-backed) is the strongest other candidate and was not independently confirmed (no positive control run against it). Filed as #17050 for individual triage.⛔ Per the card's own warning: this sweep only examined the Silent bucket for this one signature. It is not exhaustive, and a heuristic zero for a script that doesn't match the walk signature is not a clearance.
Verification
node scripts/check-route-envelope.mjs --self-test— green (✓ check-route-envelope self-test passed). Unaffected by design: the marker is a comment, no audited-file behaviour changed.node scripts/pm/dispatch-gates.mjs --self-test, run against the original, unfixed source — green, 1580 cases (✓ dispatch-gates self-test: 1580 cases pass.).✗ dispatch-gates self-test: 1 of 1585 case(s) failed(a glob hint is refused even when the reason text repeats it back verbatim). Root cause: my own fixture usedpackages/rest/src/**, which this file'sjudgedAsPatterndoes not treat as a glob (a bare trailing/**collapses to a plain directory prefix,collapseHint's own rule) — confirmed with a direct call before editing further. Fixed by using an actual non-final-segment glob (packages/*/src) for the "never exempt" case and adding a companion case proving a bare trailing/**IS treated like an ordinary directory hint, on purpose.node scripts/pm/dispatch-gates.mjs --self-test, run against this diff (final) — green, 1586 cases (✓ dispatch-gates self-test: 1586 cases pass.,os-verify-lock: VERDICT command-exit 0).node scripts/pm/bare-root-worklist.mjs --self-test(it importswidePopulationRefusal/discoverFamiliesfrom the edited file directly) — green:OK self-test: 78 live row(s) … none stale, none missing, none contradicted (12 row(s) whose gate carries the dispatch-gates wide-population declaration … none of them is covered, so none is excused by it today),os-verify-lock: VERDICT command-exit 0.dispatch-gates.mjs --commands/--ran): derived family count for a diff touching onlyscripts/check-route-envelope.mjs+scripts/pm/dispatch-gates.mjsincludes each script's own identity-matched self-test/production families (both edited files match themselves via the identity key). Both self-tests above are those families' own gates, run directly and green — the reconciliation's "run vs derived" question is answered by construction for this diff (the only two runnable families a change to these two files owes are the two self-tests just run).What this does NOT close
This fixes "the gate was never named" — it does not touch the separate, sharper failure #17041 records: "the gate was named, ran, and could not fail" (a derived, green check whose assertions are too coarse for the actual diff). Being in the
Declared WIDE populationbucket (ormatched) is necessary, not sufficient; #17041 is open and this PR does not close that class.Scope note
⛔ Does not touch a
.github/workflows/*.ymlfile — confirmed,git diff --statshows only the twoscripts/**files. ⛔ Does not widencheck:route-envelope's audited behaviour — same files error, same files pass (MODULES,discover(),discoverResponseWriters(),scanSourceall untouched).scripts/is not a governed surface;scripts/pm/**is this seat's lane per the claim comment. Clause-②: no (no published-package symbol, payload key, orpackages/spec/src/**path touched — confirmed by the file list above).🤖 Generated with Claude Code
https://claude.ai/code/session_012zTkyNHJ7TkuN2oXtP5x37