Skip to content

Commit 565db3e

Browse files
committed
fix(scripts): withdraw the wholesale-root hints refused by bare-root-worklist (#15341)
`scripts/pm/bare-root-worklist.mjs` carries the recorded, measured triage for exactly this class, and its `--self-test` reds on a declaration that contradicts a recorded refusal. Eleven of the sixteen gates the card names are refused there by name: REFUSE-WIDE where the bare root is TRUE of the walk and refused for width, REFUSE-UNSPELLABLE where the population is a file-kind filter no subtree glob can spell. Two of those rows quote percentages for the exact spellings this branch had declared. Those eleven declarations are withdrawn and their gates left as they were. What stays is the half neither map refuses: two enumerated FILE populations at 100% precision, three families whose CI invocation is a fixture-only self-test and which now say so, and check:org-identifier, whose ROOT_WALK_RESIDUE_LEDGER row names this declaration as its remedy. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012zGPuVVX3deAx9LdjK8jCk
1 parent 75bdf7d commit 565db3e

11 files changed

Lines changed: 12 additions & 478 deletions

scripts/check-declaration-mirrors.mjs

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -118,26 +118,6 @@ const HERE = dirname(fileURLToPath(import.meta.url));
118118
const REPO_ROOT = resolve(HERE, '..');
119119
const SCRIPTS_DIR = join(REPO_ROOT, 'scripts');
120120

121-
/**
122-
* The population this gate walks, declared for `scripts/pm/dispatch-gates.mjs`.
123-
*
124-
* `mirrorFiles()` walks `SCRIPTS_DIR` for every `*.d.mts` and opens the `.mjs`
125-
* beside each one — one subtree, `scripts/`. The walk root is assembled with
126-
* `join()`, so the derivation, which reads SOURCE TEXT, saw a bare word and no
127-
* path at all: both of this gate's CI invocations (the scan and its
128-
* `--self-test`) were scored `undetermined` for EVERY card, absent from every
129-
* dispatch brief and every `--commands` harvest, while CI ran them on each pull
130-
* request. `hintCovers` refuses a bare single-segment literal by design, so the
131-
* subtree spelling is the escape the idiom exists to be.
132-
*
133-
* ⛔ Not a whole-tree marker: `scripts/**` is a subtree, and this gate reads
134-
* nothing outside it.
135-
*
136-
* The self-test holds the declaration against the live walk rather than against
137-
* a second spelling of the root, so a moved corpus reds here.
138-
*/
139-
const ROOT_DIR_WATCH_HINTS = ['scripts/**'];
140-
141121
/**
142122
* The export spellings this parser recognises, in the words a declaration
143123
* author would write them. Published for the same reason the cross-package
@@ -623,24 +603,6 @@ async function selfTest() {
623603
mirrorFiles().every((f) => f.endsWith('.d.mts')),
624604
);
625605

626-
// ── the dispatch-gates population declaration ──
627-
ok(
628-
'the declared population is the subtree spelling of the walked root — a bare `scripts` literal is '
629-
+ 'refused by hintCovers as too generic, which is how this gate came to declare nothing at all',
630-
ROOT_DIR_WATCH_HINTS.length === 1 && ROOT_DIR_WATCH_HINTS[0] === 'scripts/**',
631-
);
632-
ok(
633-
'and the live walk agrees with it — every discovered mirror sits under the declared root, so a '
634-
+ 'moved corpus reds here instead of quietly re-emptying the declaration',
635-
mirrorFiles().every((f) => relative(REPO_ROOT, f).split(sep).join('/')
636-
.startsWith(`${ROOT_DIR_WATCH_HINTS[0].replace(/\/\*+$/, '')}/`)),
637-
);
638-
ok(
639-
'the declared form is NOT the bare walk root — the glob form would send the walk at a directory '
640-
+ 'the tree does not have',
641-
!ROOT_DIR_WATCH_HINTS.includes(relative(REPO_ROOT, SCRIPTS_DIR).split(sep).join('/')),
642-
);
643-
644606
// ── The floor: every declared battery RAN, and ran its cases (#13489) ────
645607
//
646608
// Evaluated after every battery has had its chance and BEFORE the verdict, so

scripts/check-init-service-contract.mjs

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,11 @@ const SELF_TEST_BATTERIES = Object.freeze({
121121
'17. Every exemption is decided by WHEN the call runs, not by which accessor': 1,
122122
'18. `--list` and the problem text must quote the accessor actually called.': 1,
123123
'19. Nothing outside the vocabulary is invented: a lookup-shaped call on a': 1,
124-
'20. The dispatch-gates population declaration.': 4,
125124
});
126125

127126
// DELETING an entry silences that battery's floor exactly as effectively as
128127
// zeroing it, so the roster's own size is pinned too.
129-
const SELF_TEST_BATTERY_FLOOR = 20;
128+
const SELF_TEST_BATTERY_FLOOR = 19;
130129

131130
// The key an assertion is filed under when no battery is open. It is not a
132131
// declared battery, so it reds by the same set difference rather than silently
@@ -135,27 +134,6 @@ const UNATTRIBUTED_BATTERY = '(no battery open)';
135134

136135
const ROOT = join(fileURLToPath(new URL('.', import.meta.url)), '..');
137136

138-
/** The trees this gate walks. Plugin units live under `packages/`. */
139-
const SCAN_ROOTS = ['packages'];
140-
141-
/**
142-
* The population this gate walks, declared for `scripts/pm/dispatch-gates.mjs`.
143-
*
144-
* The walk root used to be an inline `'packages'` argument. The derivation reads
145-
* SOURCE TEXT and `hintCovers` refuses a bare single-segment literal by design
146-
* (admitting them was priced at +139084 fabricated (gate, file) pairs, because
147-
* `packages` is a path COMPONENT in dozens of gates that never read that root),
148-
* so this gate declared no path at all: scored `undetermined` for EVERY card,
149-
* absent from every dispatch brief and every `--commands` harvest, while CI ran
150-
* it on each pull request. The subtree spelling is the escape the idiom exists
151-
* to be, and `SCAN_ROOTS` is the constant it is held against — the walk now
152-
* reads the same constant, so a moved read reds in this file's own self-test.
153-
*
154-
* ⛔ Not a whole-tree marker: `packages/**` is a subtree, and a whole-tree row
155-
* appears on every card in the repo whether or not the gate reads the file.
156-
*/
157-
const ROOT_DIR_WATCH_HINTS = ['packages/**'];
158-
159137
const DECLARATION_FIELDS = ['dependencies', 'optionalDependencies', 'requiresServices', 'providesServices'];
160138

161139
// ── Discovery ────────────────────────────────────────────────────────────────
@@ -174,7 +152,7 @@ function discoverFiles() {
174152
out.push(relative(ROOT, full).split(sep).join('/'));
175153
}
176154
};
177-
for (const root of SCAN_ROOTS) walk(join(ROOT, root));
155+
walk(join(ROOT, 'packages'));
178156
return out.sort();
179157
}
180158

@@ -946,30 +924,6 @@ function selfTest() {
946924
assert(problems.length === 0, 'hasService is not in the vocabulary (not plugin-reachable in packages/core)');
947925
}
948926

949-
// 20. The dispatch-gates population declaration.
950-
battery('20. The dispatch-gates population declaration.');
951-
assert(
952-
SCAN_ROOTS.filter((r) => !r.includes('/')).every((r) => ROOT_DIR_WATCH_HINTS.includes(`${r}/**`)),
953-
'every separator-less SCAN_ROOT is declared in the subtree spelling — a bare root is refused as '
954-
+ 'too generic, so without the glob the hint extractor reads nothing and this gate goes back to '
955-
+ 'scoring `undetermined` for every card',
956-
);
957-
assert(
958-
ROOT_DIR_WATCH_HINTS.every((h) => SCAN_ROOTS.includes(h.replace(/\/\*+$/, ''))),
959-
'no root is declared that this gate does not walk — a declaration that has drifted from the scan '
960-
+ 'replaces a silent gate with a lying one',
961-
);
962-
assert(
963-
!SCAN_ROOTS.some((r) => ROOT_DIR_WATCH_HINTS.includes(r)),
964-
'the declared form is NOT a SCAN_ROOTS entry — the glob form would send the walk at a directory '
965-
+ 'the tree does not have',
966-
);
967-
assert(
968-
discoverFiles().every((f) => ROOT_DIR_WATCH_HINTS.some((h) => f.startsWith(`${h.replace(/\/\*+$/, '')}/`))),
969-
'and the WALK agrees with the declaration on the live tree — this is the half the two assertions '
970-
+ 'above cannot hold, since both read the constant rather than what discoverFiles() returns',
971-
);
972-
973927
// ── The floor: every declared battery RAN, and ran its cases (#13489) ───
974928
//
975929
// Evaluated after every battery has had its chance and BEFORE the verdict, so

scripts/check-live-db-isolation.mjs

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,11 @@ const SELF_TEST_BATTERIES = Object.freeze({
9494
'7. comments are not source -- the reason codeOf exists': 1,
9595
'8. the live-file needle must MATCH a real read and not the cell form': 2,
9696
'9. `use strict` and friends are not live DDL': 1,
97-
'10. the dispatch-gates population declaration': 4,
9897
});
9998

10099
// DELETING an entry silences that battery's floor exactly as effectively as
101100
// zeroing it, so the roster's own size is pinned too.
102-
const SELF_TEST_BATTERY_FLOOR = 10;
101+
const SELF_TEST_BATTERY_FLOOR = 9;
103102

104103
// The key an assertion is filed under when no battery is open. It is not a
105104
// declared battery, so it reds by the same set difference rather than silently
@@ -175,29 +174,6 @@ function batteryFloorFailures() {
175174

176175
const REPO_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
177176
const ROOTS = ['packages', 'apps', 'examples'];
178-
179-
/**
180-
* The population this gate walks, declared for `scripts/pm/dispatch-gates.mjs`.
181-
*
182-
* `ROOTS` is a runtime constant, and the derivation reads SOURCE TEXT: three
183-
* bare top-level words carry no separator, and `hintCovers` refuses a bare
184-
* single-segment literal by design (accepting them was priced at +139084
185-
* fabricated (gate, file) pairs, because `packages`, `apps` and `examples` are
186-
* path COMPONENTS in dozens of gates that never read those roots). So this gate
187-
* declared no path at all and was scored `undetermined` for EVERY card: it
188-
* appeared in no dispatch brief and in no `--commands` harvest, while CI ran it
189-
* on every pull request. The subtree spelling is the escape the idiom exists to
190-
* be — the same claim `ROOTS` makes, written where a text scanner can read it.
191-
*
192-
* ⛔ Not a whole-tree marker: this gate reads three subtrees, and the liveness
193-
* predicate that vouches for a whole-tree declaration is documented as too weak
194-
* to tell a seeded subtree walk apart from a repo-root one.
195-
*
196-
* The self-test derives the coupling from `ROOTS` on both sides rather than
197-
* re-spelling it, so widening or renaming a root cannot leave this declaration
198-
* describing the old population.
199-
*/
200-
const ROOT_DIR_WATCH_HINTS = ['packages/**', 'apps/**', 'examples/**'];
201177
const SKIP_DIRS = new Set(['node_modules', 'dist', '.turbo', 'coverage', '.next', 'build']);
202178

203179
/**
@@ -460,29 +436,6 @@ function selfTest() {
460436
battery('9. `use strict` and friends are not live DDL');
461437
check('does not flag a non-identifier use', violationsIn(`'use strict';`).length === 0);
462438

463-
// 10. the dispatch-gates population declaration
464-
battery('10. the dispatch-gates population declaration');
465-
check(
466-
'every separator-less ROOT is declared in the subtree spelling (a bare root is refused as too '
467-
+ 'generic, so it needs the glob)',
468-
ROOTS.filter((r) => !r.includes('/')).every((r) => ROOT_DIR_WATCH_HINTS.includes(`${r}/**`)),
469-
);
470-
check(
471-
'and it declares no root this gate does not walk — a declaration that can drift from the scan '
472-
+ 'replaces a silent gate with a lying one',
473-
ROOT_DIR_WATCH_HINTS.every((h) => ROOTS.includes(h.replace(/\/\*+$/, ''))),
474-
);
475-
check(
476-
'the declared form is NOT a ROOTS entry — the glob form would send the walk at a directory the '
477-
+ 'tree does not have',
478-
!ROOTS.some((r) => ROOT_DIR_WATCH_HINTS.includes(r)),
479-
);
480-
check(
481-
'the declaration is not empty — an empty hint list reads exactly like the undetermined verdict '
482-
+ 'it exists to leave',
483-
ROOT_DIR_WATCH_HINTS.length === ROOTS.length,
484-
);
485-
486439
// The floor runs BEFORE the verdict below, so a success line can only be
487440
// printed by a run in which every declared battery registered its cases.
488441
for (const message of batteryFloorFailures()) cases.push({ label: message, ok: false });

scripts/check-meta-type-normalized.mjs

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -90,30 +90,6 @@ const ROOT = join(fileURLToPath(new URL('.', import.meta.url)), '..');
9090
/** Directories scanned. Route handlers that read `:type` live here. */
9191
const SCAN_DIRS = [join('packages', 'rest', 'src')];
9292

93-
/**
94-
* The population this gate walks, declared for `scripts/pm/dispatch-gates.mjs`.
95-
*
96-
* `SCAN_DIRS` is assembled with `join()`, one SEGMENT per literal, so the
97-
* derivation — which reads SOURCE TEXT — sees three bare words and no path at
98-
* all. This gate was therefore scored `undetermined` for EVERY card, absent from
99-
* every dispatch brief and every `--commands` harvest, while CI ran it on each
100-
* pull request.
101-
*
102-
* ⚠️ The hint is `packages/rest/src/**`, NOT `packages/**`. The scan is one
103-
* package's source directory; the wider spelling would paste this gate onto
104-
* every card under `packages/`, which is the costlier error — a lead that is
105-
* wrong on thousands of files rather than a gate that is quiet.
106-
*
107-
* ⛔ And not a whole-tree marker for the same reason, one size up.
108-
*
109-
* The self-test derives the coupling from `SCAN_DIRS` on both sides rather than
110-
* re-spelling it, so a moved or widened scan directory cannot leave this
111-
* declaration describing the old population. The POSIX normalisation is
112-
* load-bearing: `join()` yields a platform separator, and the declaration is
113-
* read as text by a scanner that only knows `/`.
114-
*/
115-
const ROOT_DIR_WATCH_HINTS = ['packages/rest/src/**'];
116-
11793
/**
11894
* Blessed raw comparisons: `'<relative-path>::<trimmed source text>'` -> reason.
11995
* Empty by design — see the header.
@@ -242,12 +218,11 @@ const SELF_TEST_VERDICT = 'check-meta-type-normalized self-test reached its verd
242218
// to find what stopped registering.
243219
const SELF_TEST_BATTERIES = Object.freeze({
244220
'check-meta-type-normalized self-test': 4,
245-
'the dispatch-gates population declaration': 3,
246221
});
247222

248223
// DELETING an entry silences that battery's floor exactly as effectively as
249224
// zeroing it, so the roster's own size is pinned too.
250-
const SELF_TEST_BATTERY_FLOOR = 2;
225+
const SELF_TEST_BATTERY_FLOOR = 1;
251226

252227
// The key an assertion is filed under when no battery is open. It is not a
253228
// declared battery, so it reds by the same set difference rather than silently
@@ -320,28 +295,6 @@ function selfTest() {
320295
if (hits.length !== 5) problems.push(`expected 5 findings total, saw ${hits.length} — a pass-through or a comment was flagged`);
321296
});
322297

323-
// ── The dispatch-gates population declaration ────────────────────────
324-
battery('the dispatch-gates population declaration');
325-
const scannedPosix = SCAN_DIRS.map((d) => d.split(sep).join('/'));
326-
check(() => {
327-
if (!scannedPosix.every((d) => ROOT_DIR_WATCH_HINTS.includes(`${d}/**`))) {
328-
problems.push('a SCAN_DIRS entry is not declared in the subtree spelling — the hint extractor '
329-
+ 'reads source text, and a join()-assembled path is invisible to it');
330-
}
331-
});
332-
check(() => {
333-
if (!ROOT_DIR_WATCH_HINTS.every((h) => scannedPosix.includes(h.replace(/\/\*+$/, '')))) {
334-
problems.push('ROOT_DIR_WATCH_HINTS declares a directory this gate does not walk — a declaration '
335-
+ 'that has drifted from the scan replaces a silent gate with a lying one');
336-
}
337-
});
338-
check(() => {
339-
if (ROOT_DIR_WATCH_HINTS.some((h) => !h.startsWith('packages/rest/src'))) {
340-
problems.push('the declaration widened past this gate\'s own package — `packages/**` would paste '
341-
+ 'this gate onto every card under packages/, which is worse than the silence it replaces');
342-
}
343-
});
344-
345298
// ── The floor: every declared battery RAN, and ran its cases (#13489) ────
346299
//
347300
// Evaluated after every battery has had its chance and BEFORE the verdict, so

scripts/check-optional-error-sink-contract.mjs

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -243,27 +243,6 @@ const BASELINE_PATH = join(HERE, 'optional-error-sink-contract.baseline.json');
243243
/** Where the PUBLISHED contracts live. See "Scope" in the header. */
244244
const SCAN_ROOTS = ['packages'];
245245

246-
/**
247-
* The population this gate walks, declared for `scripts/pm/dispatch-gates.mjs`.
248-
*
249-
* `SCAN_ROOTS` is a runtime constant and the derivation reads SOURCE TEXT, so
250-
* the bare word `packages` contributes NOTHING: `hintCovers` refuses a
251-
* single-segment literal by design, because `packages` is a path COMPONENT in
252-
* dozens of gates that never read that root. This gate therefore declared no
253-
* path at all, was scored `undetermined` for EVERY card, and appeared in no
254-
* dispatch brief and no `--commands` harvest while CI ran it on every pull
255-
* request. The subtree spelling is the escape the idiom exists to be.
256-
*
257-
* ⛔ Not a whole-tree marker: `packages/**` is a subtree, and a whole-tree
258-
* declaration would put this gate on every card in the repo on a population it
259-
* does not read.
260-
*
261-
* The self-test derives the coupling from `SCAN_ROOTS` on both sides rather
262-
* than re-spelling it, so a widened or renamed root cannot leave this
263-
* declaration describing the old population.
264-
*/
265-
const ROOT_DIR_WATCH_HINTS = ['packages/**'];
266-
267246
const SKIP_DIRS = new Set([
268247
'node_modules', 'dist', 'build', 'coverage', '.turbo', '.next', '.cache', 'json-schema', '.git',
269248
]);
@@ -847,12 +826,11 @@ let selfTestReachedVerdict = false;
847826
// to find what stopped registering.
848827
const SELF_TEST_BATTERIES = Object.freeze({
849828
'check-optional-error-sink-contract self-test': 66,
850-
'the dispatch-gates population declaration': 4,
851829
});
852830

853831
// DELETING an entry silences that battery's floor exactly as effectively as
854832
// zeroing it, so the roster's own size is pinned too.
855-
const SELF_TEST_BATTERY_FLOOR = 2;
833+
const SELF_TEST_BATTERY_FLOOR = 1;
856834

857835
// The key an assertion is filed under when no battery is open. It is not a
858836
// declared battery, so it reds by the same set difference rather than silently
@@ -1168,36 +1146,6 @@ check(() => {
11681146
}
11691147
}
11701148

1171-
// ── The dispatch-gates population declaration ───────────────────────────
1172-
battery('the dispatch-gates population declaration');
1173-
const declFail = (msg) => { failures++; console.error(` ✗ ${msg}`); };
1174-
check(() => {
1175-
const separatorless = SCAN_ROOTS.filter((r) => !r.includes('/'));
1176-
if (!separatorless.every((r) => ROOT_DIR_WATCH_HINTS.includes(`${r}/**`))) {
1177-
declFail('a separator-less SCAN_ROOT is not declared in the subtree spelling — a bare root is '
1178-
+ 'refused as too generic, so the hint extractor sees nothing and this gate goes back to '
1179-
+ 'scoring `undetermined` for every card.');
1180-
}
1181-
});
1182-
check(() => {
1183-
if (!ROOT_DIR_WATCH_HINTS.every((h) => SCAN_ROOTS.includes(h.replace(/\/\*+$/, '')))) {
1184-
declFail('ROOT_DIR_WATCH_HINTS declares a root this gate does not walk — a declaration that has '
1185-
+ 'drifted from the scan replaces a silent gate with a lying one.');
1186-
}
1187-
});
1188-
check(() => {
1189-
if (SCAN_ROOTS.some((r) => ROOT_DIR_WATCH_HINTS.includes(r))) {
1190-
declFail('the declared form is a SCAN_ROOTS entry — the glob form would send the walk at a '
1191-
+ 'directory the tree does not have.');
1192-
}
1193-
});
1194-
check(() => {
1195-
if (ROOT_DIR_WATCH_HINTS.length !== SCAN_ROOTS.length) {
1196-
declFail('the declaration is not one hint per walked root — an empty or short hint list reads '
1197-
+ 'exactly like the undetermined verdict it exists to leave.');
1198-
}
1199-
});
1200-
12011149
// ── The floor: every declared battery RAN, and ran its cases (#13489) ────
12021150
//
12031151
// Evaluated after every battery has had its chance and BEFORE the verdict, so

0 commit comments

Comments
 (0)