fix(#2140): scope hasRow to traceability-row shape (review L2)

hasRow keyed on a bare '| ID |' which could match the ID as the first cell of a
non-traceability table elsewhere in REQUIREMENTS.md, suppressing a real
table_unmatched signal. Require a second cell ('| ID | <phase> |') so only a
traceability-row shape counts as a row.
This commit is contained in:
Tom Boucher
2026-07-12 13:57:09 -04:00
parent 32b5262f7b
commit b94f8754fa

View File

@@ -96,7 +96,9 @@ function cmdRequirementsMarkComplete(cwd: string, reqIdsRaw: string[], raw: bool
if (tableHit) reqContent = afterTable;
// Coverage of the traceability surface for this ID (computed after any flip).
const hasRow = new RegExp(`\\|\\s*${reqEscaped}\\s*\\|`, 'i').test(reqContent);
// hasRow keys on the ID + a second cell (`| ID | <phase> |`) so a bare mention
// of the ID in a non-traceability table does not masquerade as a real row.
const hasRow = new RegExp(`\\|\\s*${reqEscaped}\\s*\\|[^|]+\\|`, 'i').test(reqContent);
const doneCheckbox = new RegExp(`-\\s*\\[x\\]\\s*\\*\\*${reqEscaped}\\*\\*`, 'i').test(reqContent);
const doneTable = new RegExp(`\\|\\s*${reqEscaped}\\s*\\|[^|]+\\|\\s*Complete\\s*\\|`, 'i').test(reqContent);