Skip to content

feat(migration): tentative-binding overlay (Track E commit 2/8)#164

Merged
avrabe merged 1 commit intomainfrom
feat/v0.8.0-track-e-commit2-overlay
Apr 26, 2026
Merged

feat(migration): tentative-binding overlay (Track E commit 2/8)#164
avrabe merged 1 commit intomainfrom
feat/v0.8.0-track-e-commit2-overlay

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Apr 25, 2026

Summary

  • Adds BindingOverlay in spar-hir-def — an immutable per-component-instance map from a moving component to its hypothetical target processor — so any analysis can run "as if" the binding were rebound without mutating the underlying SystemInstance.
  • Adds actual_processor_binding_with_overlay(instance, comp, overlay) as the load-bearing accessor: when the overlay carries a move it returns the hypothetical target; otherwise it falls through to the declared Actual_Processor_Binding.
  • Validates the overlay against Spar_Migration::Frozen (from commit 1) and Spar_Migration::Allowed_Targets, returning structured FrozenViolation / AllowedTargetsViolation diagnostics (no prose-parsing required by callers).
  • Empty overlay is a strict no-op identity — actual_processor_binding_with_overlay(.., None) and actual_processor_binding_with_overlay(.., Some(&BindingOverlay::new())) agree on every component.
  • Per Track E research §6.4 (design doc).

Scope (what this commit is)

  • crates/spar-hir-def/src/overlay.rsBindingOverlay, FrozenViolation, AllowedTargetsViolation, OverlayDiagnostic, actual_processor_binding_with_overlay, plus 10 unit tests.
  • Public re-exports added to crates/spar-hir-def/src/lib.rs.
  • REQ-MIGRATION-004 appended to artifacts/requirements.yaml.
  • TEST-OVERLAY appended to artifacts/verification.yaml, satisfying REQ-MIGRATION-{004,001,002}.

Out of scope (explicitly NOT in this commit)

  • CLI surface. spar moves verify lands in commit 3.
  • Solver integration. spar-solver hypothetical mode lands in commits 4–5.
  • MCP surface. spar.verify_move, spar.enumerate_moves are deferred to v0.9.0 (commits 9–11).
  • Memory / connection bindings. Processor binding only for v0.8.0 — memory and connection bindings may join the overlay in v0.9.0.
  • Variant resolution. rivet variant composition happens before the overlay, not inside it (docs: rivet <-> spar variant binding contract v1 (proposed) #144 wiring lands in commit 7).
  • No changes to COMPLIANCE.md, spar-cli, spar-solver, α/β/δ surfaces, or any MCP scaffolding.

Test plan

  • cargo build --workspace — clean
  • cargo test -p spar-hir-def — 448 passed (438 prior + 10 new in overlay::tests)
  • cargo test --workspace — all green
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo fmt --all -- --check — clean
  • rivet validate — PASS

The 10 new tests cover the contract: empty-overlay identity, single-move semantics, unrelated-component non-interference, frozen-component violation (with Pinned_Reason plumbed through), non-frozen no-op, allowed-targets satisfied, allowed-targets violated, empty-allowed-targets means no restriction (both empty list and absent property), three-move independence, and clone independence.

🤖 Generated with Claude Code

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 26, 2026

Codecov Report

❌ Patch coverage is 95.56962% with 21 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/spar-hir-def/src/overlay.rs 95.56% 21 Missing ⚠️

📢 Thoughts on this report? Let us know!

@avrabe avrabe force-pushed the feat/v0.8.0-track-e-commit2-overlay branch from 714235d to 73592b8 Compare April 26, 2026 06:49
Adds BindingOverlay — a HIR-level immutable map from component idx to
hypothetical target processor idx — that lets any analysis run "as if"
the binding were rebound without mutating the SystemInstance.

The overlay validates against Spar_Migration::Frozen and Allowed_Targets
from commit 1, returning structured FrozenViolation / AllowedTargetsViolation
diagnostics. Empty overlay is the no-op identity (non-regression).

This is the technical foundation for spar moves verify (commit 3) and
spar moves enumerate (commit 4-5). No CLI surface, no solver wiring, no
MCP in this commit.

Per Track E research §6.4 (#153, merged).

New requirement: REQ-MIGRATION-004.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@avrabe avrabe force-pushed the feat/v0.8.0-track-e-commit2-overlay branch from 73592b8 to 61c2988 Compare April 26, 2026 13:19
@avrabe avrabe merged commit 91c3402 into main Apr 26, 2026
17 checks passed
@avrabe avrabe deleted the feat/v0.8.0-track-e-commit2-overlay branch April 26, 2026 15:42
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