-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Description
The requirement SHALL/MUST validation incorrectly checks metadata fields instead of the requirement description, causing false validation failures on valid requirements.
Steps to Reproduce
- Create a spec file with a requirement that includes metadata fields immediately after the title:
### Requirement: File Serving **ID**: REQ-FILE-001 **Priority**: P1 The system MUST serve static files from the root directory. - Run validation on the spec file
- Observe validation failure despite the requirement containing proper normative keywords (MUST)
Expected Behavior
The validator should:
- Skip metadata field lines (matching pattern
/^\*\*[^*]+\*\*:/) - Check the actual requirement description for
SHALL/MUSTkeywords - Pass validation since the description contains "
MUST"
Actual Behavior
The validator:
- Extracts the first non-empty line after the requirement header
- Returns ID: REQ-FILE-001 as the "requirement text"
- Fails validation because this metadata field doesn't contain
SHALL/MUST - Ignores the actual requirement description
Root Cause
The extractRequirementText() method in src/core/validation/validator.ts collects all lines after the requirement header, joins them, and returns the first non-empty line. It doesn't skip metadata field lines before extracting the normative description.
Impact
- Severity: Medium-High
- Users cannot use metadata fields in requirements without triggering false validation failures
- Blocks adoption of structured requirement metadata
- Valid, well-formed requirements are incorrectly flagged as invalid
- No workaround exists other than removing metadata fields or placing them after the description
Environment
- Affected component:
cli-validate spec - File:
src/core/validation/validator.ts - Method:
extractRequirementText()
coderabbitai
Metadata
Metadata
Assignees
Labels
No labels