Skip to content

fix: skip requirement metadata in main specs#1178

Open
leno23 wants to merge 1 commit into
Fission-AI:mainfrom
leno23:codex/fix-main-spec-metadata-description
Open

fix: skip requirement metadata in main specs#1178
leno23 wants to merge 1 commit into
Fission-AI:mainfrom
leno23:codex/fix-main-spec-metadata-description

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented Jun 5, 2026

Summary

  • skip metadata lines such as ID and Priority when parsing main spec requirement text
  • add parser coverage for metadata before the normative requirement description

Why

Main specs with structured metadata before the requirement body can currently fail validation because the parser treats the first metadata line as the requirement text and misses the later SHALL/MUST statement.

Fixes #418.

Validation

  • pnpm exec vitest run test/core/parsers/markdown-parser.test.ts

Summary by CodeRabbit

  • Bug Fixes
    • Improved requirement text extraction in the markdown parser to correctly skip metadata fields (such as ID and Priority) when parsing specifications, ensuring accurate requirement descriptions are captured.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 5, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1c87c63a-0638-40fd-a25c-9c1fc32c06fc

📥 Commits

Reviewing files that changed from the base of the PR and between 1b06fdd and a08465d.

📒 Files selected for processing (2)
  • src/core/parsers/markdown-parser.ts
  • test/core/parsers/markdown-parser.test.ts

📝 Walkthrough

Walkthrough

MarkdownParser now detects and skips requirement metadata lines (matching **...**: format) when extracting requirement text, allowing metadata fields to precede description content without corrupting the extracted text value.

Changes

Requirement Text Extraction with Metadata Skipping

Layer / File(s) Summary
Requirement metadata detection and text extraction
src/core/parsers/markdown-parser.ts, test/core/parsers/markdown-parser.test.ts
New isRequirementMetadataLine helper identifies metadata lines by pattern. parseRequirements uses this to skip metadata before selecting the first non-empty line as requirement text. Test verifies metadata fields (e.g., **ID**, **Priority**) are ignored and the actual description is captured.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested Reviewers

  • TabishB

Poem

🐰 Metadata fields no longer trip our feet,
Requirements find their true description neat,
Skip **ID** and **Priority** with care,
Extract the text that's actually there!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR partially addresses the linked issue #418 by implementing metadata-skipping logic in the MarkdownParser, but the requirement specifies changes to validator.ts which were not made. Modify src/core/validation/validator.ts extractRequirementText() method to skip metadata lines using the same pattern /^\\[^*]+\\:/ to fully resolve issue #418.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: skipping requirement metadata when parsing spec requirements, which directly addresses the core issue.
Out of Scope Changes check ✅ Passed All changes are directly related to skipping requirement metadata during parsing, which aligns with the PR objectives and issue requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@leno23 leno23 marked this pull request as ready for review June 5, 2026 10:04
@leno23 leno23 requested a review from TabishB as a code owner June 5, 2026 10:04
Copy link
Copy Markdown
Collaborator

@alfred-openspec alfred-openspec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. I checked the parser and validation paths directly: main spec validation gets requirement text from MarkdownParser.parseRequirements(), while delta validation already has its own metadata-skipping extractor, so this is the right layer for #418. Focused parser and validation tests pass locally: pnpm exec vitest run test/core/parsers/markdown-parser.test.ts test/core/validation.test.ts.

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.

[BUG] Requirement Validation Fails When Metadata Fields Precede Description

2 participants