Skip to content

Commit 7bc190c

Browse files
committed
chore(role-word): judge the walk pin against the trees that must be skipped, not the set itself
The ablation (drop content/docs/protocol-upgrade from SKIP_SUBTREES, pages on disk) left the walk case green: it read the mutated set to decide which pages the walk must not reach, so it could not see the dropped entry. It now judges against SKIP_SUBTREES plus the register's untracked trees under a ROOT, the same union the program-level legs build from. Claude-Session: https://claude.ai/code/session_01VZqqwTj2wsihZEbfT6yyYN Co-authored-by: Claude <noreply@anthropic.com>
1 parent db7c9ea commit 7bc190c

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

‎scripts/check-role-word.mjs‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,13 +1381,19 @@ function selfTest() {
13811381
.filter((e) => e.untracked && e.path.endsWith('/**'))
13821382
.map((e) => e.path.slice(0, -'/**'.length))
13831383
.filter(underRoot);
1384+
// The trees that MUST be skipped: the set, plus the register's untracked trees
1385+
// under a ROOT. Judged against this union and never against SKIP_SUBTREES
1386+
// alone, because a case that reads the set to decide what the set should
1387+
// exclude cannot see an entry dropped from it.
1388+
const skipTrees = [...new Set([...SKIP_SUBTREES, ...untrackedUnderRoots])];
13841389
const skippedReached = walkedRel.filter(
1385-
(f) => [...SKIP_SUBTREES].some((p) => f.startsWith(`${p}/`)),
1390+
(f) => skipTrees.some((p) => f.startsWith(`${p}/`)),
13861391
);
1387-
expect('the walk reaches NO page under ANY SKIP_SUBTREES entry, content/docs/protocol-upgrade/ '
1388-
+ 'included whenever a local docs build has written it. On a fresh checkout that tree is '
1389-
+ 'absent and this case cannot fail for it, which is why the register case below and the '
1390-
+ 'program-level battery exist',
1392+
expect('the walk reaches NO page under any tree that must be skipped (every SKIP_SUBTREES '
1393+
+ 'entry, and every untracked generated tree the register places under a ROOT), '
1394+
+ 'content/docs/protocol-upgrade/ included whenever a local docs build has written it. On a '
1395+
+ 'fresh checkout that tree is absent and this case cannot fail for it, which is why the '
1396+
+ 'register case below and the program-level battery exist',
13911397
skippedReached.length === 0);
13921398
expect('#15061 — every SKIP_SUBTREES entry lies under a configured ROOT and EXISTS, or is an '
13931399
+ 'UNTRACKED generated tree the register declares (written on demand, so absent from a fresh '
@@ -1706,7 +1712,6 @@ function selfTest() {
17061712
const skipSandbox = mkdtempSync(join(tmpdir(), 'check-role-word-skipped-'));
17071713
try {
17081714
const nothingRead = scanClause(ROOTS.map((root) => ({ root, files: 0 })));
1709-
const skipTrees = [...new Set([...SKIP_SUBTREES, ...untrackedUnderRoots])];
17101715
skipTrees.forEach((tree, i) => {
17111716
const buildSkipTree = (leg, pageDir) => {
17121717
const dir = join(skipSandbox, `${i}-${leg}`);
@@ -2370,7 +2375,7 @@ function selfTest() {
23702375
console.log(
23712376
`OK self-test: the walk reaches ${walkedRel.length} markdown file(s) across the roots, `
23722377
+ `${publishedRefs.length} of them published reference pages under skills/, and `
2373-
+ `${skippedReached.length} under the generated subtrees (${[...SKIP_SUBTREES].join(', ')}) — both `
2378+
+ `${skippedReached.length} under the generated subtrees (${skipTrees.join(', ')}) — both `
23742379
+ 'directions pinned from the WALK, never from a typed count, so a skip that empties the '
23752380
+ 'published half and one that swallows the generated half each name themselves. Every '
23762381
+ 'skipped subtree is also held against the register of untracked generator output, and '

0 commit comments

Comments
 (0)