fix(2129): exclude 999.x backlog phases from next-phase and all_complete (#2135)
* test(2129): add failing tests for 999.x backlog phase exclusion Bug A: phase complete reports 999.1 as next phase instead of 3 Bug B: init manager returns all_complete:false when only 999.x is incomplete Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(2129): exclude 999.x backlog phases from next-phase scan and all_complete check In cmdPhaseComplete, backlog phases (999.x) on disk were picked as the next phase when intervening milestone phases had no directory yet. Now the filesystem scan skips any directory whose phase number starts with 999. In cmdInitManager, all_complete compared completed count against the full phase list including 999.x stubs, making it impossible to reach true when backlog items existed. Now the check uses only non-backlog phases. Closes #2129 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -531,4 +531,46 @@ describe('init manager', () => {
|
||||
|
||||
assert.strictEqual(output.response_language, undefined);
|
||||
});
|
||||
|
||||
test('all_complete is true when non-backlog phases are complete and 999.x exists (#2129)', () => {
|
||||
writeState(tmpDir);
|
||||
writeRoadmap(tmpDir, [
|
||||
{ number: '1', name: 'Setup', complete: true },
|
||||
{ number: '2', name: 'Core', complete: true },
|
||||
{ number: '3', name: 'Polish', complete: true },
|
||||
{ number: '999.1', name: 'Backlog idea' },
|
||||
]);
|
||||
|
||||
// Scaffold completed phases on disk
|
||||
scaffoldPhase(tmpDir, 1, { slug: 'setup', plans: 2, summaries: 2 });
|
||||
scaffoldPhase(tmpDir, 2, { slug: 'core', plans: 1, summaries: 1 });
|
||||
scaffoldPhase(tmpDir, 3, { slug: 'polish', plans: 1, summaries: 1 });
|
||||
|
||||
const result = runGsdTools('init manager', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
assert.strictEqual(output.all_complete, true, 'all_complete should be true when only 999.x phases remain incomplete');
|
||||
});
|
||||
|
||||
test('all_complete false with incomplete non-backlog phase still produces recommended_actions (#2129)', () => {
|
||||
writeState(tmpDir);
|
||||
writeRoadmap(tmpDir, [
|
||||
{ number: '1', name: 'Setup', complete: true },
|
||||
{ number: '2', name: 'Core', complete: true },
|
||||
{ number: '3', name: 'Polish' },
|
||||
{ number: '999.1', name: 'Backlog idea' },
|
||||
]);
|
||||
|
||||
scaffoldPhase(tmpDir, 1, { slug: 'setup', plans: 1, summaries: 1 });
|
||||
scaffoldPhase(tmpDir, 2, { slug: 'core', plans: 1, summaries: 1 });
|
||||
// Phase 3 has no directory — should trigger discuss recommendation
|
||||
|
||||
const result = runGsdTools('init manager', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
assert.strictEqual(output.all_complete, false, 'all_complete should be false with phase 3 incomplete');
|
||||
assert.ok(output.recommended_actions.length > 0, 'recommended_actions should not be empty when non-backlog phases remain');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user