Skip to content

fix(req-trace): handle letter-suffix TEST IDs (TEST-NN-002a/b) — closes #183#185

Merged
tbitcs merged 2 commits into
developfrom
fix/issue-183-req-trace-letter-suffix
May 20, 2026
Merged

fix(req-trace): handle letter-suffix TEST IDs (TEST-NN-002a/b) — closes #183#185
tbitcs merged 2 commits into
developfrom
fix/issue-183-req-trace-letter-suffix

Conversation

@tbitcs
Copy link
Copy Markdown
Contributor

@tbitcs tbitcs commented May 20, 2026

Summary

Closes #183

Root cause

_TEST_ID_PATTERN\ in
equirements.py\ used \\d+\b. The word boundary \\b\ cannot match between a digit and a letter (both are word characters), so headings like ## TEST-NN-002a\ were silently skipped. \current_test\ stayed pointing at the last successfully parsed ID (\TEST-NN-020), causing both \TEST-NN-002a\ and \TEST-NN-002b\ coverage lines to be attributed to it — producing the spurious \TEST-NN-020, TEST-NN-020\ output.

The same truncation bug existed in \sync.py's _FLEX_TEST_ID, causing \parse_tests_md()\ to silently drop letter-suffix test entries from \ estcases.json\ during sync.

Changes

  • **
    equirements.py*: extend _FLEX_TEST\ and _TEST_ID_PATTERN\ to \\d+[a-z]\ to capture letter suffixes
  • **
    equirements.py**: \ race_reqs()\ now prefers .specsmith/testcases.json\ in YAML mode — exact IDs, no regex parsing (mirrors the \preflight\ command behaviour)
  • **\sync.py*: extend _FLEX_TEST_ID\ to \\d+[a-z]\ so \parse_tests_md()\ correctly parses ## TEST-NN-002a\ headings

Tests

4 regression tests added in \TestReqTraceLetterSuffixRegression:

  • Exact reproduction of the original bug (TEST-NN-020 poisoning REQ-NN-002)
  • No duplicate IDs in trace output
  • YAML mode reads \ estcases.json\ directly with correct IDs
  • \parse_tests_md()\ preserves letter suffixes without truncation

CI

835 passed, 0 failed (local)

Co-Authored-By: Oz oz-agent@warp.dev

#183

Root cause: _TEST_ID_PATTERN used \\d+\\b which cannot match when a letter
immediately follows digits (\\b is not a word boundary between \\d and [a-z]).
This caused current_test to remain at the last clean ID (TEST-NN-020), so
both TEST-NN-002a and TEST-NN-002b coverage lines were attributed to it.

Changes:
- requirements.py: extend _FLEX_TEST and _TEST_ID_PATTERN to \\d+[a-z]*
- requirements.py: trace_reqs() prefers .specsmith/testcases.json in YAML
  mode — exact IDs, no regex parsing needed (mirrors preflight behaviour)
- sync.py: extend _FLEX_TEST_ID to \\d+[a-z]* so parse_tests_md() does not
  silently drop letter-suffix headings (## TEST-NN-002a) from testcases.json

4 regression tests added to TestReqTraceLetterSuffixRegression.

Co-Authored-By: Oz <oz-agent@warp.dev>
# follows digits, causing the ID to be silently skipped (#183).
_FLEX_REQ = r"REQ-(?:[A-Z][A-Z0-9_]*-)?\d+"
_FLEX_TEST = r"TEST-(?:[A-Z][A-Z0-9_]*-)?\d+"
_FLEX_TEST = r"TEST-(?:[A-Z][A-Z0-9_]*-)?\d+[a-z]*"
Co-Authored-By: Oz <oz-agent@warp.dev>
@tbitcs tbitcs enabled auto-merge (squash) May 20, 2026 19:22
@tbitcs tbitcs merged commit 2469acc into develop May 20, 2026
17 checks passed
@tbitcs tbitcs deleted the fix/issue-183-req-trace-letter-suffix branch May 20, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants