fix(gsd): skip doctor directory checks for pending slices (#2446)

Doctor flagged missing_slice_dir and missing_tasks_dir as ERROR for
slices with status "pending" — slices that plan-milestone inserted but
haven't been dispatched yet. These directories are created lazily by
ensurePreconditions() at dispatch time, so their absence is expected.

Preserve the DB status field in the slice mapping and skip directory
checks entirely for pending slices.

Closes #2446

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lex Christopherson 2026-03-24 23:14:47 -06:00
parent b9ff5d5052
commit ed95e70534

View file

@ -470,7 +470,7 @@ export async function runGSDDoctor(basePath: string, options?: { fix?: boolean;
if (!roadmapContent) continue;
// Normalize slices: prefer DB, fall back to parser
type NormSlice = RoadmapSliceEntry;
type NormSlice = RoadmapSliceEntry & { pending?: boolean };
let slices: NormSlice[];
if (isDbAvailable()) {
const dbSlices = getMilestoneSlices(milestoneId);
@ -478,6 +478,7 @@ export async function runGSDDoctor(basePath: string, options?: { fix?: boolean;
id: s.id,
title: s.title,
done: s.status === "complete",
pending: s.status === "pending",
risk: (s.risk || "medium") as RoadmapSliceEntry["risk"],
depends: s.depends,
demo: s.demo,
@ -564,6 +565,9 @@ export async function runGSDDoctor(basePath: string, options?: { fix?: boolean;
const slicePath = resolveSlicePath(basePath, milestoneId, slice.id);
if (!slicePath) {
// Pending slices haven't been planned yet — directories are created
// lazily by ensurePreconditions() at dispatch time. Skip them.
if (slice.pending) continue;
const expectedPath = relSlicePath(basePath, milestoneId, slice.id);
issues.push({
severity: slice.done ? "warning" : "error",
@ -586,6 +590,8 @@ export async function runGSDDoctor(basePath: string, options?: { fix?: boolean;
const tasksDir = resolveTasksDir(basePath, milestoneId, slice.id);
if (!tasksDir) {
// Pending slices haven't been planned yet — tasks/ is created on demand.
if (slice.pending) continue;
issues.push({
severity: slice.done ? "warning" : "error",
code: "missing_tasks_dir",