feat(compass-app): per-window frame routing in the bridge service (SEA-2035 M3) - #359
Merged
Merged
Conversation
…A-2035 M3) Route each compass_rpc call's response frames to only its originating webview window instead of broadcasting app-wide, so a stream never reaches a non-owning window once more than one is open. The originating window is captured off the still-live bound-method ctx in register (application.WindowKey) and stored on the inflightCall; the pump callback emits through a per-call sink (emitFrame) that dispatches to that window via the windowDispatcher seam, falling back to the app-wide eventEmitter when no window is in context. A frame for a call whose window has closed is dropped by DispatchWailsEvent's isDestroyed no-op (A4), not fallback-broadcast. The application package compiles only under -tags gtk3 on this toolchain, so the ctx read + Wails adapter live in a build-tagged helper (bridge_service_window_gtk3.go / _nogtk3.go), mirroring the main.go/main_nogtk3.go split; bridge_service.go stays //go:build unix and imports no application, keeping the forwarding path testable behind the seam. newBridgeService, CompassRPCCancel, register's context derivation, finish, and the mutex discipline are unchanged. Tests (unix-tagged, no webview): per-window delivery, a concurrent single-service two-window isolation arm (§M3, no cross-window delivery), the preserved no-window fallback, and a destroyed-window drop. All event-gated, race-clean. Spec-impact: implements docs/designs/product/compass-multi-window/design.md §A4 + §M3 (per-window frame routing); no spec change. Ledger-impact: none. Co-authored-by: Matt Wilkinson <matt@rigel.build>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is part of a stack containing 2 PRs:
mainRoute each compass_rpc call's response frames to only its originating
webview window instead of broadcasting app-wide, so a stream never
reaches a non-owning window once more than one is open.
The originating window is captured off the still-live bound-method ctx
in register (application.WindowKey) and stored on the inflightCall; the
pump callback emits through a per-call sink (emitFrame) that dispatches
to that window via the windowDispatcher seam, falling back to the
app-wide eventEmitter when no window is in context. A frame for a call
whose window has closed is dropped by DispatchWailsEvent's isDestroyed
no-op (A4), not fallback-broadcast.
The application package compiles only under -tags gtk3 on this
toolchain, so the ctx read + Wails adapter live in a build-tagged helper
(bridge_service_window_gtk3.go / _nogtk3.go), mirroring the
main.go/main_nogtk3.go split; bridge_service.go stays //go:build unix and
imports no application, keeping the forwarding path testable behind the
seam. newBridgeService, CompassRPCCancel, register's context derivation,
finish, and the mutex discipline are unchanged.
Tests (unix-tagged, no webview): per-window delivery, a concurrent
single-service two-window isolation arm (§M3, no cross-window delivery),
the preserved no-window fallback, and a destroyed-window drop. All
event-gated, race-clean.
Spec-impact: implements docs/designs/product/compass-multi-window/design.md
§A4 + §M3 (per-window frame routing); no spec change.
Ledger-impact: none.
Co-authored-by: Matt Wilkinson matt@rigel.build