fix(#2836): audit-open quick SUMMARY filename + UAT terminal-status drift (#2847)

* fix(#2836): audit-open quick SUMMARY filename + UAT terminal-status drift

Fixes two convention drifts in bin/lib/audit.cjs that produced false-positive
"open" items at every milestone close:

1. scanQuickTasks: looked for bare `SUMMARY.md`, but workflows/quick.md
   mandates `${quick_id}-SUMMARY.md`. Now matches either filename so quick
   tasks created via the documented workflow are recognized.

2. scanUatGaps: only treated `status: complete` as terminal, but
   workflows/execute-phase.md uses `status: resolved` post-gap-closure.
   Now treats both `complete` and `resolved` as terminal, with `result:
   all_pass` as a fallback when status is absent.

Also reconciles workflows/help.md one-liner that referenced bare
`SUMMARY.md` so docs match the authoritative quick.md workflow.

Adds tests/bug-2836-audit-open-summary-uat-drift.test.cjs with 6
structural regression tests covering both fixes plus no-regression cases.

* refactor(#2836): hoist TERMINAL_UAT_STATUSES outside scanUatGaps loop

Address CodeRabbit nitpick: the Set was being recreated on each UAT file
iteration. Hoist to module scope so it is constructed once.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-04-29 08:00:17 -04:00
committed by GitHub
parent 12b6ba4e34
commit 74b81379cf
3 changed files with 211 additions and 4 deletions

View File

@@ -105,12 +105,27 @@ function scanQuickTasks(planDir) {
continue;
}
const summaryPath = path.join(safeTaskDir, 'SUMMARY.md');
// workflows/quick.md mandates `${quick_id}-SUMMARY.md`; older flows used
// bare `SUMMARY.md`. Accept either to avoid false-positive "missing".
let summaryPath = null;
try {
const summaryFiles = fs.readdirSync(safeTaskDir, { withFileTypes: true })
.filter(e => e.isFile() && (e.name === 'SUMMARY.md' || e.name.endsWith('-SUMMARY.md')));
if (summaryFiles.length > 0) {
// Prefer the per-task `${quick_id}-SUMMARY.md` form when present.
const preferred = summaryFiles.find(e => e.name === `${dirName}-SUMMARY.md`)
|| summaryFiles.find(e => e.name.endsWith('-SUMMARY.md'))
|| summaryFiles[0];
summaryPath = path.join(safeTaskDir, preferred.name);
}
} catch {
// fall through with summaryPath = null → status: missing
}
let status = 'missing';
let description = '';
if (fs.existsSync(summaryPath)) {
if (summaryPath && fs.existsSync(summaryPath)) {
let safeSum;
try {
safeSum = requireSafePath(summaryPath, planDir, 'quick task summary', { allowAbsolute: true });
@@ -344,6 +359,11 @@ function scanSeeds(planDir) {
return results;
}
// Terminal UAT states: `complete` (legacy) and `resolved` (post-gap-closure
// per workflows/execute-phase.md). Hoisted outside scanUatGaps so the Set is
// not recreated on each loop iteration.
const TERMINAL_UAT_STATUSES = new Set(['complete', 'resolved']);
/**
* Scan .planning/phases for UAT gaps (UAT files with status != 'complete').
*/
@@ -394,8 +414,12 @@ function scanUatGaps(planDir) {
const fm = extractFrontmatter(content);
const status = (fm.status || 'unknown').toLowerCase();
const result = (fm.result || '').toString().toLowerCase();
if (status === 'complete') continue;
// Also accept `result: all_pass` as a fallback when status is absent
// — covers UATs that omit `status:`.
if (TERMINAL_UAT_STATUSES.has(status)) continue;
if (status === 'unknown' && result === 'all_pass') continue;
// Count open scenarios
const pendingMatches = (content.match(/result:\s*(?:pending|\[pending\])/gi) || []).length;

View File

@@ -153,7 +153,7 @@ Granular flags are composable: `--discuss --research --validate` gives the same
Usage: `/gsd-quick`
Usage: `/gsd-quick --full`
Usage: `/gsd-quick --research --validate`
Result: Creates `.planning/quick/NNN-slug/PLAN.md`, `.planning/quick/NNN-slug/SUMMARY.md`
Result: Creates `.planning/quick/NNN-slug/PLAN.md`, `.planning/quick/NNN-slug/NNN-slug-SUMMARY.md`
---