Skip to content

Commit a6876cc

Browse files
committed
fix(pm): dispatch-gates recognises a git grep of the tracked corpus as a repo-root walk
A whole-tree-population declaration is refused unless the gate's source spells a recognised repo-root walk, and `git grep` (which searches the tracked corpus by default) was not one of the spellings, so check:adr-anchors could not declare the scan it really performs. Limb D is appended to REPO_ROOT_WALK_SPELLINGS, held to the execFile shape so the system grep over one named file does not match; limbs 0-2 are unchanged. Claude-Session: https://claude.ai/code/session_01ADHkmT9YphoBfbtPDaBJrs Co-authored-by: Claude <noreply@anthropic.com>
1 parent ea2e12a commit a6876cc

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

‎scripts/check-adr-anchors.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ function collectAnchorLetterCitations(anchorList) {
11851185
return out;
11861186
}
11871187

1188-
// dispatch-gates: whole-tree-population -- collectCitations below runs `git grep --untracked` with no pathspec, so every tracked and every untracked-not-ignored text file is read for an ADR-NNNN citation and a card adding one anywhere implicates this gate; the literals elsewhere in this file name the registry and the two release-owned changelogs its excuse list holds, never this scan's population.
1188+
// dispatch-gates: whole-tree-population -- `collectCitations` runs `git grep --untracked` with no pathspec, so every tracked and every untracked-not-ignored text file is read for an ADR-NNNN citation and a card adding one anywhere implicates this gate; the literals elsewhere in this file name the registry and the two release-owned changelogs its excuse list holds, never this scan's population.
11891189
//
11901190
// Why the marker and not a narrower scan (#34086): the whole-tree read is the
11911191
// third check's whole point (#6634 — a citation nobody resolves rots wherever it

‎scripts/pm/dispatch-gates.mjs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4071,6 +4071,18 @@ export const REPO_ROOT_WALK_SPELLINGS = [
40714071
label: 'a walk whose DEFAULT PARAMETER is the repo-root binding',
40724072
re: /[({,]\s*[A-Za-z_$][\w$]*\s*=\s*(?:REPO_ROOT|REPO_ROOT_DIR|ROOT_DIR)\s*[,)}]/,
40734073
},
4074+
{
4075+
// `git grep` searches the tracked corpus by default — the same population
4076+
// limb A enumerates, read in one call (`check-adr-anchors`'s citation scan,
4077+
// #34086). Held to the execFile shape, `'git'` then an argv array whose
4078+
// element is `'grep'`, because a bare `'grep'` is also the system grep run
4079+
// over one named file (`check-skill-compatibility-version`), which reads
4080+
// no tree. Like every limb this is necessary, not sufficient: a pathspec
4081+
// after the pattern narrows the search, and the declaration's reason is
4082+
// where a reader judges that.
4083+
label: 'a `git grep` search of the tracked corpus',
4084+
re: /['"`]git['"`]\s*,\s*\[[^\]]*?['"`]grep['"`]/,
4085+
},
40744086
];
40754087

40764088
/**

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6871,6 +6871,15 @@ export function selfTest({ tier = 'full' } = {}) {
68716871
repoRootWalkSpelling('export function collectSources(root = REPO_ROOT) { return walk(root); }')
68726872
=== REPO_ROOT_WALK_SPELLINGS[2].label,
68736873
);
6874+
t(
6875+
'limb D reads a git grep of the tracked corpus in the execFile shape (check-adr-anchors)',
6876+
repoRootWalkSpelling("out = execFileSync('git', ['grep', '--untracked', '-IonE', pattern], { cwd: ROOT });")
6877+
=== REPO_ROOT_WALK_SPELLINGS[3].label,
6878+
);
6879+
t(
6880+
'the system grep over one named file is not a walk — limb D needs git as the command (check-skill-compatibility-version)',
6881+
repoRootWalkSpelling("const r = spawnSync('grep', ['-vxF', '-f', listFile, movedFile], { encoding: 'utf8' });") === null,
6882+
);
68746883
// The measured tightening. Written to accept a trailing argument, limb B
68756884
// selected `resolve(REPO_ROOT, maskerPath)` — a path BUILD — and would have
68766885
// vouched for practically any gate holding a REPO_ROOT constant, which is a

0 commit comments

Comments
 (0)