4.5 KiB
4.5 KiB
| id | ticket | title | status | created | ref_decisions | tags | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| PLN-0056 | system-os-lifecycle-process-task-contract | Firmware Lifecycle Delegation | done | 2026-05-15 |
|
|
Briefing
Move firmware lifecycle callsites to the SystemOS semantic API introduced by
PLN-0055. Firmware remains a boot and execution state machine; it must not
coordinate task/process lifecycle by calling TaskManager and ProcessManager
separately.
Source Decisions
DEC-0025: firmware must delegate semantic lifecycle transitions toSystemOS.
Target
Replace direct lifecycle manipulation in firmware with SystemOS lifecycle
methods while preserving current observable behavior.
Scope
- Update cartridge launch paths to use
SystemOSlifecycle authority when placing newly created tasks in foreground. - Update crash paths where a task crash is detected so task/process state moves
through
SystemOS::crash_task. - Preserve the strong
GameRunningStepinvariant: a running game step only supports a game task inTaskState::Foreground. - Keep
SystemRunningStep, Hub, and WindowManager behavior unchanged except for lifecycle delegation required byDEC-0025.
Out of Scope
- Full game suspend/resume UX.
- Returning to Hub/Home on suspend or close.
- Shell UI redesign.
- App switcher.
- Background task API.
- WindowManager migration.
- Diagnostics service or crash report persistence.
Execution Plan
-
Audit direct lifecycle manager usage.
- Target files:
crates/console/prometeu-firmware/src/firmware/*.rs,crates/console/prometeu-system/src/os/system_os.rs. - Search for direct calls to
task_manager.set_foreground,task_manager.mark_suspended,task_manager.close_task,task_manager.mark_crashed,process_manager.mark_suspended,process_manager.mark_stopped, andprocess_manager.mark_crashed.
- Target files:
-
Keep launch construction inside
SystemOS.- Target file:
crates/console/prometeu-system/src/os/system_os.rs. - Ensure
create_vm_game_task,create_vm_shell_task, andcreate_native_shell_taskcoordinate foreground/running state through the lifecycle core API fromPLN-0055.
- Target file:
-
Update game crash handling.
- Target file:
crates/console/prometeu-firmware/src/firmware/firmware_step_game_running.rs. - When the task is missing, preserve current crash-screen behavior. If the
task does not exist,
SystemOS::crash_taskcannot attach state and the firmware should continue producing a clear crash report. - When a foreground invariant fails for an existing task, call
ctx.os.crash_task(task_id, report?)before transitioning toAppCrashesStep. - When
tick_vmreturns a crash report for the active task, callctx.os.crash_task(task_id, report?)before transitioning toAppCrashesStep.
- Target file:
-
Keep shell launch behavior unchanged.
- Target file:
crates/console/prometeu-firmware/src/firmware/firmware_step_load_cartridge.rs. - Do not move
WindowManagerlogic. - Do not change shell window creation or focus behavior.
- Rely on
SystemOS::create_vm_shell_taskto coordinate task/process foreground state.
- Target file:
-
Avoid introducing background lifecycle.
- Do not add
background_task. - Do not treat
TaskState::Backgroundas a public lifecycle result in firmware.
- Do not add
Acceptance Criteria
- Firmware does not coordinate task/process lifecycle by manually changing both managers.
- Game VM crash results in
SystemOS::crash_taskfor the active task when the task still exists. - Foreground invariant violation in
GameRunningStepcrashes the task throughSystemOS. - Launch behavior for
AppMode::GameandAppMode::Shellremains unchanged. - WindowManager and Hub behavior are not redesigned or moved.
Tests / Validation
- Run firmware tests that cover cartridge launch for
AppMode::GameandAppMode::Shell. - Add or update tests for
GameRunningStepcrash delegation if the existing test harness supports firmware step testing. - Run the affected Rust test suite for
prometeu-firmware.
Risks
- Crash report ownership is not final. This plan should pass the report through
the lifecycle API only to the extent supported by
PLN-0055; persistence remains out of scope. GameRunningStepcurrently reads task state directly. This is acceptable for enforcing the foreground invariant, but it must not become a place that coordinates lifecycle state across managers.