prometeu-runtime/discussion/workflow/plans/PLN-0053-move-logging-ownership-to-systemos.md
2026-05-14 18:31:58 +01:00

3.0 KiB

id ticket title status created ref_decisions tags
PLN-0053 system-os-service-ownership-and-module-layout Move Logging Ownership To SystemOS done 2026-05-14
DEC-0024
runtime
os
services
module-layout
vm
window-manager
logging

Briefing

Move LogService ownership from VirtualMachineRuntime to SystemOS, while allowing VM execution code to use OS logging through an explicit reference or handle.

Source Decisions

  • DEC-0024: LogService SHALL move from VirtualMachineRuntime to SystemOS; VM execution MAY use an explicit OS logging reference or handle but MUST NOT own logging.

Target

Make logging an OS-owned service and reduce VirtualMachineRuntime to a user of logging rather than its owner.

Dependencies

  • Source decision: DEC-0024.
  • Depends on PLN-0051.
  • May run after or alongside PLN-0052, but code integration is simpler after SystemOS service ownership is established.

Scope

  • Add LogService ownership to SystemOS.
  • Remove log_service: LogService from VirtualMachineRuntime.
  • Update VM runtime methods that read/write logs to receive logging access from SystemOS or a narrow explicit handle.
  • Update construction paths so LogService::new(4096) is owned by SystemOS.
  • Update tests that currently inspect runtime-owned logs.

Out of Scope

  • Do not change log capacity or log record semantics.
  • Do not change VM syscall behavior except for the ownership path.
  • Do not introduce compatibility accessors that imply VM ownership.
  • Do not move filesystem or memcard ownership in this plan.

Execution Plan

  1. Add a LogService field to SystemOS and initialize it in SystemOS::new.
  2. Remove LogService initialization and storage from VirtualMachineRuntime::new.
  3. Update VM logging call paths in dispatch, tick, lifecycle, and tests to use OS-owned logging.
  4. If borrow constraints require it, introduce a narrow logging handle/reference parameter at the call boundary instead of giving the VM ownership.
  5. Update all tests that assert logging behavior.
  6. Run formatting and tests.

Acceptance Criteria

  • VirtualMachineRuntime no longer stores LogService.
  • SystemOS owns LogService.
  • VM execution can still emit and expose logs through the existing behavior.
  • No compatibility API suggests that logging remains VM-owned.
  • Existing logging tests pass or are updated to assert OS ownership.

Tests / Validation

  • Run cargo test -p prometeu-system.
  • Include focused tests covering VM log writes and reads after ownership moves to SystemOS.

Risks

  • Borrowing constraints around NativeInterface may require a narrow access pattern rather than simply borrowing all of SystemOS.
  • Tests that currently construct only VirtualMachineRuntime may need to move to SystemOS construction to reflect the new owner.

Affected Artifacts

  • crates/console/prometeu-system/src/os/system_os.rs
  • crates/console/prometeu-system/src/services/vm_runtime/**
  • Tests under the VM runtime module