Skip to content

feat(compass-app): per-window frame routing in the bridge service (SEA-2035 M3) - #359

Merged
mattwilkinsonn merged 1 commit into
mainfrom
seal-2035-mw-m3-frame-routing
Aug 16, 2026
Merged

feat(compass-app): per-window frame routing in the bridge service (SEA-2035 M3)#359
mattwilkinsonn merged 1 commit into
mainfrom
seal-2035-mw-m3-frame-routing

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

This PR is part of a stack containing 2 PRs:

  1. main
  2. "feat(compass-app): per-window frame routing in the bridge service (SEA-2035 M3)" (this PR)
  3. feat(compass-app): close-time cancel of a window's in-flight calls (SEA-2035 M3b) #360

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

…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>
@linear-code

linear-code Bot commented Aug 16, 2026

Copy link
Copy Markdown

SEA-2035

@mattwilkinsonn
mattwilkinsonn merged commit cadaea0 into main Aug 16, 2026
3 checks passed
@mattwilkinsonn
mattwilkinsonn deleted the seal-2035-mw-m3-frame-routing branch August 16, 2026 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants