* fix(#1988): exclude stray non-plan *-SUMMARY.md from phase completion count Stray remediation/gap-closure summaries (30-FIX-CR02-SUMMARY.md, 30-GAPCLOSURE-SUMMARY.md, …) inflated summary_count, and once summary_count >= plan_count the phase silently flipped to Complete even though several plans had no summary. A summary now counts toward completion only if it pairs with a real plan file. - core-utils.cts: new countMatchedSummaries(planFiles, summaryFiles) — layout-agnostic pairing via the PLAN→SUMMARY marker swap (root/nested/bare) plus the <stem>-SUMMARY.md form (bare PLAN.md↔PLAN-SUMMARY.md); the swap is applied to the basename only so a 'plans/' dir prefix isn't corrupted. - plan-scan.cts: scanPhasePlans.summaryCount/.completed use the matched count (summaryFiles array still holds every summary on disk for listing/reading). Fixes roadmap listing, state sync, verification, workstream inventory. - roadmap.cts: cmdRoadmapUpdatePlanProgress uses the matched count. - tests/roadmap.test.cjs: countMatchedSummaries unit tests (root/nested/bare/ stray) + E2E reproducing the exact #1988 report (4 plans, 1 plan summary, 3 strays → 1/4 In Progress, NOT Complete). Closes #1988 * docs(#1988): backfill changeset pr 2016 * test(#1988): strengthen countMatchedSummaries unit tests for mutation coverage Add direct unit tests for the extended (N-PLAN-MM-slug↔N-MM-SUMMARY), bare (PLAN↔SUMMARY, PLAN↔PLAN-SUMMARY), legacy (N-PLAN-NN↔N-PLAN-NN-SUMMARY), and stray-exclusion pairings so every branch of countMatchedSummaries is exercised (Stryker mutation-score coverage). * test(#1988): move countMatchedSummaries unit tests into core-utils.test.cjs The Stryker core-utils shard runs ONLY tests/core-utils.test.cjs (per scripts/mutation-matrix.cjs), so the unit tests for countMatchedSummaries must live there to be mutation-covered (previously in roadmap.test.cjs, the shard never ran them → mutants survived → Stryker gate failed). The E2E #1988 reproduction stays in roadmap.test.cjs. Added an absolute-path case to guard the lastIndexOf('/') >= 0 boundary.
This commit is contained in:
@@ -765,6 +765,55 @@ describe('roadmap update-plan-progress command', () => {
|
||||
assert.strictEqual(output.phases[0].disk_status, 'partial');
|
||||
});
|
||||
|
||||
test('#1988 — stray non-plan *-SUMMARY.md files do not inflate summary_count or flip phase to Complete', () => {
|
||||
fs.writeFileSync(
|
||||
path.join(tmpDir, '.planning', 'ROADMAP.md'),
|
||||
`# Roadmap
|
||||
|
||||
- [ ] **Phase 30: Big** - description
|
||||
|
||||
### Phase 30: Big
|
||||
**Goal:** big goal
|
||||
**Plans:** TBD
|
||||
|
||||
## Progress
|
||||
|
||||
| Phase | Milestone | Plans Complete | Status | Completed |
|
||||
|-------|-----------|----------------|--------|-----------|
|
||||
| 30. Big | v3.0 | 0/4 | Planned | - |
|
||||
`
|
||||
);
|
||||
|
||||
// 4 plans, only 1 has a real summary; plus 3 stray non-plan summaries
|
||||
// (the exact names from the #1988 report: FIX-CR02, FIX-WR02-04, GAPCLOSURE).
|
||||
const p = path.join(tmpDir, '.planning', 'phases', '30-big');
|
||||
fs.mkdirSync(p, { recursive: true });
|
||||
fs.writeFileSync(path.join(p, '30-01-PLAN.md'), '# Plan 1');
|
||||
fs.writeFileSync(path.join(p, '30-02-PLAN.md'), '# Plan 2');
|
||||
fs.writeFileSync(path.join(p, '30-03-PLAN.md'), '# Plan 3');
|
||||
fs.writeFileSync(path.join(p, '30-04-PLAN.md'), '# Plan 4');
|
||||
fs.writeFileSync(path.join(p, '30-01-SUMMARY.md'), '# Summary 1');
|
||||
// Strays — these must NOT count:
|
||||
fs.writeFileSync(path.join(p, '30-FIX-CR02-SUMMARY.md'), '# fix summary');
|
||||
fs.writeFileSync(path.join(p, '30-FIX-WR02-04-SUMMARY.md'), '# fix summary');
|
||||
fs.writeFileSync(path.join(p, '30-GAPCLOSURE-SUMMARY.md'), '# gap closure summary');
|
||||
|
||||
const result = runGsdTools('roadmap update-plan-progress 30', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
assert.strictEqual(output.plan_count, 4, 'plan_count is the 4 real plans');
|
||||
assert.strictEqual(output.summary_count, 1, 'stray summaries must not inflate the count');
|
||||
assert.strictEqual(output.status, 'In Progress', 'must not flip to Complete');
|
||||
assert.strictEqual(output.complete, false, 'must not be complete');
|
||||
|
||||
// The ROADMAP row must NOT show 4/4 Complete.
|
||||
const roadmapContent = fs.readFileSync(path.join(tmpDir, '.planning', 'ROADMAP.md'), 'utf-8');
|
||||
assert.ok(roadmapContent.includes('1/4'), 'roadmap row must show the real 1/4 progress');
|
||||
assert.ok(!/4\/4\s*\|\s*Complete/.test(roadmapContent), 'must not stamp 4/4 Complete');
|
||||
assert.ok(!/\[x\] \*\*Phase 30/.test(roadmapContent), 'phase checkbox must not be checked');
|
||||
});
|
||||
|
||||
test('updates progress and checks checkbox on completion', () => {
|
||||
fs.writeFileSync(
|
||||
path.join(tmpDir, '.planning', 'ROADMAP.md'),
|
||||
|
||||
Reference in New Issue
Block a user