fix(#2203): traceability parser matches REQ-IDs in any column (#2234)

* 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
This commit is contained in:
Tom Boucher
2026-07-13 12:52:35 -04:00
committed by GitHub
parent 7ccf57200d
commit 8d63667121
2 changed files with 10 additions and 1 deletions

View File

@@ -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)

View File

@@ -1672,7 +1672,11 @@ function cmdPhaseComplete(cwd: string, phaseNum: string, raw: boolean): void {
? reqContent.slice(traceabilityHeadingMatch.index)
: '';
const tableReqIds = new Set<string>();
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]);