feat(hir-def): retain component EMV2 subclause in the item-tree (REQ-EMV2-PROPAGATION-002, L2/4)#314
Merged
Merged
Conversation
Rivet verification gate✅ 20/20 passed
Filter: Failed artifacts(none) Updated automatically by |
…EMV2-PROPAGATION-002) Layer 2 of 4 for the EMV2 annex→instance foundation (#294). A component's `annex EMV2 {** … **}` subclause was dropped at item-tree lowering (lower_component_type/impl had no ANNEX_SUBCLAUSE arm). This lifts it via the L1 Emv2Model and retains it: - New `Emv2Subclause { name, model: Emv2Model }` stored in an `emv2_subclauses` arena on ItemTree, referenced from `ComponentTypeItem.emv2` / `ComponentImplItem.emv2` (Vec<Idx>, the idiomatic nested-item slot — the owning classifier IS the item, so L3 looks it up by name). - `lower_emv2_subclauses` walks the component's ANNEX_SUBCLAUSE children (they REPEAT per AS-5506B, so filter not find), recovers the body via the existing `spar_annex::extract_annex_content`, and reuses L1 (`emv2::parse` → `Emv2Model::from_syntax`). Non-EMV2 annex languages stay dropped (case-insensitive name filter). - spar-hir-def gains a spar-annex dep (already beneath it via spar-base-db — no cycle); Emv2Model's Debug/Clone/PartialEq/Eq matches the item structs' derives, so no mirror types and no salsa Hash/Update needed. - The new required field is threaded through EVERY workspace producer of these HIR structs: spar-hir-def (AADL lowering + test fixtures), spar-sysml2 (SysML2→HIR lowering), spar-transform (WIT/wac/wrpc/rust-crate generators), and spar-analysis test fixtures — all `emv2: Vec::new()` (no EMV2 annex). Oracle-first, NON-CIRCULAR (3 tests, spar-hir-def): parse real AADL → item-tree → assert the lowered model EQUALS L1 parsing the same snippet directly (never a hand-built struct). (a) a system TYPE retains one subclause whose model equals the oracle (2 propagations + 3 flows — non-vacuous); (b) a system IMPLEMENTATION retains it on its own list; (c) EMV2 + a non-EMV2 annex retains exactly the EMV2 one (guards the filter). Uses the verbatim OSATE-corpus block L1 pins. Stops at the item-tree level — no instantiation (that is L3). Verified workspace-wide: `cargo test --workspace --all-targets --no-run` + `cargo clippy --workspace --all-targets` clean; spar-hir-def 464 + 3 tests pass; fmt clean; mutation on lower_emv2_subclauses 0-missed. Clean-room GO. TEST-EMV2-ITEMTREE-ATTACH verifies REQ-EMV2-PROPAGATION-002 (umbrella stays proposed until L4's end-to-end oracle). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
bcd70b3 to
6a8419b
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
What
Layer 2 of 4 of the EMV2 annex→instance foundation (#294). A component's
annex EMV2 {** … **}subclause was dropped at item-tree lowering (lower_component_type/implhad noANNEX_SUBCLAUSEhandling — the empty arm atlower.rs:169is the package-section one). This retains it:Emv2Subclause { name, model: Emv2Model }stored in anemv2_subclausesarena onItemTree, referenced fromComponentTypeItem.emv2/ComponentImplItem.emv2(Vec<Idx>— the idiomatic nested-item slot; the owning classifier is the item, so L3 looks it up by name).lower_emv2_subclauseswalks the component'sANNEX_SUBCLAUSEchildren (they repeat per AS-5506B → filter, not find), recovers the body via the existingspar_annex::extract_annex_content, and reuses L1 (emv2::parse→Emv2Model::from_syntax). Non-EMV2 annex languages stay dropped (case-insensitive name filter).spar-hir-defgains aspar-annexdep — already beneath it viaspar-base-db, so acyclic;Emv2Model'sDebug/Clone/PartialEq/Eqmatches the item structs' derives, so no mirror types and no salsaHash/Updateneeded.Scope
Stops at the item-tree/type level. Does not touch instantiation — the diff to
instance.rs/resolver.rsis purely mechanicalemv2: Vec::new()additions to hand-built test fixtures. Projecting the retained model ontoComponentInstances is Layer 3; building theEmv2Overlay+ wiringspar analyze(the end-to-end ">0 chains" oracle) is Layer 4.Verification
cargo test -p spar-hir-def→ 464 + 3 pass; clippy + fmt clean.lower_emv2_subclauses: 0 missed (3 caught, 1 unviable).TEST-EMV2-ITEMTREE-ATTACHverifiesREQ-EMV2-PROPAGATION-002(umbrella staysproposeduntil L4's end-to-end oracle).🤖 Generated with Claude Code