prometeu-runtime/discussion/workflow/plans/PLN-0051-move-vm-runtime-into-services.md
2026-05-14 18:26:09 +01:00

104 lines
3.5 KiB
Markdown

---
id: PLN-0051
ticket: system-os-service-ownership-and-module-layout
title: Move VM Runtime Into Services
status: done
created: 2026-05-14
ref_decisions: [DEC-0024]
tags: [runtime, os, services, module-layout, vm, window-manager, logging]
---
## Briefing
Implement the mechanical module relocation required by `DEC-0024`: move
`VirtualMachineRuntime` from the `prometeu-system` crate root into the services
tree at `services/vm_runtime`.
This plan is intentionally behavior-preserving. It prepares the service layout
for later ownership plans without moving logging, filesystem, or memcard state.
## Source Decisions
- `DEC-0024`: `VirtualMachineRuntime` SHALL move to
`services/vm_runtime`; old root paths MUST NOT remain available through
compatibility reexports.
## Target
Make `VirtualMachineRuntime` a service module while keeping the public type name
unchanged and preserving current VM behavior.
The canonical implementation path after this plan is:
```text
crates/console/prometeu-system/src/services/vm_runtime/
```
## Dependencies
- Source decision: `DEC-0024`.
- No prior plan is required.
- This plan should run before `PLN-0052`, `PLN-0053`, and `PLN-0054`.
## Scope
- Move `crates/console/prometeu-system/src/virtual_machine_runtime.rs` to
`crates/console/prometeu-system/src/services/vm_runtime.rs` or equivalent
module root under `services/vm_runtime`.
- Move the existing `virtual_machine_runtime/` child modules under
`services/vm_runtime/`.
- Update `crates/console/prometeu-system/src/services/mod.rs` to expose
`vm_runtime`.
- Update `crates/console/prometeu-system/src/lib.rs` to export
`VirtualMachineRuntime` from `services::vm_runtime`.
- Update internal module paths and tests directly.
## Out of Scope
- Do not move `LogService` ownership.
- Do not move `VirtualFS` or `MemcardService` ownership.
- Do not move `WindowManager`.
- Do not introduce reexports or aliases for the old root module path.
- Do not change VM runtime behavior, syscalls, telemetry, logging semantics, or
cartridge execution behavior.
## Execution Plan
1. Move the VM runtime module files into `src/services/vm_runtime/`.
2. Register `pub mod vm_runtime;` from `src/services/mod.rs`.
3. Remove the root `mod virtual_machine_runtime;` declaration from `src/lib.rs`.
4. Export `VirtualMachineRuntime` through the services path.
5. Update `SystemOS`, tests, and any internal imports to use the new module
location.
6. Run formatting and the affected Rust tests.
## Acceptance Criteria
- `VirtualMachineRuntime` implementation lives under `services/vm_runtime`.
- No root `virtual_machine_runtime` module remains in `prometeu-system`.
- No compatibility reexport preserves the old root module path.
- Public type name `VirtualMachineRuntime` remains available where the crate API
intentionally exposes it.
- Runtime behavior remains unchanged.
## Tests / Validation
- Run `cargo test -p prometeu-system`.
- If workspace constraints make that too broad, run the narrowest available
`prometeu-system` test target and record the exact command in implementation
evidence.
## Risks
- Module move churn can hide accidental import compatibility. Review must check
that no old root module remains.
- Test modules may need path updates because they currently live under the VM
runtime module tree.
## Affected Artifacts
- `crates/console/prometeu-system/src/lib.rs`
- `crates/console/prometeu-system/src/services/mod.rs`
- `crates/console/prometeu-system/src/services/vm_runtime/**`
- Existing VM runtime tests moved with the module