fix(#1588): ignore fenced and backlog roadmap phases (#1845)

* fix(#1588): ignore fenced and backlog roadmap phases

* chore(#1588): add changeset fragment

* chore(#1588): fix changeset body

* test(#1588): fold init regression into init suite
This commit is contained in:
Tom Boucher
2026-06-30 20:43:25 -04:00
committed by GitHub
parent 8161fcc667
commit 9e32462dd8
6 changed files with 159 additions and 46 deletions

View File

@@ -8,6 +8,7 @@ const fs = require('fs');
const path = require('path');
const { runGsdTools, cleanup } = require('./helpers.cjs');
const { createFixture, seedPhase } = require('./fixtures/index.cjs');
const { createTempProject } = require('./helpers.cjs');
describe('init commands', () => {
let tmpDir;
@@ -426,6 +427,66 @@ describe('init commands', () => {
assert.strictEqual(output.phase_req_ids, 'REQ-02, REQ-03');
});
test('init plan-phase prefers real phase details outside fenced examples and ignores backlog sentinels (#1588)', () => {
const projectDir = createTempProject('init-1588-');
try {
fs.writeFileSync(
path.join(projectDir, '.planning', 'STATE.md'),
[
'---',
'gsd_state_version: 1.0',
'milestone: v1.1',
'status: planning',
'---',
'',
].join('\n')
);
fs.writeFileSync(
path.join(projectDir, '.planning', 'ROADMAP.md'),
[
'# Roadmap',
'',
'<details open>',
'<summary>v1.1 Current (Phases 8-9) - PLANNED</summary>',
'',
'- [ ] **Phase 9: Real Phase**',
'',
'</details>',
'',
'## Phase Details',
'',
'```markdown',
'### Phase 9: Fenced Example Phase',
'**Goal:** This example must not be treated as roadmap structure.',
'```',
'',
'### Phase 9: Real Phase',
'**Goal:** Use the real phase details outside the fenced block.',
'**Requirements:** REAL-01',
'',
'## Backlog',
'',
'### Phase 999.1: Backlog Thing',
'**Goal:** Future backlog item.',
'',
].join('\n')
);
const phase9 = runGsdTools('init plan-phase 9', projectDir);
assert.ok(phase9.success, `init plan-phase 9 failed: ${phase9.error}`);
const phase9Output = JSON.parse(phase9.output);
assert.equal(phase9Output.phase_name, 'Real Phase');
assert.equal(phase9Output.phase_req_ids, 'REAL-01');
const backlog = runGsdTools('init plan-phase 999.1', projectDir);
assert.ok(backlog.success, `init plan-phase 999.1 failed: ${backlog.error}`);
const backlogOutput = JSON.parse(backlog.output);
assert.equal(backlogOutput.phase_found, false);
} finally {
cleanup(projectDir);
}
});
test('init phase-op resolves a details-summary milestone phase from later flat Phase Details', () => {
fs.writeFileSync(path.join(tmpDir, '.planning', 'STATE.md'), [
'milestone: v1.11',