ReviewOS

craft-native/craft

Define app-wide event delivery for multi-window apps

#331
Closed glennmichael123 opened this 9 days ago ·
9 days ago

Follow-up to #67. The runtime window contract is implemented and tested across macOS, Linux, and Windows. Page-originated replies and window lifecycle events route to the correct window and handle owner. Application-wide asynchronous sources still intentionally deliver to the primary page; opening a child must not silently redirect them.

Current sources are listed in docs/architecture/multi-window-ownership.md: theme changes, screen configuration, deep links, location updates, in-app purchase updates, local-server requests, screen-sharing changes, and tray/application-menu actions. Touch Bar ownership and advanced window-control parity are separate concerns.

Decide and document the delivery policy for each source: keep primary-only, broadcast to live pages, or track subscribers and their owning webviews. For subscriber-owned sources, define behavior across navigation, close, destroy, and orphan adoption; do not route events into a stale page. Preserve existing primary-page behavior until an explicit policy and migration path are approved.

Acceptance: document the per-source policy and compatibility impact; implement the selected routing and cleanup; add multi-window tests that prove the intended recipient receives events and unrelated pages do not; cover installed-app behavior where a real native source is required. This issue does not reopen the completed window lifecycle and parent-only modal contract in #67.

9 days ago

Implemented the compatibility policy in 6bdcc02 (pushed to main).

All existing process-global sources are now explicitly documented as primary-only: theme, display configuration, deep links, location, IAP, local-server requests, screen sharing, and tray/application-menu actions. The change preserves the existing primary sink and does not broadcast to unrelated pages or infer subscriber ownership.

Added scripts/multi-window-event-policy.test.ts and wired it into CI. The test keeps the source list complete, requires the migration/lifecycle contract before any policy change, and anchors each source to its current owner implementation. A future move to broadcast or per-subscriber delivery must add subscriber identity, navigation/close/destroy/orphan cleanup, and a real multi-window recipient/exclusion test.

9 days ago

Resolved on main by 6bdcc02. The multi-window event delivery policy is documented in the repository, including ownership and isolation rules. On main, unreleased.

Sign in to comment on this issue.