Skip to content

docs: rivet <-> spar variant binding contract v1 (proposed)#144

Merged
avrabe merged 1 commit intomainfrom
docs/rivet-spar-variant-contract-v1
Apr 23, 2026
Merged

docs: rivet <-> spar variant binding contract v1 (proposed)#144
avrabe merged 1 commit intomainfrom
docs/rivet-spar-variant-contract-v1

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Apr 23, 2026

Summary

Proposed interchange contract between rivet (feature-model + variant-config truth) and spar (HIR consumer).

Background

Decided in design discussion (2026-04-23) that spar should not duplicate rivet's PLE machinery. Instead:

  • rivet owns feature model, constraints, variant configs, bindings, SAT solver
  • spar consumes a resolved-variant JSON blob and filters its HIR accordingly
  • AADL/SysML v2 source files stay variant-agnostic — same file compiles in every variant

This avoids parallel feature-parsing code in two tools and matches the Bazel select() pattern (binding lives outside the source).

What the contract defines

  • JSON blob shape rivet emits (rivet_spar_context_version: "1", features, bindings, etc.)
  • Binding resolution semantics — intersection of matching bindings; symbol bindings include textually-nested contents
  • CLI contract — both explicit (rivet resolve | spar check --variant-context -) and implicit (spar check --variant X) forms
  • Rivet CLI surface spar depends on (rivet resolve, rivet variants list)
  • Compatibility rules — v1 stable; v2+ adds fields only; unknown fields must be ignored

Why now

You're reworking rivet to be the generic artifact-to-feature binding layer (Rust/Cargo/AADL/…). Locking a concrete contract now lets both tools implement against it instead of shipping in parallel and meeting in the middle.

Scope

Documentation only. No code changes. The consumer crate spar-variants lands as part of Track B of the v0.7.0 plan once this contract is confirmed.

Open items (non-blocking for v1)

  • Union-semantics bindings — deferred to v2 if needed
  • Per-variant property overrides — deferred to v2

Test plan

  • Human review by someone reworking rivet
  • Semantics align with rivet's current binding design (or rivet's design aligns to this)
  • No changes needed to spar production code for this PR

🤖 Generated with Claude Code

Defines the interchange format and CLI contract between rivet (feature-model +
variant truth) and spar (HIR consumer + analyses).

Key decisions captured:
- rivet owns the entire PLE model; spar does not parse feature/variant files
- AADL/SysML2 source files remain variant-agnostic; binding is external
- Intersection semantics when multiple bindings match one item
- Symbol bindings include textually-nested contents; not inherited via extends
- Explicit form (rivet emits JSON, spar reads via --variant-context) and
  implicit form (spar --variant <name> shells out to rivet) both supported
- v1 schema is stable; v2+ adds fields only; readers must ignore unknowns

Coordinates with ongoing rivet rework so the binding layer has a concrete
contract to implement against. No spar code changes yet; consumer crate
lands alongside Track B implementation.

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

codecov Bot commented Apr 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@avrabe avrabe merged commit b98e2b6 into main Apr 23, 2026
11 checks passed
@avrabe avrabe deleted the docs/rivet-spar-variant-contract-v1 branch April 23, 2026 21:04
avrabe added a commit that referenced this pull request Apr 25, 2026
…I integration (#154)

Closes the v0.7.0 Track A milestone:

- COMPLIANCE.md "In progress / v0.7.0" expanded into a full narrative
  covering all four Track A commits (foundation #145, hierarchical RTA
  #147, Lean convergence #148, this close-out), the Track B variant-
  contract foundation (#144), v0.7.x infrastructure landings (#141-143,
  #151), and v0.8.0 planning anchors (Track D #149/#152, Track E
  #150/#153).

- Updated header date to 2026-04-25 and crate count from "16 crates,
  1200+ tests" to "17 crates, 1900+ tests" reflecting the test growth
  through Track A and the v0.7.x infrastructure additions.

- New CLI integration test crates/spar-cli/tests/track_a_close_out.rs
  exercises the full parse → instance → analyze pipeline on a model
  using the Spar_Timing::ISR_* property surface plus a sporadic handler
  thread. The unit + fixture tests in spar-analysis cover the algorithm
  at the analysis-crate level; this test guards the property surface
  flowing through the CLI binary end-to-end.

Out-of-scope items explicitly recorded: PIP/PCP blocking deferred to
v0.7.1, multi-processor ISR migration deferred, cache-aware
interference inflation deferred to v1.0+.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
avrabe added a commit that referenced this pull request Apr 26, 2026
…t v1 (Track B commit 1)

New crate spar-variants implements the consumer side of the v1 contract
(docs/contracts/rivet-spar-variant-v1.md). Reads rivet's resolved-variant
JSON blob, exposes a `keep_in_variant` predicate that applies intersection-
semantics binding rules to HIR items, and validates strict version
matching ("1" only — v2 readers refused per contract).

No CLI integration in this commit (--variant flag wiring lands when
rivet's emitter side ships and we have an end-to-end test loop). No
HasBindingIdentity impls for spar-hir-def types yet — adapter ships
with the CLI commit. Stub types are used in unit tests.

Per Track B contract v1 (#144).

New requirement: REQ-VARIANT-001.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
avrabe added a commit that referenced this pull request Apr 26, 2026
…t v1 (Track B commit 1) (#162)

New crate spar-variants implements the consumer side of the v1 contract
(docs/contracts/rivet-spar-variant-v1.md). Reads rivet's resolved-variant
JSON blob, exposes a `keep_in_variant` predicate that applies intersection-
semantics binding rules to HIR items, and validates strict version
matching ("1" only — v2 readers refused per contract).

No CLI integration in this commit (--variant flag wiring lands when
rivet's emitter side ships and we have an end-to-end test loop). No
HasBindingIdentity impls for spar-hir-def types yet — adapter ships
with the CLI commit. Stub types are used in unit tests.

Per Track B contract v1 (#144).

New requirement: REQ-VARIANT-001.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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