fix: add verification gate before writing PROJECT.md in new-milestone

After gathering milestone goals and determining version, the workflow
now presents a summary and asks for confirmation before writing any
files. Users can adjust until satisfied, preventing the previous
behavior where GSD would immediately write PROJECT.md without verifying
its understanding of the milestone scope.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-03-20 22:07:57 -04:00
parent 3f133fe3bc
commit 802092d8ff
2 changed files with 77 additions and 0 deletions

View File

@@ -703,6 +703,51 @@ describe('requirements mark-complete command', () => {
});
});
// ─────────────────────────────────────────────────────────────────────────────
// new-milestone workflow verification gate (#1269)
// ─────────────────────────────────────────────────────────────────────────────
describe('new-milestone workflow verification gate', () => {
test('new-milestone workflow has verification step before writing PROJECT.md', () => {
const workflowPath = path.join(__dirname, '..', 'get-shit-done', 'workflows', 'new-milestone.md');
const content = fs.readFileSync(workflowPath, 'utf8');
// Must have a verification step between goal gathering and PROJECT.md writing
assert.ok(
content.includes('Verify Milestone Understanding'),
'workflow must have a "Verify Milestone Understanding" step'
);
// Verification must come before Step 4 (Update PROJECT.md)
const verifyIdx = content.indexOf('Verify Milestone Understanding');
const updateIdx = content.indexOf('## 4. Update PROJECT.md');
assert.ok(verifyIdx > 0, 'verification step must exist');
assert.ok(updateIdx > 0, 'Update PROJECT.md step must exist');
assert.ok(
verifyIdx < updateIdx,
'verification step must appear before Update PROJECT.md step'
);
});
test('verification step uses AskUserQuestion with adjust loop', () => {
const workflowPath = path.join(__dirname, '..', 'get-shit-done', 'workflows', 'new-milestone.md');
const content = fs.readFileSync(workflowPath, 'utf8');
// Extract the section between 3.5 and 4
const sectionStart = content.indexOf('## 3.5');
const sectionEnd = content.indexOf('## 4.');
const section = content.slice(sectionStart, sectionEnd);
assert.ok(section.includes('AskUserQuestion'), 'verification must use AskUserQuestion');
assert.ok(section.includes('Adjust'), 'verification must offer Adjust option');
assert.ok(section.includes('Looks good'), 'verification must offer Looks good option');
assert.ok(
section.includes('Loop until') || section.includes('loop until') || section.includes('re-present'),
'verification must loop until user approves'
);
});
});
// ─────────────────────────────────────────────────────────────────────────────
// validate consistency command
// ─────────────────────────────────────────────────────────────────────────────