Skip to content

Commit cf4e110

Browse files
committed
test(scripts): dispatch-gates pins that a change under any root the name-fold gate walks derives it
Live-tree cases for both invocations: one probe per declared subtree root, read off the family's own extracted hints, plus the exact path PR #24028 edited; stripping the subtree hints leaves the measured miss NOT MATCHED. Claude-Session: https://claude.ai/code/session_01QBcLjVCmcWbZEk6qhYMib2 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 00c04d5 commit cf4e110

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

‎scripts/pm/dispatch-gates.self-test.mjs‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3851,6 +3851,52 @@ export function selfTest({ tier = 'full' } = {}) {
38513851
);
38523852
}
38533853

3854+
// ── The name-fold loader gate's WALKED roots, declared (#24037) ───────────
3855+
//
3856+
// `check-position-name-fold-loaders.mjs` reads every text file under its
3857+
// roots, and kept them as a private list of bare words, which the extractor
3858+
// admits as nothing. A card editing a file under those roots therefore
3859+
// derived no command for it: PR #24028 reconciled its local union complete
3860+
// and met this gate red in CI, over a line it added to
3861+
// `scripts/cross-package-test-inputs.mjs`. The gate now declares the roots
3862+
// with the ROOT_DIR_WATCH_HINTS idiom and derives its walk from that literal,
3863+
// with no change to the extractor.
3864+
//
3865+
// Pinned against the LIVE tree, for the reason the scripts/** case above
3866+
// states. The probes are read off the family's own extracted hints rather
3867+
// than retyped here, so every root the gate declares gets one, and the first
3868+
// probe is the exact path the measured miss edited. The ablation strips the
3869+
// subtree hints and the verdict must leave MATCHED, so these cases cannot pass
3870+
// through another literal that happens to cover a probe.
3871+
const NAME_FOLD = 'scripts/check-position-name-fold-loaders.mjs';
3872+
const nameFoldFamilies = discoverFamilies().byCheck;
3873+
for (const key of [NAME_FOLD, `${NAME_FOLD} --self-test`]) {
3874+
const entry = nameFoldFamilies.get(key);
3875+
t(`${key} is discovered at all — the pins below mean nothing without this`, Boolean(entry));
3876+
const roots = (entry?.hints ?? []).filter((h) => h.endsWith('/**')).map((h) => h.slice(0, -'/**'.length));
3877+
// The floor: the five roots the walk reads at this commit. A loop over an
3878+
// emptied hint set runs zero cases and prints nothing, which reads as a pass.
3879+
t(`${key} declares at least the five subtree roots its walk reads — read: [${roots.join(', ')}]`, roots.length >= 5);
3880+
const probes = ['scripts/cross-package-test-inputs.mjs', ...roots.map((r) => `${r}/the-one-nobody-has-written-yet.ts`)];
3881+
for (const probe of probes) {
3882+
const verdict = entry ? classifyEntry(entry, [probe]).verdict : null;
3883+
t(`a change to ${probe}, under a root this gate walks, derives ${key} — read: ${verdict}`, verdict === 'matched');
3884+
}
3885+
const undeclared = entry ? { ...entry, hints: entry.hints.filter((h) => !h.endsWith('/**')) } : null;
3886+
const residual = undeclared
3887+
? ['scripts/cross-package-test-inputs.mjs', 'packages/the-one-nobody-has-written-yet/src/index.ts']
3888+
.map((p) => classifyEntry(undeclared, [p]).verdict)
3889+
: [];
3890+
t(
3891+
`…and it is the subtree declaration doing it: strip it and ${key} is NOT MATCHED for the measured miss `
3892+
+ `or a brand-new package file — read: [${residual.join(', ')}]`,
3893+
Boolean(undeclared)
3894+
&& undeclared.hints.length < entry.hints.length
3895+
&& residual.length === 2
3896+
&& residual.every((v) => ['silent', 'undetermined'].includes(v)),
3897+
);
3898+
}
3899+
38543900
// ── The MANIFEST population of check:merge-driver (#15501) ────────────────
38553901
//
38563902
// That family's `git-merge-regen --self-test` refuses a generator with no

0 commit comments

Comments
 (0)