Merge pull request #3558 from Tibsfox/fix/zero-slice-roadmap-blocked

fix(gsd): treat zero-slice roadmap as pre-planning in guided flow
This commit is contained in:
Jeremy McSpadden 2026-04-07 07:15:29 -05:00 committed by GitHub
commit 8cbd1b5a83
2 changed files with 32 additions and 1 deletions

View file

@ -1340,7 +1340,19 @@ export async function showSmartEntry(
const roadmapFile = resolveMilestoneFile(basePath, milestoneId, "ROADMAP");
const hasRoadmap = !!(roadmapFile && await loadFile(roadmapFile));
if (!hasRoadmap) {
// A roadmap file with zero parseable slices (placeholder text) should be
// treated the same as no roadmap — offer "Create roadmap" instead of "Go auto"
// which would immediately get stuck in blocked state (#3441).
let roadmapHasSlices = false;
if (hasRoadmap) {
const roadmapContent = await loadFile(roadmapFile!);
if (roadmapContent) {
const parsed = parseRoadmapSlices(roadmapContent);
roadmapHasSlices = parsed.length > 0;
}
}
if (!hasRoadmap || !roadmapHasSlices) {
// No roadmap → discuss or plan
const contextFile = resolveMilestoneFile(basePath, milestoneId, "CONTEXT");
const hasContext = !!(contextFile && await loadFile(contextFile));

View file

@ -0,0 +1,19 @@
/**
* Regression test for #3441: guided flow must treat a roadmap with zero
* parseable slices the same as no roadmap offer "Create roadmap" not "Go auto".
*/
import { test } from "node:test";
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { join } from "node:path";
test("guided-flow checks roadmap slice count before offering auto (#3441)", () => {
const src = readFileSync(
join(import.meta.dirname, "..", "guided-flow.ts"),
"utf-8",
);
assert.ok(
src.includes("roadmapHasSlices") || src.includes("parseRoadmapSlices"),
"Guided flow must parse roadmap for slices before deciding which options to show",
);
});