Skip to content

SPEC-VM-021 Step 7: Fix 5 architecture violations for single-owner continuations#379

Open
proboscis wants to merge 1 commit intomainfrom
fix/arch-violations-single-owner-continuation
Open

SPEC-VM-021 Step 7: Fix 5 architecture violations for single-owner continuations#379
proboscis wants to merge 1 commit intomainfrom
fix/arch-violations-single-owner-continuation

Conversation

@proboscis
Copy link
Copy Markdown
Owner

Summary

  • Violation 1: return_to_continuation() in dispatch.rs replaced with return_to_fiber_id() — returns FiberId instead of manufacturing Continuation from stored frame data. Callers now use capture_live_continuation() (the approved live-topology method).
  • Violation 2+3: ContId type deleted entirely. derived_cont_id() removed. Replaced with Continuation::identity() -> Option<FiberId> and fresh_pending_cont_id() -> u64 for pending continuations.
  • Violation 4: DoCtrl::EvalInScope { scope: Continuation } changed to { scope_fiber: FiberId } — no Continuation needed for scope reference.
  • Violation 5: Scheduler park-and-continue pattern fixed — FiberId extracted before parking k_user, Continuation created after k_user is consumed. Ensures single owner at all times.

Test results

  • Rust vm-core: 55/55 pass (53 + 2 integration), 1 ignored
  • Rust core-effects: 82/84 pass, 2 pre-existing env failures (missing doeff Python module)
  • Python: 79/97 pass, 18 pre-existing failures on main
  • Zero regressions

Files changed (12)

  • doeff-vm-core: continuation.rs, do_ctrl.rs, ids.rs, lib.rs, vm/dispatch.rs, vm/step.rs, vm/vm_trace.rs, vm_tests.rs
  • doeff-core-effects: scheduler/mod.rs, handlers/mod.rs
  • doeff-vm: lib.rs, pyvm.rs

Test plan

  • cargo test for doeff-vm-core (55 pass)
  • cargo test for doeff-core-effects (82 pass, 2 pre-existing env failures)
  • cargo build for doeff-vm (compiles clean)
  • Python integration tests (79 pass, 18 pre-existing failures)
  • Verify zero regressions vs main branch

🤖 Generated with Claude Code

…ntinuations

Eliminate ContId type, derived_cont_id(), and all patterns that create
Continuation objects from stored data. Enforce single-owner semantics
where the VM never manufactures continuations from stored fiber IDs.

Violations fixed:
1. dispatch.rs return_to_continuation → return_to_fiber_id (returns FiberId,
   callers use capture_live_continuation for approved Continuation creation)
2. ContId type deleted from ids.rs, replaced with fresh_pending_cont_id() -> u64
3. derived_cont_id() deleted, replaced with identity() -> Option<FiberId>
4. EvalInScope scope: Continuation → scope_fiber: FiberId
5. Scheduler park-and-continue: extract FiberId before parking, create
   Continuation after k_user is consumed (single owner at all times)

Co-Authored-By: Claude Opus 4.6 <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