4.6 KiB
| id | ticket | title | status | created | ref_decisions | tags | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| PLN-0146 | foreground-stack-game-pause-shell-vm-backed | Consolidate Lifecycle Process Lookup Helpers | done | 2026-07-04 |
|
|
Briefing
DEC-0037 depends on SystemOS lifecycle authority being internally
consistent. The lifecycle facade now exposes both process state and process kind
for a task so firmware can distinguish VM-backed Shell tasks from native Shell
tasks. Both accessors repeat the same task-to-process lookup pattern.
The duplication is small, but this facade is now part of the foreground contract surface. Keeping lookup and error mapping in one place reduces the chance that future lifecycle accessors drift in behavior.
Objective
Consolidate task-to-process lookup in LifecycleFacade behind one private
helper, while preserving the public lifecycle facade behavior and errors.
Dependencies
- Source decision:
DEC-0037. - Depends on the process/task authority from SystemOS lifecycle work.
- Can be implemented independently of
PLN-0145andPLN-0147.
Scope
Included:
- Add one private helper that resolves a
TaskIdto its backing process. - Route
process_state_for_taskandprocess_kind_for_taskthrough that helper. - Preserve
LifecycleError::TaskNotFoundandLifecycleError::ProcessNotFoundbehavior exactly. - Keep the current process/task manager ownership boundaries intact.
- Keep the current non-architectural cleanup in
set_foreground_taskif it is still present in the working tree.
Excluded:
- No new public process manager API.
- No changes to task or process IDs.
- No changes to Shell/Game lifecycle semantics.
- No broader facade refactor outside lifecycle lookup.
Non-Goals
- Do not expose raw process manager access through SystemOS.
- Do not change
ProcessKindorTaskKinddefinitions. - Do not alter foreground stack behavior.
Execution Method
-
Add a private lifecycle lookup helper.
- What changes: add a private function near
process_id_for_taskthat returns a process reference for aTaskId. - How it changes: the helper should call
process_id_for_task, then retrieve the process fromprocess_manager, returningLifecycleError::ProcessNotFound(process_id)if the process is missing. - File(s):
crates/console/prometeu-system/src/os/facades/lifecycle.rs.
- What changes: add a private function near
-
Route state and kind accessors through the helper.
- What changes:
LifecycleFacade::process_state_for_taskandLifecycleFacade::process_kind_for_taskstop duplicating the process manager lookup. - How it changes: both methods call the helper and map the process reference
to
ProcessStateorProcessKind. - File(s):
crates/console/prometeu-system/src/os/facades/lifecycle.rs.
- What changes:
-
Preserve existing foreground code cleanup.
- What changes: keep
set_foreground_taskas an expression-returning match rather than using redundantreturnstatements. - How it changes: ensure formatting and clippy stay clean.
- File(s):
crates/console/prometeu-system/src/os/facades/lifecycle.rs.
- What changes: keep
-
Tighten tests around lookup behavior.
- What changes: extend or keep tests proving VM Shell and native Shell process kinds are observable through lifecycle.
- How it changes: add missing-task and missing-process coverage only if the helper changes the observable path enough to justify it.
- File(s):
crates/console/prometeu-system/src/os/system_os.rs.
Acceptance Criteria
process_state_for_taskandprocess_kind_for_taskshare one private task-to-process lookup implementation.- Missing task and missing process errors remain unchanged.
- Existing lifecycle tests continue to pass.
- Firmware can still distinguish
ProcessKind::VmShellfromProcessKind::NativeShell. - Clippy reports no warnings for the touched crates.
Tests
- Unit tests in
prometeu-systemfor shell process kind lookup. - Existing lifecycle missing task/process tests must continue to pass.
- Run
cargo test -p prometeu-system lifecycle process_kind. - Run
cargo test -p prometeu-firmware shell. - Run
cargo clippy -p prometeu-system -p prometeu-firmware --all-targets -- -D warnings. - Run
discussion validate.
Affected Artifacts
crates/console/prometeu-system/src/os/facades/lifecycle.rscrates/console/prometeu-system/src/os/system_os.rs
Risks
- Over-generalizing the helper could leak process manager concepts outside the lifecycle facade. Keep it private and narrowly typed.
- This is intentionally small cleanup. It must not become a broad SystemOS facade redesign.