fix(open-url): flag when a web URL may open the browser instead of an app#476
Draft
latekvo wants to merge 1 commit into
Draft
fix(open-url): flag when a web URL may open the browser instead of an app#476latekvo wants to merge 1 commit into
latekvo wants to merge 1 commit into
Conversation
… app open-url on iOS is a thin wrapper over `xcrun simctl openurl`. Given an https Universal Link (e.g. https://bsky.app/profile/...), the simulator routes it to Safari rather than deep-linking into the app: Universal Links only reach an installed, domain-verified app, and simctl openurl is unreliable at that even when the app IS installed. The result was always `{ opened: true }`, so a web URL that silently fell back to Safari looked identical to a successful deep-link and misled callers into thinking the native app had been reached. Add a `note` to the result (and a matching description caveat) whenever a web URL (http/https) is opened on a native device, pointing callers at the reliable path: the app's custom scheme (scheme://path) or launch-app with its bundle id. Custom schemes and Chromium navigations are unaffected.
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.
Problem
An agent calling
open-urlto deep-link into an app gets Safari instead:Root cause (not a wrapper bug — an iOS Simulator limitation)
open-urlon iOS is a thin wrapper overxcrun simctl openurl. Anhttps://URL is a Universal Link, which only reaches a native app when that app is
installed and verified for the link's domain. Two things bite here:
simctl openurlroutes Universal Links to Safarieven when the owning app is installed — a long-standing, documented
limitation. Custom URL schemes (
scheme://…) route reliably; UniversalLinks do not.
the only valid handler — identical to tapping the link on a real iPhone with
Bluesky absent.
Reproduced on a booted iOS 18.5 sim:
simctl openurl <bsky https link>launches
com.apple.mobilesafari; the sim has zero third-party apps installed;bluesky://…fails with-10814(no registered handler), confirming absence.The real defect on our side: the result was always
{ opened: true }, so aweb URL that silently fell back to Safari was indistinguishable from a
successful deep-link — the caller (an agent) believed it had reached the native
app. There is no reliable way to observe which app actually handled the URL
(Safari and other apps are invisible to the native-devtools socket), so the fix
makes the ambiguity explicit rather than guessing.
Fix
noteto theopen-urlresult whenever a web URL (http/https) is opened on a native device (iOS + iOS-remote). It states the URLmay have opened in the browser and points to the reliable path: the app's
custom scheme (
scheme://path) orlaunch-appwith the bundle id.tel:,maps://,geo:), and Chromiumnavigations are unaffected (no note). No URL rewriting — the URL is still
handed to
simctlunchanged.Scoped to iOS deliberately: Android App Links go through
am startwith adifferent verification/chooser path, and the reported symptom is iOS-specific.
Verification
open-url-deep-link-note.test.ts, 4 cases): the helperreturns the caveat for
http/https(case-insensitive) andundefinedforcustom/non-web schemes; the iOS handler attaches
notefor the bsky httpslink (URL passed to
simctlunchanged) and omits it for a custom scheme.openUrlTool.execute:https://bsky.app/profile/…→{ opened: true, url, note }maps://?q=cupertino(installed native handler) →{ opened: true }, no notebluesky://…(not installed) → correctFailureError(existing behavior)tsc --noEmit,tsc --noEmit -p tsconfig.test.json, andprettier --checkall pass on the changed files.