* test(#3225): sentinel phase dirs no longer trigger W007 / consistency warnings / gaps The W006/W007 (validate health) and the parallel consistency disk↔roadmap and gap-numbering loops never got the isSentinelPhaseId guard that phase.cts has (#2786/#2949), so every sentinel phase dir (999.x/0.x — never-on-roadmap by convention) produced a spurious W007 and a spurious 'Gap in phase numbering: N → 999'. Add failing-first regressions for both surfaces + the gap check, each with a non-sentinel orphan negative-space guard. RED — fails on next; fix follows. * fix(#3225): guard W006/W007 + consistency + gap loops with isSentinelPhaseId cmdValidateHealth's W006/W007 loops, cmdValidateConsistency's parallel disk↔ roadmap loops, AND its gap-numbering check never got the isSentinelPhaseId guard that phase.cts has at 10+ sites (#2786/#2949). So any repo using the sentinel-id convention (999.x backlog/interim, 0.x drafts) got a permanent spurious W007 and a spurious 'Gap in phase numbering: N → 999', with advice to add-to-roadmap (violates the convention) or delete (destroys archived work). Add isSentinelPhaseId to the phaseIdMod destructure and skip sentinel ids in: W006 + W007 (cmdValidateHealth); the two plain-warning disk↔roadmap loops and the gap-numbering integerPhases filter (cmdValidateConsistency — same bug family, folded in inline per no-silent-defer). Additive only: non-sentinel orphans and real numbering gaps still warn. The gap-numbering guard was surfaced by the isolated review (a 999-interim dir would otherwise create a false 'N → 999' gap). Same family as #3167 (since fixed). * chore(#3225): add changeset fragment * chore(#3225): backfill changeset PR number (#3371) --------- Co-authored-by: sim <sim@local>
This commit is contained in:
@@ -46,7 +46,7 @@ import configLoaderMod = require('./config-loader.cjs');
|
||||
const { loadConfig, CONFIG_DEFAULTS } = configLoaderMod;
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
import phaseIdMod = require('./phase-id.cjs');
|
||||
const { normalizePhaseName, phaseTokenMatches, escapeRegex, getMilestoneFromPhaseId, OPTIONAL_PHASE_TAG_SOURCE, PHASE_NUMBER_TOKEN_SOURCE, extractPhaseToken, comparePhaseNum } = phaseIdMod;
|
||||
const { normalizePhaseName, phaseTokenMatches, escapeRegex, getMilestoneFromPhaseId, OPTIONAL_PHASE_TAG_SOURCE, PHASE_NUMBER_TOKEN_SOURCE, extractPhaseToken, comparePhaseNum, isSentinelPhaseId } = phaseIdMod;
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
import phaseLocatorMod = require('./phase-locator.cjs');
|
||||
const { findPhaseInternal } = phaseLocatorMod;
|
||||
@@ -1442,12 +1442,17 @@ function cmdValidateConsistency(cwd: string, raw: boolean): void {
|
||||
const diskPhases = collectDiskPhases(planBase);
|
||||
|
||||
for (const p of roadmapPhases) {
|
||||
// #3225: sentinel phase ids are never-on-roadmap by convention.
|
||||
if (isSentinelPhaseId(p)) continue;
|
||||
if (!diskPhases.has(p) && !diskPhases.has(normalizePhaseName(p))) {
|
||||
warnings.push(`Phase ${p} in ROADMAP.md but no directory on disk`);
|
||||
}
|
||||
}
|
||||
|
||||
for (const p of diskPhases) {
|
||||
// #3225: a sentinel dir on disk (999-interim, 0-drafts) is defined as
|
||||
// never-on-roadmap; it must not warn here (same guard as cmdValidateHealth).
|
||||
if (isSentinelPhaseId(p)) continue;
|
||||
const variants = phaseVariants(p);
|
||||
if (![...variants].some((v) => fullRoadmapPhaseVariants.has(v))) {
|
||||
warnings.push(`Phase ${p} exists on disk but not in ROADMAP.md`);
|
||||
@@ -1457,7 +1462,10 @@ function cmdValidateConsistency(cwd: string, raw: boolean): void {
|
||||
const config = loadConfig(cwd);
|
||||
if (config.phase_naming !== 'custom') {
|
||||
const integerPhases = [...diskPhases]
|
||||
.filter((p) => !p.includes('.'))
|
||||
// #3225: exclude sentinel phase ids (999.x/0.x) — they are never part of the
|
||||
// sequential numbering, so a 999-interim dir must not produce a spurious
|
||||
// "Gap in phase numbering: N → 999".
|
||||
.filter((p) => !p.includes('.') && !isSentinelPhaseId(p))
|
||||
.map((p) => parseInt(p, 10))
|
||||
.sort((a, b) => a - b);
|
||||
|
||||
@@ -1990,6 +1998,9 @@ function cmdValidateHealth(
|
||||
const notStartedPhases = buildNotStartedPhaseVariants(roadmapContent);
|
||||
|
||||
for (const p of roadmapPhases) {
|
||||
// #3225: sentinel phase ids (999.x/0.x) are never-on-roadmap by convention;
|
||||
// a sentinel heading shouldn't demand a directory.
|
||||
if (isSentinelPhaseId(p)) continue;
|
||||
const variants = phaseVariants(p);
|
||||
const existsOnDisk = [...variants].some((v) => diskPhases.has(v));
|
||||
if (!existsOnDisk) {
|
||||
@@ -2005,6 +2016,11 @@ function cmdValidateHealth(
|
||||
}
|
||||
|
||||
for (const p of activeDiskPhases) {
|
||||
// #3225: a sentinel dir on disk (999-interim, 0-drafts) is defined as
|
||||
// never-on-roadmap; it must not trigger W007 ("Add to roadmap or remove
|
||||
// directory" — both wrong for a sentinel). Mirrors the isSentinelPhaseId
|
||||
// guard phase.cts has at 10+ sites (#2786/#2949).
|
||||
if (isSentinelPhaseId(p)) continue;
|
||||
const variants = phaseVariants(p);
|
||||
if (![...variants].some((v) => fullRoadmapPhaseVariants.has(v))) {
|
||||
addIssue(
|
||||
|
||||
Reference in New Issue
Block a user