Files
msd-core/src/health-diagnostic-rules
sim a0c82f2bd8 fix(#3309): W002/W011/W026 state-consistency regressions
gsd-test found three real regressions in the migrated STATE.md checks:

- W002 didn't exempt phase refs whose only directory lives in an
  archived milestone (#3652) — now consults planning-snapshot.cts's
  archivedPhaseTokens field (added alongside this fix, shared with
  W006's identical need).
- W011 (STATE/ROADMAP cross-validation) never fired: currentPhaseLabel
  only read the current template's bare "Phase:" field, silently
  missing legacy STATE.md fixtures that use the older bold
  "**Current Phase:**" field (mirrors state.cts's own resolveStatePhase
  fallback ladder, which the migration didn't carry over).
- W026 (STATE milestone-complete vs. unstarted ROADMAP phases) had two
  independent defects: roadmapDeclaredPhases's milestone attribution
  can't see <details>/<summary>-shaped ROADMAP sections, and current-
  milestone resolution could go null — both silently emptied the
  "unstarted" set every time. Fixed by scoping ROADMAP.md to the
  current milestone via the same <details>-tolerant extractCurrentMilestone
  every other milestone-aware consumer uses, in a new dedicated
  planning-snapshot.cts field (currentMilestoneRoadmapPhaseIds) rather
  than reusing roadmapDeclaredPhases, which exists for a narrower,
  <details>-blind derivation (W021's own original logic) and would
  have regressed it if repurposed.

Also fixes an unrelated drift-guard violation this same rule file
introduced: its own phase-token regex was independently re-derived
instead of built from the canonical PHASE_NUMBER_TOKEN_SOURCE.
2026-08-13 04:30:40 -04:00
..