prometeu-runtime/discussion/workflow/plans/PLN-0165-validate-hub-kill-flow-end-to-end.md
2026-07-05 09:41:01 +01:00

93 lines
3.3 KiB
Markdown

---
id: PLN-0165
ticket: hub-suspended-game-kill-affordance
title: Validate Hub Kill Flow End To End
status: done
created: 2026-07-05
ref_decisions: [DEC-0040]
tags: [hub, lifecycle, game, ui]
---
## Briefing
DEC-0040 requires that the Hub kill affordance fully terminates the suspended game and prevents resume. PLN-0164 and PLN-0163 provide the operation and UI; this plan validates the full flow end to end.
## Objective
Add deterministic tests that exercise Home -> suspended game indicator -> Hub kill -> no resume/no residue.
## Dependencies
- Source decision: DEC-0040.
- Depends on PLN-0164 for the termination operation.
- Depends on PLN-0163 for Hub UI and click behavior.
## Scope
- Cover a real game launch, Home/ESC return to Hub, indicator visibility, click-to-kill, and post-kill cleanup.
- Verify task/session/resident state are gone.
- Verify render ownership and Hub state are correct.
- Verify assets/composer cleanup where observable.
- Verify log emission.
## Non-Goals
- Do not test OS-native window manager shell app closure here.
- Do not create new cartridges unless existing Stress/Dummy cartridges cannot cover the scenario.
- Do not use timing sleeps or visual/manual assertions as primary evidence.
## Execution Method
1. Extend firmware/SystemOS end-to-end tests.
- Primary file: `crates/console/prometeu-firmware/src/firmware/firmware.rs` or a focused SystemOS runtime test if the existing test harness fits better.
- Launch `Stress Console` or a simple test cartridge.
- Return to Hub through the real Home path.
- Assert the resident game remains suspended before kill.
2. Simulate Hub click on the bottom-right kill control.
- Use deterministic coordinates from the Hub layout.
- Avoid hard-coded magic numbers if the Hub exposes layout constants/helpers.
3. Assert lifecycle cleanup.
- Resident game task is closed.
- Process is stopped.
- VM session lookup returns none.
- Resident game state returns none.
- Foreground owner remains Hub/Shell.
- Render owner is Shell/Hub.
4. Assert resource cleanup.
- Composer is unbound.
- Cartridge asset slots and physical banks are cleared where existing platform test access permits.
- Audio lifecycle pause is not active.
5. Assert no resume path remains.
- Clicking the old resume area or querying resident state must not restore the killed game.
- The Hub control must be absent on the next frame.
6. Assert log evidence.
- Recent logs contain an INFO event equivalent to `Resident game killed from Hub: <title>`.
## Acceptance Criteria
- [ ] End-to-end test launches a game and returns to Hub with resident game suspended.
- [ ] Test confirms the kill control is present before click.
- [ ] Test clicks the control and remains in Hub.
- [ ] Test proves the game cannot be resumed after kill.
- [ ] Test proves task/session/resident/render/audio/assets/composer cleanup.
- [ ] Test proves the explicit INFO log exists.
- [ ] Existing cartridge switch tests still pass.
## Tests
- `cargo test -p prometeu-firmware`
- `cargo test -p prometeu-system`
- `cargo test -p prometeu-host-desktop-winit` if host presentation behavior is touched by implementation.
- `cargo clippy -p prometeu-system -p prometeu-firmware --all-targets -- -D warnings`
## Affected Artifacts
- Firmware/SystemOS end-to-end tests
- Hub tests
- Lifecycle/runtime tests