A library shortcut opened mid-stream alerted "Can't open" instead of focusing the app #256

Merged
enricobuehler merged 1 commits from worktree-browse-link-same-host-focus into main 2026-08-15 21:58:02 +00:00
Owner

Field report

A user keeps a Dock shortcut that opens their host's game library (punktfunk://browse/… — the shape the "Open Game Library" intent and the library widget emit). Opening it while a stream to that same host is running popped the "Can't open: Already streaming X. End that session first." alert — on the very host that's on glass. They just wanted to come back to the app.

Root cause

The deep-link spec (client-deep-links.md, invariant 2) already settles this: streaming the same host → no-op focus; a different host → "End that session first" notice. The connect route has implemented that exception since M0, and the Android client ships it in both its onCreate and onNewIntent paths. The browse route (1fc18451, shipped in 0.29.0) is the one surface that refused on any live session — its own doc comment claimed "a live session is never preempted" while missing the half of that rule that makes the claim true.

Fix

openLibrary now mirrors the connect route's guard verbatim: non-idle with model.activeHost?.id == host.id → silent return. The URL open already foregrounded the app, which is all "focus it" can mean mid-stream; the stream screen owns the glass, so there is no library to present. A link to a different host keeps the refusal notice, and nothing about pin conflicts, profile resolution, or the unsaved-host path changes.

Verification

Full PunktfunkClient macOS target typechecks ("Build complete!"). Note for anyone re-verifying: the checked-in PunktfunkCore.xcframework is stale against main's own Swift again (its header predates punktfunk_connection_end_reject), so a plain swift build fails on main before reaching this change — rebuild the core slice and hand-assemble the bundle first.

## Field report A user keeps a Dock shortcut that opens their host's game library (`punktfunk://browse/…` — the shape the "Open Game Library" intent and the library widget emit). Opening it while a stream to that same host is running popped the **"Can't open: Already streaming X. End that session first."** alert — on the very host that's on glass. They just wanted to come back to the app. ## Root cause The deep-link spec (`client-deep-links.md`, invariant 2) already settles this: *streaming the same host → no-op focus; a different host → "End that session first" notice.* The connect route has implemented that exception since M0, and the Android client ships it in both its `onCreate` and `onNewIntent` paths. The browse route (`1fc18451`, shipped in 0.29.0) is the one surface that refused on **any** live session — its own doc comment claimed "a live session is never preempted" while missing the half of that rule that makes the claim true. ## Fix `openLibrary` now mirrors the connect route's guard verbatim: non-idle with `model.activeHost?.id == host.id` → silent return. The URL open already foregrounded the app, which is all "focus it" can mean mid-stream; the stream screen owns the glass, so there is no library to present. A link to a **different** host keeps the refusal notice, and nothing about pin conflicts, profile resolution, or the unsaved-host path changes. ## Verification Full `PunktfunkClient` macOS target typechecks ("Build complete!"). Note for anyone re-verifying: the checked-in `PunktfunkCore.xcframework` is stale against main's own Swift again (its header predates `punktfunk_connection_end_reject`), so a plain `swift build` fails on main before reaching this change — rebuild the core slice and hand-assemble the bundle first.
enricobuehler added 1 commit 2026-08-15 17:38:40 +00:00
fix(apple): a browse shortcut opened mid-stream alerted instead of focusing the app
ci / web (pull_request) Successful in 1m9s
ci / rust-arm64 (pull_request) Successful in 1m22s
ci / bun-nix (pull_request) Successful in 1m33s
apple / swift (pull_request) Successful in 2m7s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
ci / docs-site (pull_request) Successful in 3m58s
ci / rust (pull_request) Successful in 11m39s
8ef9b18d20
The connect route has always made the same-host exception the deep-link
spec demands (rule 2: streaming the same host -> no-op focus), but the
browse route refused on ANY live session -- so tapping a Dock library
shortcut to come back to a running stream popped "Can't open: Already
streaming X. End that session first." for the very host on glass.
Mirror the connect guard: same host -> the open already foregrounded the
app, which is all focus can mean mid-stream; a different host keeps the
notice. Android shipped this posture from day one; this is Apple parity.
enricobuehler merged commit 1c426dc85f into main 2026-08-15 21:58:02 +00:00
enricobuehler deleted branch worktree-browse-link-same-host-focus 2026-08-15 21:58:08 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: unom/punktfunk#256