3.8 KiB
| id | ticket | title | status | created | completed | ref_decisions | tags | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| PLN-0060 | task-owned-shell-windows | Plan - Focused Window Ownership API | done | 2026-05-15 | 2026-05-15 |
|
|
Plan - Focused Window Ownership API
Briefing
Add the OS/window query required by DEC-0027:
os.windows().focused_window_belongs_to_task(task_id).
This plan owns the system-side API and tests. It does not change firmware
control flow; that is covered by PLN-0061.
Decisions de Origem
DEC-0027- Task-Owned Shell Windows
Alvo
WindowFacade must expose a focused-window ownership predicate that answers
whether the global focused window belongs to a specific TaskId.
Escopo
Included:
- Add a focused ownership query to window.rs.
- Add a helper in window_manager.rs if it keeps the facade thin and testable.
- Add unit tests for focused-window ownership in the
prometeu-systemcrate.
Fora de Escopo
- Changing
ShellRunningStep. - Removing
focused_window_activefromPrometeuHubOutcome. - Spec edits.
- Overlay/modal policy or active-window semantics.
- Multiple-window policy beyond querying the single global focused window.
Plano de Execucao
-
Add
WindowManager::focused_window_belongs_to_task. Incrates/console/prometeu-system/src/services/windows/window_manager.rs, implement a method that:- returns
falsewhenfocusedisNone; - finds the focused window by
WindowId; - returns
trueonly when its owner isWindowOwner::Task(task_id); - returns
falseforHub,Overlay, another task id, or stale focus.
- returns
-
Add
WindowFacade::focused_window_belongs_to_task. Incrates/console/prometeu-system/src/os/facades/window.rs, expose the public facade method and delegate to the manager/helper. -
Keep existing facade methods intact. Do not remove
focused_window()orwindows()in this plan. Existing call sites may still need them untilPLN-0061updates firmware. -
Add tests in
window_manager.rs. Cover:- no focused window returns
false; - focused
WindowOwner::Task(task_id)returnstrue; - focused
WindowOwner::Task(other_task)returnsfalse; - focused
WindowOwner::Hubreturnsfalse; - focused
WindowOwner::Overlayreturnsfalse; - stale focused id after window removal returns
false.
- no focused window returns
-
Add facade-level coverage if existing
SystemOStests provide a convenient pattern. If facade-level setup would duplicate manager coverage heavily, keep the unit coverage at the manager level and rely on the facade as a direct delegation.
Criterios de Aceite
os.windows().focused_window_belongs_to_task(task_id)compiles.- The predicate returns
trueonly for the currently focusedWindowOwner::Task(task_id). Hub,Overlay, absent focus, stale focus, and other task owners returnfalse.- No firmware behavior changes are included in this plan.
Tests / Validacao
- Run
cargo test -p prometeu-system. - Run any narrower test command available for the window manager module if the crate supports it.
- Run
discussion validate.
Riscos
- Directly scanning
windowsby focused id is simple but can hide stale focus bugs. Tests must lock stale focus behavior tofalse. - Adding only a facade method without manager coverage would make the contract harder to verify. Prefer manager tests.
- Borrowing through
WindowFacademust remain short-lived and compatible with existingSystemOSfacade patterns.