fix(macos): return false from isAppSetupCompleted for empty URL#7999
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. |
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
kodjima33
left a comment
There was a problem hiding this comment.
Desktop/macOS bug fix: empty completion URL must report setup NOT completed (matches every other failure path); has regression test. Owner-override merge.
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