fix(sdk): fix executor plan loading, plan ID derivation, and verification outcome parsing
Bug 1: phasePlanIndex derived empty planId for bare PLAN.md files. Fixed to use 'PLAN' as the ID, with matching SUMMARY.md detection. Bug 2: executeSinglePlan passed null to buildPrompt instead of the actual parsed plan. The executor needs the plan content (tasks, objectives) to know what to build. Now loads and parses the plan file before building the prompt. Bug 3: parseVerificationOutcome checked session exit code, not what the verifier wrote. A session that runs without errors but writes status: gaps_found to VERIFICATION.md was treated as 'passed'. Now queries check.verification-status to read the actual VERIFICATION.md frontmatter status field. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,18 @@ vi.mock('./session-runner.js', () => ({
|
||||
runPlanSession: vi.fn(),
|
||||
}));
|
||||
|
||||
// Mock plan-parser to avoid real file I/O in executeSinglePlan
|
||||
vi.mock('./plan-parser.js', () => ({
|
||||
parsePlanFile: vi.fn().mockResolvedValue({
|
||||
frontmatter: { phase: '01-auth', plan: '01', type: 'execute', wave: 1, depends_on: [], files_modified: [], autonomous: true, requirements: [], must_haves: { truths: [], artifacts: [], key_links: [] } },
|
||||
objective: 'Test plan objective',
|
||||
execution_context: [],
|
||||
context_refs: [],
|
||||
tasks: [{ name: 'Test task', type: 'auto', files: [], read_first: [], action: 'do the thing', verify: 'check it', done: 'done', acceptance_criteria: [] }],
|
||||
raw: '',
|
||||
}),
|
||||
}));
|
||||
|
||||
import { runPhaseStepSession } from './session-runner.js';
|
||||
|
||||
const mockRunPhaseStepSession = vi.mocked(runPhaseStepSession);
|
||||
@@ -129,7 +141,10 @@ function makeDeps(overrides: Partial<PhaseRunnerDeps> = {}): PhaseRunnerDeps {
|
||||
initPhaseOp: vi.fn().mockResolvedValue(makePhaseOp()),
|
||||
phaseComplete: vi.fn().mockResolvedValue(undefined),
|
||||
phasePlanIndex: vi.fn().mockResolvedValue(makePlanIndex(1)),
|
||||
exec: vi.fn(),
|
||||
exec: vi.fn().mockImplementation((cmd: string) => {
|
||||
if (cmd === 'check.verification-status') return Promise.resolve({ status: 'pass' });
|
||||
return Promise.resolve(undefined);
|
||||
}),
|
||||
stateLoad: vi.fn(),
|
||||
roadmapAnalyze: vi.fn(),
|
||||
commit: vi.fn(),
|
||||
|
||||
Reference in New Issue
Block a user