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]);