8.2 KiB
8.2 KiB
| id | ticket | title | status | created | ref_decisions | tags | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| PLN-0058 | system-os-domain-facades | SystemOS Domain Facades First Wave | open | 2026-05-15 |
|
|
Briefing
Implement the first wave of SystemOS domain facades required by DEC-0026.
SystemOS remains the OS ownership boundary, but callers must access behavior
through domain views instead of root-level methods or public internal fields.
Source Decisions
DEC-0026:SystemOSmust expose method-based domain facades for lifecycle, sessions, VM, filesystem and window operations, while keepinglog(...)on the root.- Related:
DEC-0025keeps lifecycle coordination underSystemOS. - Related:
DEC-0024keeps services owned or mediated bySystemOS.
Target
Create these first-wave access shapes:
os.lifecycle().suspend_task(task_id)
os.sessions().create_vm_game_task(app_id, title)
os.vm().initialize(vm, cartridge)
os.vm().tick(vm, signals, hw)
os.fs().mount(backend)
os.window().set_focus(window_id)
os.log(level, source, tag, msg)
After this plan, migrated domains must no longer require public direct access
to task_manager, process_manager, window_manager, vm_runtime, fs,
fs_state, memcard, open_files or next_handle.
Scope
- Add facade/view types under
crates/console/prometeu-system/src/os/. - Add
SystemOSmethods:lifecycle()sessions()vm()fs()window()
- Move root lifecycle methods behind
lifecycle(). - Move task/process session creation behind
sessions(). - Move VM initialization/ticking/reset or execution helpers behind
vm(). - Move filesystem mount/open/read/write/close entry points behind
fs()when the operation exists at OS level. - Move window operations behind
window(). - Keep
SystemOS::log(...)at root. - Migrate firmware, Hub and tests to facade access.
- Make migrated internal
SystemOSfields private.
Out of Scope
- Changing service ownership established by
DEC-0024. - Changing lifecycle semantics established by
DEC-0025. - Introducing
os.lifecycleas a direct public field. - Background lifecycle semantics.
- New filesystem syscall behavior beyond exposing existing OS-owned operations.
- Diagnostics/crash report persistence.
- Redesigning Hub UI or app switching.
- Replacing VM runtime tests that intentionally test
VirtualMachineRuntimedirectly.
Execution Plan
-
Create facade modules and view types.
- Target files:
crates/console/prometeu-system/src/os/mod.rscrates/console/prometeu-system/src/os/system_os.rs- new facade modules under
crates/console/prometeu-system/src/os/
- Define mutable view structs such as
LifecycleFacade<'a>,SessionsFacade<'a>,VmFacade<'a>,FsFacade<'a>andWindowFacade<'a>. - Each facade should borrow the needed
SystemOSinternals and must not own duplicated state.
- Target files:
-
Add
SystemOSfacade accessors.- Add
SystemOS::lifecycle(&mut self) -> LifecycleFacade<'_>. - Add
SystemOS::sessions(&mut self) -> SessionsFacade<'_>. - Add
SystemOS::vm(&mut self) -> VmFacade<'_>. - Add
SystemOS::fs(&mut self) -> FsFacade<'_>. - Add
SystemOS::window(&mut self) -> WindowFacade<'_>. - Keep
SystemOS::new(...)andSystemOS::log(...)on the root.
- Add
-
Move lifecycle operations.
- Target existing logic in
crates/console/prometeu-system/src/os/system_os.rs. - Move or delegate:
set_foreground_tasksuspend_taskresume_taskclose_taskcrash_task
- The facade must preserve typed
LifecycleErrorbehavior. - Callers should use
os.lifecycle().crash_task(...)rather thanos.crash_task(...).
- Target existing logic in
-
Move session creation operations.
- Move or delegate:
create_vm_game_taskcreate_vm_shell_taskcreate_native_shell_task
- These operations may call the lifecycle facade internally to foreground newly created tasks.
- Firmware should use
ctx.os.sessions().create_vm_game_task(...)andctx.os.sessions().create_vm_shell_task(...).
- Move or delegate:
-
Move VM operations.
- Move or delegate:
initialize_vmasos.vm().initialize(...)tick_vmasos.vm().tick(...)
- Include reset access if needed to remove direct
os.vm_runtime.reset(...)from firmware. - Preserve VM runtime behavior and logging.
- Move or delegate:
-
Move filesystem operations.
- Move or delegate existing root filesystem operations:
mount_fsasos.fs().mount(...)unmount_fsif still present, even thoughDEC-0026only names mount/open/read/write/close for the target surface.
- Expose OS-owned open/read/write/close only if those operations already have a suitable service-level implementation; otherwise leave them as explicit follow-up within the facade module without inventing new behavior.
- Keep filesystem state private to
SystemOS/facade internals.
- Move or delegate existing root filesystem operations:
-
Move window operations.
- Target:
crates/console/prometeu-system/src/services/window_manager.rscrates/console/prometeu-system/src/programs/prometeu_hub/prometeu_hub.rs- firmware launch tests and cartridge loading.
- Provide facade operations:
add_windowset_focusfocused_windowclose_window
- Add any narrow helper needed to preserve existing behavior such as removing
all windows, but keep it under
window()rather than exposingwindow_manager.
- Target:
-
Encapsulate migrated fields.
- In
SystemOS, removepubfrom migrated internals once callsites have moved:vm_runtimeprocess_managertask_managerwindow_managerfsfs_statememcardopen_filesnext_handle
- Keep
log_serviceprivate unless a plan proves a public log handle is required. - Avoid adding compatibility root methods for the old surface.
- In
-
Update tests.
- Move
SystemOSlifecycle tests to facade calls. - Update firmware tests to observe state through facades or domain-specific inspection helpers rather than direct internal fields.
- Preserve direct
VirtualMachineRuntimetests where they test the VM runtime service itself, notSystemOS.
- Move
Acceptance Criteria
SystemOSexposeslifecycle(),sessions(),vm(),fs()andwindow().- Root
SystemOSkeepsnew(...)andlog(...). - Lifecycle callsites use
os.lifecycle(). - Session creation callsites use
os.sessions(). - VM initialization/tick/reset callsites use
os.vm(). - Window callsites use
os.window(). - Existing root methods migrated by this plan are removed or made private.
- Migrated internal fields no longer remain public on
SystemOS. - No facade duplicates service state.
- Existing behavior remains unchanged.
Tests / Validation
- Run
cargo test -p prometeu-system. - Run
cargo test -p prometeu-firmware. - Run
discussion validate. - Confirm with search that migrated callsites no longer use:
os.task_manageros.process_manageros.window_manageros.vm_runtimeos.suspend_taskos.resume_taskos.close_taskos.crash_taskos.initialize_vmos.tick_vmos.create_vm_game_taskos.create_vm_shell_task
Risks
- Borrowing may require facades to expose narrow methods rather than returning long-lived mutable references. Keep facades short-lived and method-based.
- Some tests currently inspect internal fields directly. Prefer domain-level inspection helpers over keeping fields public.
- Filesystem
open/read/write/closemay not all exist as OS-level operations yet. Do not invent new filesystem semantics while implementing the facade. - Removing all public internals in one change can be broad. If a field cannot be hidden without unrelated redesign, document the temporary exception in the implementation and leave a follow-up plan.
Affected Artifacts
crates/console/prometeu-system/src/os/**crates/console/prometeu-system/src/programs/prometeu_hub/**crates/console/prometeu-system/src/services/window_manager.rscrates/console/prometeu-firmware/src/firmware/**discussion/index.ndjsondiscussion/workflow/plans/PLN-0058-systemos-domain-facades-first-wave.md