feat(compass-app): close-time cancel of a window's in-flight calls (SEA-2035 M3b) - #360
Open
rigel-mintaka wants to merge 1 commit into
Open
feat(compass-app): close-time cancel of a window's in-flight calls (SEA-2035 M3b)#360rigel-mintaka wants to merge 1 commit into
rigel-mintaka wants to merge 1 commit into
Conversation
mattwilkinsonn
force-pushed
the
seal-2035-mw-m3b-close-cancel
branch
from
August 16, 2026 04:53
10d57b4 to
fd3dc1d
Compare
rigel-mintaka
force-pushed
the
seal-2035-mw-m3b-close-cancel
branch
2 times, most recently
from
August 16, 2026 15:50
4182620 to
e183165
Compare
…EA-2035 M3b) When a webview window closes, cancel every in-flight bridge call registered to it so no call's pump goroutine or server-side subscription leaks for the app's lifetime. Without this, closing a window left its two app-lifetime streams live forever, and the user can open and close arbitrarily many windows (A4, F-close). The bridge service gains CancelWindow(windowDispatcher): under the same lock discipline as compass_rpc_cancel it collects and drops every inflightCall whose stored per-call window handle equals the closing window, then cancels each outside the lock. The window handle is the comparable windowDispatcher value M3 already captures on the inflightCall, so matching is a plain interface compare and no compass.v1 knowledge enters the shell (thin-shell safe); the cancel drives the same id-keyed teardown sink, so a canceled pump stops silently and the server-side subscription terminates. A nil window matches nothing, so windowless/fallback calls are never swept by a close. The close handler is attached inside the newAppWindow factory (gtk3-tagged main.go) via OnWindowEvent(WindowClosing, ...), so every window — the New Window menu and the restore loop alike — gets the leak gate and it cannot be forgotten at a call site. The factory's return value (the M1 seam) is now consumed here, so its return type and the unparam suppression are removed. bridge_service.go stays //go:build unix and application-free; only the handler wiring imports the Wails events package. Tests (unix-tagged, no webview): one service holds three long-lived calls — two on distinct windows and one windowless — kept in-flight by a blocking stub; CancelWindow(closing) sweeps only that window's call while the other window's and the windowless call stay live, and CancelWindow(nil) sweeps nothing. Event-gated on channels, no sleeps, race-clean. Spec-impact: implements docs/designs/product/compass-multi-window/design.md §M3b (close-time cancel of a window's in-flight calls); no spec change. Ledger-impact: none. Co-authored-by: Matt Wilkinson <matt@rigel.build>
rigel-mintaka
force-pushed
the
seal-2035-mw-m3b-close-cancel
branch
from
August 17, 2026 18:47
e183165 to
224e9b2
Compare
|
Compass engineering docs preview: https://seal-2035-mw-m3b-close-cance.compass-eng-docs.pages.dev Deployed from |
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:
mainWhen a webview window closes, cancel every in-flight bridge call
registered to it so no call's pump goroutine or server-side subscription
leaks for the app's lifetime. Without this, closing a window left its two
app-lifetime streams live forever, and the user can open and close
arbitrarily many windows (A4, F-close).
The bridge service gains CancelWindow(windowDispatcher): under the same
lock discipline as compass_rpc_cancel it collects and drops every
inflightCall whose stored per-call window handle equals the closing
window, then cancels each outside the lock. The window handle is the
comparable windowDispatcher value M3 already captures on the
inflightCall, so matching is a plain interface compare and no compass.v1
knowledge enters the shell (thin-shell safe); the cancel drives the same
id-keyed teardown sink, so a canceled pump stops silently and the
server-side subscription terminates. A nil window matches nothing, so
windowless/fallback calls are never swept by a close.
The close handler is attached inside the newAppWindow factory
(gtk3-tagged main.go) via OnWindowEvent(WindowClosing, ...), so every
window — the New Window menu and the restore loop alike — gets the leak
gate and it cannot be forgotten at a call site. The factory's return
value (the M1 seam) is now consumed here, so its return type and the
unparam suppression are removed. bridge_service.go stays //go:build unix
and application-free; only the handler wiring imports the Wails events
package.
Tests (unix-tagged, no webview): one service holds three long-lived
calls — two on distinct windows and one windowless — kept in-flight by a
blocking stub; CancelWindow(closing) sweeps only that window's call while
the other window's and the windowless call stay live, and CancelWindow(nil)
sweeps nothing. Event-gated on channels, no sleeps, race-clean.
Spec-impact: implements docs/designs/product/compass-multi-window/design.md
§M3b (close-time cancel of a window's in-flight calls); no spec change.
Ledger-impact: none.
Co-authored-by: Matt Wilkinson matt@rigel.build