Expand description
Window lifecycle reducer handlers. Extracted from reducer/mod.rs in task #182 PR-C for navigability.
Handles ReportWindowOpened, ReportWindowClosed, and the ReportBackendWindowId{Registered,Unregistered} pair.
Functionsยง
- handle_
report_ ๐backend_ window_ id_ registered - Phase B.5 (window_id_map step a) โ record the host-reported label โ backend_window_id mapping. Idempotent on duplicate label (overwrites with the new ID and emits a fresh event so subscribers see the latest mapping).
- handle_
report_ ๐backend_ window_ id_ unregistered - Phase B.5 (window_id_map step a) โ drop the host-reported label
from the map. Strict pairing: emits
BackendWindowIdUnregisteredonly when the label was present (mirrorsWindowClosedandPoolWindowRemovedsemantics โ codex P2 PR #577 round-2). - handle_
report_ ๐window_ closed - Phase B.4 โ drop a host-reported window from the mirror. Returns
Event::WindowClosedonly when the label was actually in the mirror; an unknown-label close is a silent no-op (codex P2 PR #577 round-2). Without this gate, aReportWindowClosedfor a label the launcher never saw (e.g. a pool window that was popped from the queue but failed HWND validation inpromote_pool_windowโ the orphan windowโs eventualon_before_closereaches us without a matching open) would emit an unpairedWindowClosedbroadcast and break subscribers that assume open/close pairing. - handle_
report_ ๐window_ opened - Phase B.4 โ record a host-reported window opening in the launcherโs read-only mirror. Idempotent on duplicate opens (same label twice in a row): the second insert overwrites with fresh metadata and emits a fresh event. Subscribers must tolerate seeing the same label twice; cleaner once B.5 makes the launcher authoritative.