fix(#3171): init execute-phase emits display name, not directory slug (#3429)

* fix(#3171): init execute-phase emits display name, not directory slug

When a phase directory already exists on disk, the disk-lookup path
(searchPhaseInDir) derived phase_name from the directory-name remainder --
itself an already-slugified value (phase.add writes ${num}-${slug} dirs) --
so phase_name and phase_slug came out byte-identical. The execute-phase
workflow forwards phase_name into 'state begin-phase --name', which wrote
that raw slug into STATE.md's current_phase_name on every phase start.

cmdInitExecutePhase now prefers the ROADMAP's curated display name
('### Phase N: <Name>') for phase_name, matching the no-disk fallback path
that already did this correctly. phase_slug is unchanged (it feeds
branch-name construction). The state.begin-phase authoritativeFm override
(#2821/#2736) is untouched; the correction is in the value fed into --name.

The milestone_name half of #3171 was subsumed by #3216 / PR #3226; this
fixes the remaining current_phase_name half.

* docs(changeset): backfill pr 3429 for #3171

---------

Co-authored-by: sim <sim@local>
This commit is contained in:
Tom Boucher
2026-08-13 23:49:23 -04:00
committed by GitHub
parent 4792bc02f5
commit a3b72d9071
3 changed files with 122 additions and 2 deletions

View File

@@ -910,7 +910,17 @@ function cmdInitExecutePhase(
? toPosixPath(path.join(cwd, phaseInfo['directory'] as string))
: null,
phase_number: phaseInfo?.['phase_number'] || null,
phase_name: phaseInfo?.['phase_name'] || null,
// #3171: prefer the ROADMAP's curated display name for `phase_name`. When
// the phase directory already exists on disk, the disk-lookup path
// (searchPhaseInDir) derives phase_name from the directory-name remainder
// — itself an already-slugified value (`phase.add` writes `${num}-${slug}`
// dirs), so phase_name and phase_slug come out byte-identical. An
// orchestrator wiring this field into `state begin-phase --name` then
// lands a raw slug in STATE.md's current_phase_name. The ROADMAP carries
// the human-curated display name (`### Phase N: <Name>`); prefer it,
// matching the no-disk fallback above. phase_slug stays disk-derived — it
// correctly feeds branch-name construction below and is unchanged here.
phase_name: (roadmapPhase?.['phase_name']) || (phaseInfo?.['phase_name']) || null,
phase_slug: phaseInfo?.['phase_slug'] || null,
phase_req_ids,