fix(#3639): dir-aware sentinel recognition for the disk-side guards (#3698)

* test(#3639): pin bracket sentinel recognition in disk-side guards

* fix(#3639): dir-aware sentinel recognition for the disk-side guards

* chore(#3639): add changeset

* fix(#3639): disclose the digit-continuation residual, join phases-clear, load-bearing over-suppression guard

* test(#3639): match the token form W007 reports

* chore(#3639): backfill changeset pr number

---------

Co-authored-by: sim <sim@local>
This commit is contained in:
Tom Boucher
2026-08-19 21:55:18 -04:00
committed by GitHub
parent 66228a89cf
commit 71e00d426e
7 changed files with 153 additions and 8 deletions

View File

@@ -43,7 +43,7 @@ type Rule = healthDiagnosticMod.Rule;
// eslint-disable-next-line @typescript-eslint/no-require-imports
import phaseIdMod = require('../phase-id.cjs');
const { isSentinelPhaseId } = phaseIdMod;
const { isSentinelPhaseDir } = phaseIdMod;
// ─── C001 — gap in disk phase numbering (integer sequence) ────────────────
// (verify.cts:1504-1519)
@@ -57,8 +57,12 @@ function checkC001(snapshot: PlanningSnapshot): Diagnostic[] {
const integerPhases = snapshot.allPhaseDirNames.value
// #3225: exclude sentinel phase ids (999.x/0.x) — never part of the
// sequential numbering, mirrors verify.cts:1510 verbatim.
.filter((p) => !p.includes('.') && !isSentinelPhaseId(p))
// sequential numbering, mirrors verify.cts:1510 verbatim. The dot filter
// already drops every code-prefixed (bracket) name before the sentinel
// test, so the dir-aware recognizer below is defense-in-depth for the
// dotless legacy forms — kept so this guard cannot regress if the dot
// filter is ever loosened (#3639).
.filter((p) => !p.includes('.') && !isSentinelPhaseDir(p))
.map((p) => parseInt(p, 10))
.filter((n) => !Number.isNaN(n))
.sort((a, b) => a - b);

View File

@@ -113,7 +113,7 @@ const { SCOPE } = planningScopeMod;
// eslint-disable-next-line @typescript-eslint/no-require-imports
import phaseIdMod = require('../phase-id.cjs');
const { matchPhaseDirs, normalizePhaseName, extractPhaseToken, isSentinelPhaseId } = phaseIdMod;
const { matchPhaseDirs, normalizePhaseName, extractPhaseToken, isSentinelPhaseId, isSentinelPhaseDir } = phaseIdMod;
// eslint-disable-next-line @typescript-eslint/no-require-imports
import validateMod = require('../validate.cjs');
@@ -248,8 +248,11 @@ function checkW007(snapshot: PlanningSnapshot): Diagnostic[] {
// `verify.cts:1373-1397`) — same token, relocated read, not reinvented.
const token = extractPhaseToken(dirName);
// #3225: a sentinel dir on disk (999-interim, 0-drafts) is defined as
// never-on-roadmap; it must not trigger W007.
if (isSentinelPhaseId(token)) continue;
// never-on-roadmap; it must not trigger W007. #3639: judged on the DIR
// NAME via the dir-aware recognizer — the extracted token is
// milestone-stripped, so a bracket sentinel (GSD.999-07-icebox) was
// invisible to the id predicate and false-fired as an orphan.
if (isSentinelPhaseDir(dirName)) continue;
if (claimedDirs.has(dirName)) continue;
diagnostics.push({
code: 'W007',