prometeu-runtime/discussion/workflow/plans/PLN-0104-migrate-vm-runtime-hostcontext-to-platform.md

2.2 KiB

id ticket title status created completed ref_decisions tags
PLN-0104 real-render-worker-establishment Migrate VM Runtime HostContext to Platform Services done 2026-06-06
DEC-0032
runtime
vm
platform
hostcontext

Objective

Change VM runtime execution from receiving &mut dyn HardwareBridge to receiving explicit platform services.

Background

HostContext currently carries Option<&mut dyn HardwareBridge>. That shape lets every syscall see the entire bridge. DEC-0032 requires explicit services instead.

Scope

Included

  • Introduce a platform-aware HostContext shape.
  • Migrate VM runtime tick/dispatch to use platform services.
  • Preserve VM tests and fault behavior.

Excluded

  • Do not migrate firmware/Hub in this plan.
  • Do not remove HardwareBridge yet.

Execution Steps

Step 1 - Add platform host context

What: Extend or replace HostContext with platform-service access. How: Add methods for required VM syscall domains instead of require_hw(). File(s): crates/console/prometeu-hal/src/host_context.rs.

Step 2 - Migrate runtime tick

What: Tick uses platform services for begin-frame, composer frame closure, render sink, audio clear, and telemetry reads. How: Replace direct bridge access with explicit facade calls. File(s): crates/console/prometeu-system/src/services/vm_runtime/tick.rs.

Step 3 - Migrate dispatch

What: VM syscall dispatch uses explicit facade methods. How: Remove ctx.require_hw() as the central dispatch dependency. File(s): crates/console/prometeu-system/src/services/vm_runtime/dispatch.rs.

Test Requirements

Unit Tests

  • VM dispatch tests pass with platform context.

Integration Tests

  • cargo test -p prometeu-system.

Manual Verification

  • rg "require_hw|HardwareBridge" vm_runtime shows no production VM runtime dependency except temporary compatibility adapters explicitly marked.

Acceptance Criteria

  • VM runtime dispatch no longer depends on the monolithic bridge.
  • Tick uses explicit platform services.
  • Existing VM fault behavior remains unchanged.

Dependencies

  • PLN-0103.

Risks

  • HostContext is used in VM unit tests. Migration must keep no-hardware test contexts ergonomic.