Stop the test suite popping the 'no application to open the URL' dialog - #224
Merged
Merged
Conversation
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.
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
Every
xcodebuild testrun popped a macOS dialog on the developer's machine:Root cause
AuthPortForwardingTests.onlySchemeCarryingUnknownURLsAreIntercepteddrivesGhosttyRuntime.handleActionwith a real open-url action whose URL uses the unclaimed test-only schemex-graphcode-test.handleActionhanded every intercepted link straight toNSWorkspace.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.openURLis now an injectable closure, defaulting to the sameNSWorkspace.shared.open— zero behavior change in the app.Verification
xcodebuild testfrom a worktree: 1293 tests, TEST SUCCEEDED — and dialog-free.swiftlint lint: 0 serious (128 standing warnings, unchanged).swift format lintclean on both files.