fix(state): parse ROADMAP checklist items with markdown emphasis (#651)#658
fix(state): parse ROADMAP checklist items with markdown emphasis (#651)#658halindrome wants to merge 4 commits into
Conversation
…-labs#651) ROADMAP checklists are frequently authored or edited with markdown emphasis, e.g. "- [ ] **Phase N: Name**". But roadmap_checklist_phase_num_from_line() only matched the plain "- [ ] Phase N:" and bootstrap-link "- [ ] [Phase N:" forms (the in-repo bootstrap-roadmap.sh emits the link form). On any ROADMAP with emphasized checklist items the verifier counted 0 entries, failing roadmap_vs_summaries and state_vs_roadmap and hard-blocking archive via verify-state-consistency.sh --mode archive. Widen the regex from \[?Phase to [*_]*\[?[*_]*Phase so bold/italic emphasis markers around the optional link bracket are tolerated. Applied to both copies (phase-state-utils.sh live + state-updater.sh guarded duplicate) and document the accepted forms in verify-state-consistency.sh. Legacy plain and link forms still parse; non-phase lines still do not match. Adds regression coverage in tests/verify-state-consistency.bats: bold-format roadmap_vs_summaries + state_vs_roadmap integration tests and a unit test of roadmap_checklist_phase_num_from_line across plain/link/bold/italic/bold-link forms plus a negative. Closes swt-labs#651. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Round 1 (clean for merge) flagged two minor items: - Added an explicit --mode archive test on a bold ROADMAP (swt-labs#651's named hard-block path), asserting exit 0 + verdict pass; prior tests covered only --mode advisory. - Corrected the attribution: the in-repo bootstrap-roadmap.sh emits the link form; emphasized ROADMAP checklists are LLM-/hand-authored. Base commit message and test comment updated accordingly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Round 2 found a real residual with the same root cause as swt-labs#651: the checklist counter parsed emphasis but the section-heading counter at verify-state-consistency.sh:916 did not, so a ROADMAP that emphasizes BOTH checklist items and '## Phase N:' headings would fail state_vs_roadmap on a checklist-vs-section count mismatch. Widen the heading grep to '^#{2,3} [*_]*(\[)?[*_]*Phase [0-9]+:' (same emphasis tolerance as the checklist parser). Add regression test asserting state_vs_roadmap passes (and --mode archive exits 0) when both checklist and headings are bold. Heading grep counted bold headings as 0 pre-fix; full suite 3596/0; shellcheck clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Round 3 (fresh, final) is CLEAN FOR MERGE: completeness sweep confirms every ROADMAP-checklist consumer routes through the single centralized parser; the round-2 heading widening is symmetric with no false positives; all 5 new tests are genuine, deterministic guards (fail pre-fix); 104/104 file suite + full suite green; shellcheck and bash -n clean; patterns bash 3.2 portable. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
QA Review — Round 1 (fresh review against base Addressed in |
|
QA Review — Round 2 (fresh review of the round-1 state; one real residual found and fixed in Addressed in |
|
QA Review — Round 3 (fresh final review of the complete change; clean for merge, recorded as an empty Recorded as an empty |
What
Make VBW's state-consistency verifier parse ROADMAP checklist items and
## Phase N:section headings that use markdown bold/italic emphasis (e.g.- [ ] **Phase 1: Setup**), in addition to the existing plain and bootstrap-link forms.Closes #651.
Why
ROADMAP checklists are frequently authored or hand-edited with emphasis (the in-repo
bootstrap-roadmap.shemits the link form, but LLM- and hand-authored ROADMAPs commonly use bold).roadmap_checklist_phase_num_from_line()only matched- [ ] Phase N:and- [ ] [Phase N:, so on any emphasized ROADMAP the verifier counted 0 checklist entries, failingroadmap_vs_summariesandstate_vs_roadmapand hard-blockingverify-state-consistency.sh --mode archive(exit 2) — a persistent, unfixable "state drift" with no workaround.How
scripts/phase-state-utils.sh+ the guarded duplicate inscripts/state-updater.sh): widened the regex\[?Phase→[*_]*\[?[*_]*Phase, tolerating emphasis markers around the optional link bracket. Plain and link forms still parse; non-phase lines still don't match.scripts/verify-state-consistency.sh): widened symmetrically (^#{2,3} [*_]*(\[)?[*_]*Phase [0-9]+:) so a ROADMAP that emphasizes both checklist items and## Phase N:headings doesn't fail on a checklist-vs-section count mismatch (found in QA round 2).tests/verify-state-consistency.bats): 5 new tests — boldroadmap_vs_summaries+state_vs_roadmap, a--mode archivebold test (the exact ROADMAP checklist parser rejects emphasized phase labels (**Phase N:**), permanently blocking archive #651 blocking path), a parser unit test across plain/link/bold/italic/bold-link + a negative, and a both-emphasized reconciliation test. All confirmed to fail against the pre-fix regex.Single centralized parser: every ROADMAP-checklist consumer routes through
roadmap_checklist_phase_num_from_line, so this is a complete fix, not a point patch.Testing
bash testing/run-all.shgreen: 3596 BATS / 0 failed, 51/51 contract, lint 1/1shellcheck -S warningclean on all changed scripts;bash -nclean