fix(phase): canonicalize plan-summary matching for suffixless summaries

This commit is contained in:
Tom Boucher
2026-05-04 22:51:15 -04:00
parent 42ed7cee8d
commit c7886415c3
5 changed files with 85 additions and 9 deletions

View File

@@ -869,6 +869,16 @@ describe('searchPhaseInDir', () => {
assert.ok(result.incomplete_plans.includes('01-02-PLAN.md'));
});
test('treats prefix summary as complete for descriptive plan filename (#3101)', () => {
const phaseDir = path.join(phasesDir, '01-foundation');
fs.mkdirSync(phaseDir);
fs.writeFileSync(path.join(phaseDir, '01-01-auth-hardening-PLAN.md'), '# Plan 1');
fs.writeFileSync(path.join(phaseDir, '01-01-SUMMARY.md'), '# Summary 1');
const result = searchPhaseInDir(phasesDir, '.planning/phases', '01');
assert.strictEqual(result.incomplete_plans.length, 0);
});
test('detects research and context files', () => {
const phaseDir = path.join(phasesDir, '01-foundation');
fs.mkdirSync(phaseDir);

View File

@@ -462,6 +462,21 @@ objective: API routes
assert.deepStrictEqual(output.incomplete, ['03-02'], 'incomplete list correct');
});
test('phase-plan-index matches descriptive plan with prefix summary (#3101)', () => {
const phaseDir = path.join(tmpDir, '.planning', 'phases', '03-api');
fs.mkdirSync(phaseDir, { recursive: true });
fs.writeFileSync(path.join(phaseDir, '03-01-auth-hardening-PLAN.md'), `---\nwave: 1\n---\n## Task 1`);
fs.writeFileSync(path.join(phaseDir, '03-01-SUMMARY.md'), `# Summary`);
const result = runGsdTools('phase-plan-index 03', tmpDir);
assert.ok(result.success, `Command failed: ${result.error}`);
const output = JSON.parse(result.output);
assert.strictEqual(output.plans[0].has_summary, true, 'descriptive plan should match prefix summary');
assert.deepStrictEqual(output.incomplete, [], 'plan should not be marked incomplete');
});
test('detects checkpoints (autonomous: false)', () => {
const phaseDir = path.join(tmpDir, '.planning', 'phases', '03-api');
fs.mkdirSync(phaseDir, { recursive: true });