Requirement Traceability Validation
Target: $ARGUMENTS
Validate the full requirement hierarchy by reconciling the requirements source with code docstring tags.
References (MUST READ)
Read these before proceeding:
references/requirement-tagging.md—@requirement/@parent/@testspec, reconciliation algorithm
Workflow
Grep all C files for
@requirement,@parent, and@testtags → build tag inventoryRead requirements source —
docs/requirements.md, CSV, or SQL dumpValidate 3-level hierarchy:
- Every SW-REQ has a
@parentPRD-REQ - Every PRD-REQ traces to a SYS-REQ
- No broken parent links
- Every SW-REQ has a
Generate findings report with categories:
- Unimplemented: SW-REQ in database but no
@requirementtag in code - Orphaned code:
@requirementtag in code but no matching DB entry - Broken parents:
@parentreferences a non-existent PRD-REQ - Untested: SW-REQ without matching
@testtag - Dead code candidates: Functions without any requirement tag
- Unimplemented: SW-REQ in database but no
Output coverage matrix:
| Requirement | Code File:Line | Test ID | Status | |-------------|---------------|---------|--------| | SW-REQ-001 | src/emv.c:42 | TEST-001| OK | | SW-REQ-002 | — | — | MISSING|
Output Format
# Traceability Report
## Summary
- Total SW-REQ: N
- Implemented: N (N%)
- Tested: N (N%)
- Orphaned code tags: N
- Broken parent links: N
## Unimplemented Requirements
...
## Orphaned Code
...
## Coverage Matrix
...
Rules
- Scan all
*.cand*.hfiles, not justsrc/ - Report findings — do not auto-fix requirement files
- Include file path and line number for every code finding
- Sort coverage matrix by requirement ID