Skip to content

feat(spar-sysml2): add refine/allocate/derive extraction (Phase 1 of #90)#97

Merged
avrabe merged 1 commit intomainfrom
feat/sysml2-extraction-phase1-90
Apr 2, 2026
Merged

feat(spar-sysml2): add refine/allocate/derive extraction (Phase 1 of #90)#97
avrabe merged 1 commit intomainfrom
feat/sysml2-extraction-phase1-90

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Apr 2, 2026

Summary

Phase 1 of #90. Expands the SysML v2 requirements extraction pipeline with three new relationship types:

  • refine X by Y;refines link (grammar existed, extraction was missing)
  • allocate X to Y;allocated-to link (new grammar + extraction)
  • derive X from Y;derives-from link (new grammar + extraction)

Also adds spar extract as a top-level CLI alias for spar sysml2 extract.

Changes

  • syntax_kind.rs — add ALLOCATE_KW, DERIVE_KW, ALLOCATE_REQ, DERIVE_REQ
  • grammar/requirements.rs — add allocate_req(), derive_req() grammar rules
  • grammar/mod.rs, grammar/packages.rs — wire new keywords into dispatchers
  • extract.rs — add refines, allocates, derives to ExtractedRequirement + YAML output
  • main.rs — add spar extract top-level alias

Test plan

  • 8 new extraction tests (refine, allocate, derive: struct + YAML + combined + nested)
  • 175 total spar-sysml2 tests pass, 0 failures
  • Clippy clean, formatted
  • CI passes

🤖 Generated with Claude Code

Expand the SysML v2 requirements extraction pipeline with three new
relationship types:

- `refine X by Y;` → `refines` link (was parsed but never extracted)
- `allocate X to Y;` → `allocated-to` link (new grammar + extraction)
- `derive X from Y;` → `derives-from` link (new grammar + extraction)

Adds ALLOCATE_KW, DERIVE_KW, ALLOCATE_REQ, DERIVE_REQ to the SysML v2
syntax kind enum, grammar rules for both (allocate uses `to`, derive
uses `from`), and wires all three into extract.rs alongside existing
satisfy/verify extraction.

Also adds `spar extract` as a top-level CLI alias for
`spar sysml2 extract`.

8 new tests covering all relationship types individually, combined, and
nested in packages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

❌ Patch coverage is 96.66667% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/spar-sysml2/src/grammar/requirements.rs 83.33% 4 Missing ⚠️
crates/spar-cli/src/main.rs 0.00% 1 Missing ⚠️
crates/spar-sysml2/src/grammar/packages.rs 50.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@avrabe avrabe merged commit 2df21d0 into main Apr 2, 2026
11 checks passed
@avrabe avrabe deleted the feat/sysml2-extraction-phase1-90 branch April 2, 2026 23:47
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.

1 participant