From 742b572ffe36ff7f7738167bea9c45f0b434543c Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 17 Jun 2026 16:04:03 +0000 Subject: [PATCH 1/3] fix(macos): return false from isAppSetupCompleted for empty URL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Claude-Session: https://claude.ai/code/session_01DNR61x1oT6RMjPVdNsYdvE --- desktop/macos/Desktop/Sources/APIClient.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/desktop/macos/Desktop/Sources/APIClient.swift b/desktop/macos/Desktop/Sources/APIClient.swift index 12d7d351ced..abdb862c9fb 100644 --- a/desktop/macos/Desktop/Sources/APIClient.swift +++ b/desktop/macos/Desktop/Sources/APIClient.swift @@ -3158,7 +3158,10 @@ extension APIClient { /// Checks if an external integration app's setup is complete func isAppSetupCompleted(url: String, uid: String) async -> Bool { - guard !url.isEmpty else { return true } + // An empty/unknown completion URL means setup cannot be verified, so report + // not-completed (consistent with the invalid-URL and network-failure paths + // below). Returning true here would wrongly mark an unconfigured app as set up. + guard !url.isEmpty else { return false } guard let fullUrl = URL(string: "\(url)?uid=\(uid)") else { return false } var request = URLRequest(url: fullUrl) request.httpMethod = "GET" From 29e190aaab5b320ab53c78faa9085a406ec7dbcb Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 17 Jun 2026 16:04:09 +0000 Subject: [PATCH 2/3] test(macos): cover empty-URL contract for isAppSetupCompleted 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 Claude-Session: https://claude.ai/code/session_01DNR61x1oT6RMjPVdNsYdvE --- .../Tests/APIClientSetupCompletedTests.swift | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 desktop/macos/Desktop/Tests/APIClientSetupCompletedTests.swift diff --git a/desktop/macos/Desktop/Tests/APIClientSetupCompletedTests.swift b/desktop/macos/Desktop/Tests/APIClientSetupCompletedTests.swift new file mode 100644 index 00000000000..0501da5b284 --- /dev/null +++ b/desktop/macos/Desktop/Tests/APIClientSetupCompletedTests.swift @@ -0,0 +1,18 @@ +import XCTest + +@testable import Omi_Computer + +/// Regression coverage for `APIClient.isAppSetupCompleted(url:uid:)`. +/// +/// An empty completion URL means setup cannot be verified, so the method must +/// report `false` (not-completed) — matching its invalid-URL and +/// network-failure paths. A previous `return true` would wrongly mark an +/// unconfigured external integration app as already set up. The empty-URL case +/// short-circuits before any network request, so this needs no HTTP mocking. +final class APIClientSetupCompletedTests: XCTestCase { + + func testEmptyURLReportsNotCompleted() async { + let completed = await APIClient.shared.isAppSetupCompleted(url: "", uid: "test-uid") + XCTAssertFalse(completed, "An empty completion URL must report setup as NOT completed") + } +} From 4a65c2d23dbbce760ccd3cb72afc8afc9283cb83 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 17 Jun 2026 18:50:38 +0000 Subject: [PATCH 3/3] style(macos): use 4-space indentation in APIClientSetupCompletedTests Match the established Desktop test-suite convention (4-space indentation), per review feedback. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01DNR61x1oT6RMjPVdNsYdvE --- .../Desktop/Tests/APIClientSetupCompletedTests.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/desktop/macos/Desktop/Tests/APIClientSetupCompletedTests.swift b/desktop/macos/Desktop/Tests/APIClientSetupCompletedTests.swift index 0501da5b284..3f2676bbd69 100644 --- a/desktop/macos/Desktop/Tests/APIClientSetupCompletedTests.swift +++ b/desktop/macos/Desktop/Tests/APIClientSetupCompletedTests.swift @@ -11,8 +11,8 @@ import XCTest /// short-circuits before any network request, so this needs no HTTP mocking. final class APIClientSetupCompletedTests: XCTestCase { - func testEmptyURLReportsNotCompleted() async { - let completed = await APIClient.shared.isAppSetupCompleted(url: "", uid: "test-uid") - XCTAssertFalse(completed, "An empty completion URL must report setup as NOT completed") - } + func testEmptyURLReportsNotCompleted() async { + let completed = await APIClient.shared.isAppSetupCompleted(url: "", uid: "test-uid") + XCTAssertFalse(completed, "An empty completion URL must report setup as NOT completed") + } }