From 8d636671210959db475f39de06d6f4575dc816e9 Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Mon, 13 Jul 2026 12:52:35 -0400 Subject: [PATCH] fix(#2203): traceability parser matches REQ-IDs in any column (#2234) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(#2203): traceability parser matches REQ-IDs in any column, not just the first The traceability table-row parser required the REQ-ID in the first column (`^| REQ-ID |`). A table that leads with a status column (e.g. `| ☐ | REQ-01 |`) matched zero rows, so phase complete warned every body REQ-ID was missing. Match REQ-IDs in any pipe-delimited cell (drop the ^ anchor). Closes #2203 * docs(#2203): add changeset fragment * docs(#2203): backfill PR number --- .changeset/noble-wasps-greet.md | 5 +++++ src/phase.cts | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changeset/noble-wasps-greet.md diff --git a/.changeset/noble-wasps-greet.md b/.changeset/noble-wasps-greet.md new file mode 100644 index 000000000..c89e3b5ca --- /dev/null +++ b/.changeset/noble-wasps-greet.md @@ -0,0 +1,5 @@ +--- +type: Fixed +pr: 2234 +--- +**`phase complete` no longer false-reports REQ-IDs as missing when the traceability table leads with a status column** — the parser required the REQ-ID in the first column, so a table shaped `| ☐ | REQ-01 | …` matched zero rows and every body REQ-ID was reported missing. It now matches REQ-IDs in any column. (#2203) diff --git a/src/phase.cts b/src/phase.cts index 57f23c655..97dec6580 100644 --- a/src/phase.cts +++ b/src/phase.cts @@ -1672,7 +1672,11 @@ function cmdPhaseComplete(cwd: string, phaseNum: string, raw: boolean): void { ? reqContent.slice(traceabilityHeadingMatch.index) : ''; const tableReqIds = new Set(); - const tableRowPat = /^\|\s*([A-Z][A-Z0-9]*-\d+)\s*\|/gm; + // #2203: match REQ-IDs in any pipe-delimited cell (not just the first + // column) so a traceability table that leads with a status column (e.g. + // | ☐ | REQ-01 | …) is parsed correctly instead of reporting every row + // as missing. + const tableRowPat = /\|\s*([A-Z][A-Z0-9]*-\d+)\s*\|/g; let tableMatch: RegExpExecArray | null; while ((tableMatch = tableRowPat.exec(traceabilitySection)) !== null) { tableReqIds.add(tableMatch[1]);