fix(tile-broadcaster): register v2 window-entries opened via api.window.open
Split responsibility bug in pubsub delivery. A v2 feature tile has
two registration paths depending on how the tile entry is launched:
- launchTile() — eager / lazy-loaded bg entries — registers the
BrowserWindow with tileWindows via the tile registry.
- registerTrustedBuiltinWindow() — ad-hoc special cases (diagnostic,
settings, hud-overlay, cmd-ui, about:blank, datastore-viewer,
page canvas) — explicit register in ipc.ts window-open.
Ordinary v2 window-type entries opened via api.window.open(peek://
tile/home.html) fell into the gap. getTileWebPreferencesForUrl
attached the tile preload + minted a capability token, but the
resulting BrowserWindow was NOT added to tileWindows. The broadcaster
in main.ts iterates getAllTileWindows() plus webview guests, so the
unregistered window never received inbound pubsub messages even
though its own publishes worked fine.
Consequence: any feature with a bg entry + window entry using pubsub
round-trips silently lost the home-receives-bg-response leg. The
pattern affects several real features (entities, groups, lex,
tag-actions per Explore agent audit) and is the reason websearch
tests failed before the single-tile merge landed.
Fix (narrow, 27 lines across 3 files):
- tile-launcher.ts: getTileWebPreferencesForUrl now also returns
the minted token so callers can register. registerTrustedBuiltinWindow
on-close cleanup narrowed to unsubscribeAll(exact-source) rather
than unsubscribeAllByPrefix(tile-prefix) — closing one window-entry
must not wipe a sibling bg-entry's subscriptions.
- ipc.ts: after new BrowserWindow(...) for ordinary v2 tile URLs,
call registerTrustedBuiltinWindow so getAllTileWindows includes it.
- tests/desktop/pubsub-repro.spec.ts: promoted from test.fail to
normal test — it now passes.
Tests: Pubsub Repro 1/1 (was expected-fail). HUD 10/10, Websearch
10/10, no regressions.
Long-term: three registration paths is one too many. Consolidating
so every tile-preload-getting BrowserWindow always lands in
tileWindows would close this gap by construction.