fix(macos): return false from isAppSetupCompleted for empty URL#7999
Open
eulicesl wants to merge 3 commits into
Open
fix(macos): return false from isAppSetupCompleted for empty URL#7999eulicesl wants to merge 3 commits into
eulicesl wants to merge 3 commits into
Conversation
An empty/unknown completion URL means setup cannot be verified, so the method must report not-completed — consistent with its invalid-URL and network-failure paths. The previous `return true` would wrongly mark an unconfigured external integration app as already set up (and auto-enable it). Current callers in AppsPage already guard against empty URLs, so this corrects a latent default with no change to existing runtime behavior. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DNR61x1oT6RMjPVdNsYdvE
Adds a regression test asserting isAppSetupCompleted(url: "", uid:) returns false. The empty-URL case short-circuits before any network request, so the test needs no HTTP mocking. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DNR61x1oT6RMjPVdNsYdvE
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a latent correctness issue in the macOS desktop APIClient.isAppSetupCompleted(url:uid:) helper by returning false (not completed) when passed an empty completion URL, aligning it with the method’s other failure paths and preventing accidental auto-enablement of unconfigured integrations.
Changes:
- Flip the empty-URL early return in
isAppSetupCompleted(url:uid:)fromtruetofalse, with an explanatory comment. - Add a regression unit test asserting the empty-URL contract (no network mocking needed due to short-circuiting).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
desktop/macos/Desktop/Sources/APIClient.swift |
Corrects empty-URL behavior in isAppSetupCompleted(url:uid:) to return false consistently with other failure paths. |
desktop/macos/Desktop/Tests/APIClientSetupCompletedTests.swift |
Adds regression coverage for the empty-URL behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Match the established Desktop test-suite convention (4-space indentation), per review feedback. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DNR61x1oT6RMjPVdNsYdvE
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.
Summary
Fixes a latent correctness bug in
APIClient.isAppSetupCompleted(url:uid:)(macOS desktop app). When passed an empty URL, the method returnedtrue("setup completed") — the wrong default. An empty/unknown URL means setup cannot be verified, so the safe answer isfalse, consistent with every other failure path in the method (invalid URL, network error, missing/falseJSON field all returnfalse).Returning
truewould, if reached, wrongly mark an unconfigured external integration app as already set up and auto-enable it.Why this is safe
Both current callers in
MainWindow/Pages/AppsPage.swiftalready guard!completionUrl.isEmptybefore calling this method (lines ~2710 and ~2777), so the bad branch is not reachable from existing callers. This means the fix:Changes
desktop/macos/Desktop/Sources/APIClient.swift—guard !url.isEmpty else { return true }→return false(+ explanatory comment).desktop/macos/Desktop/Tests/APIClientSetupCompletedTests.swift(new) — regression test asserting the empty-URL contract. The empty-URL case short-circuits before any network request, so no HTTP mocking is needed.Testing
CHANGELOG.jsonentry: internal-only correctness fix with no user-visible behavior change (perdesktop/macos/AGENTS.md"skip internal-only changes").Overlap check
No conflict with any open or recently merged PR. The only other open PR touching
APIClient.swiftis #7673 (trial opt-in), which edits a different method ~800 lines away — merges cleanly.🤖 Generated with Claude Code
Generated by Claude Code