Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…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>
87e9906 to
a2f7f9d
Compare
This was referenced Apr 27, 2026
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.
Summary
Speculative consumer side for the rivet ↔ spar variant binding contract v1
(docs/contracts/rivet-spar-variant-v1.md, proposed in #144).
Rivet's emitter is in flight; this crate is ready for it.
spar-variants(sibling ofspar-network) — depends only onspar-hir-defandserde/serde_json.VariantContext::from_jsonparses the v1 blob and strictly rejects anyrivet_spar_context_version != "1"(v2 readers refused per contract §"Compatibility and versioning").Bindingcovers both file-scoped (artifact) and symbol-scoped (symbol) entries viaserde(untagged).HasBindingIdentitytrait — minimal identity adapter HIR items will implement.keep_in_variant(item, context)applies the contract's intersection semantics: an item is kept iff every matching binding has itsrequiressatisfied; items with no matching binding are kept unconditionally as variant-independent infrastructure.Out of scope for this commit (deferred to Track B commit 2 alongside CLI wiring):
--variant/--variant-contextflags onspar-cli.impl HasBindingIdentityforspar-hir-deftypes — tests use a localStubItem.The symbol-binding matcher uses textual prefix-matching (
<symbol>followed by.,::, or end-of-string) which covers nested-in-body items per contract §"Symbol granularity"; aTODO(track-b-commit-2+)flags the inheritance corner-case that needs HIR-level "contains" plumbing rather than string-shape.Artifacts
REQ-VARIANT-001("Consume rivet's variant context blob (v1) and filter HIR").TEST-VARIANTS-CONSUMERlinked toREQ-VARIANT-001.Test plan
cargo build -p spar-variantscleancargo test -p spar-variants— 17 tests pass (10 spec'd + 7 incidental coverage)cargo build --workspacecleancargo test --workspace— all greencargo clippy --workspace --all-targets -- -D warningscleancargo fmt --all -- --checkcleanrivet validatePASS (91 advisory warnings, all pre-existing)Contract-spec ambiguities encountered
None blocking. One soft point worth flagging for the v1 finalization pass:
./, fold\→/. No..resolution, no case-folding, no canonicalization against the filesystem. That's almost certainly the right v1 behaviour (project-relative paths, no I/O on the consumer side) but the spec could be tighter. Not blocking commit 1 — happy to firm up once the emitter is exercising real fixtures.🤖 Generated with Claude Code