fix(req-trace): handle letter-suffix TEST IDs (TEST-NN-002a/b) — closes #183#185
Merged
Merged
Conversation
#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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)
Tests
4 regression tests added in \TestReqTraceLetterSuffixRegression:
CI
835 passed, 0 failed (local)
Co-Authored-By: Oz oz-agent@warp.dev