Files
msd-core/.changeset/3493-extract-milestone-generic-heading.md
Tom Boucher 15e9c86ead fix(sdk): extractCurrentMilestone preserves generic Phase Details heading (#3493)
When a roadmap places shared phase-detail bodies under a non-version-prefixed
`## Phase Details` heading AFTER a `### 📋 vX.Y+ (Planned)` sibling in document
order, the entire Phase Details section fell outside the slice returned by
`extractCurrentMilestone`. `gsd-sdk query phase.insert N` then reported
"Phase N not found in ROADMAP.md" even though `### Phase N:` was unambiguously
present.

PR #2455 (closing #2422) added a same-version `continue` branch that already
handles the version-prefixed variant (e.g. `## v2.0 Phase Details`). This fix
extends the same intent to the generic-label variant: after the initial
boundary scan, look for a literal `^#{1,3}\s+Phase\s+Details\b` heading past
`sectionEnd` and, if found, append the Phase Details block (up to the next
real milestone boundary — version-bearing or milestone-emoji-bearing heading —
or EOF) to the returned slice. The intervening planned-milestone content is
skipped so it does not leak into the active-milestone view.

Bounded to a single append so a malformed roadmap can't loop. Only matches the
literal `Phase Details` label (canonical per GSD ROADMAP template); anything
else continues to terminate the slice. Does not regress the v2.0/v2.1+
version-prefixed handling shipped by #2455 (existing `bug-2422` test still
passes).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 07:52:51 -04:00

862 B

type, pr
type pr
Fixed 3493

extractCurrentMilestone preserves generic ## Phase Details heading — When a roadmap placed shared phase-detail bodies under a non-version-prefixed ## Phase Details heading AFTER a ### 📋 vX.Y+ (Planned) sibling, the entire Phase Details section fell outside the returned milestone slice. gsd-sdk query phase.insert N then reported "Phase N not found in ROADMAP.md" even though ### Phase N: was plainly present. PR #2455 (closing #2422) handled the version-prefixed variant (## v2.0 Phase Details) via the same-version continue branch; this fix extends the same intent to the generic-label variant by appending the trailing Phase Details block (up to the next real milestone boundary or EOF) to the active-milestone slice. The intervening planned-milestone content is skipped so it does not leak in. (#3493)