Skip to content

Stop the test suite popping the 'no application to open the URL' dialog - #224

Merged
scgopi merged 1 commit into
mainfrom
fix/test-url-dialog
Aug 30, 2026
Merged

scgopi merged 1 commit into
mainfrom
fix/test-url-dialog

Conversation

@scgopi

@scgopi scgopi commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Problem

Every xcodebuild test run popped a macOS dialog on the developer's machine:

There is no application set to open the URL x-graphcode-test://sign-in.

Root cause

AuthPortForwardingTests.onlySchemeCarryingUnknownURLsAreIntercepted drives GhosttyRuntime.handleAction with a real open-url action whose URL uses the unclaimed test-only scheme x-graphcode-test. handleAction handed every intercepted link straight to NSWorkspace.shared.open, so each test run sent that URL to LaunchServices, which popped the dialog. The test's own comment acknowledged the side effect ('the open attempt resolves to no application') — it was baked in, and recurred on every verification pass, including every graphcode worktree loop that runs the suite.

Fix

  • GhosttyRuntime.openURL is now an injectable closure, defaulting to the same NSWorkspace.shared.open — zero behavior change in the app.
  • The test installs a recorder and asserts the intercepted URL reaches the opener (previously untestable), then restores the system opener.

Verification

  • xcodebuild test from a worktree: 1293 tests, TEST SUCCEEDED — and dialog-free.
  • swiftlint lint: 0 serious (128 standing warnings, unchanged). swift format lint clean on both files.

Every xcodebuild test run executed AuthPortForwardingTests, which drove
GhosttyRuntime.handleAction with a real x-graphcode-test://sign-in open;
handleAction passed it straight to NSWorkspace.shared.open, and since
nothing claims that scheme LaunchServices popped its 'no application set
to open the URL' dialog once per run — again and again as worktree loops
verify their work. The opener is now an injectable closure (still
NSWorkspace in the app) and the test installs a recorder, which also lets
it assert the intercepted URL actually reaches the opener.
@scgopi
scgopi merged commit 36d48f0 into main Aug 30, 2026
1 check passed
@scgopi
scgopi deleted the fix/test-url-dialog branch August 30, 2026 16:16
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.

1 participant