From 1e1293cc0a31205d07bad555e2caa944046c800d Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 8 Jan 2026 02:36:29 +0000 Subject: [PATCH] style: swiftformat sweep --- Swabble/Sources/SwabbleKit/WakeWordGate.swift | 22 +++++++-------- .../SwabbleKitTests/WakeWordGateTests.swift | 2 +- .../Tests/CameraControllerErrorTests.swift | 3 +- .../ios/Tests/VoiceWakeGatewaySyncTests.swift | 1 - .../VoiceWakeManagerExtractCommandTests.swift | 2 +- .../Tests/VoiceWakeManagerStateTests.swift | 2 +- .../Sources/Clawdbot/RemotePortTunnel.swift | 4 +-- .../AgentEventStoreTests.swift | 2 +- .../AnthropicOAuthCodeStateTests.swift | 1 - .../CameraCaptureServiceTests.swift | 1 - .../ClawdbotIPCTests/CameraIPCTests.swift | 1 - .../CanvasWindowSmokeTests.swift | 6 ++-- .../ClawdbotIPCTests/ConfigStoreTests.swift | 12 +++----- .../ClawdbotIPCTests/CronModelsTests.swift | 2 +- .../DeviceModelCatalogTests.swift | 6 ++-- .../GatewayAgentChannelTests.swift | 1 - .../GatewayAutostartPolicyTests.swift | 1 - .../GatewayDiscoveryModelTests.swift | 4 +-- .../LowCoverageHelperTests.swift | 22 +++++++-------- .../LowCoverageViewSmokeTests.swift | 2 +- .../MacNodeBridgeDiscoveryTests.swift | 2 +- .../MacNodeRuntimeTests.swift | 6 ++-- .../ModelCatalogLoaderTests.swift | 1 - .../NodeManagerPathsTests.swift | 1 - .../NodePairingReconcilePolicyTests.swift | 2 +- .../OnboardingWizardStepViewTests.swift | 2 +- .../PermissionManagerTests.swift | 2 +- .../ScreenshotSizeTests.swift | 1 - .../ClawdbotIPCTests/SessionDataTests.swift | 2 +- .../SkillsSettingsSmokeTests.swift | 2 +- .../TalkAudioPlayerTests.swift | 6 ++-- .../ClawdbotIPCTests/TestIsolation.swift | 4 +-- .../VoiceWakeOverlayViewSmokeTests.swift | 1 - .../VoiceWakeRuntimeTests.swift | 2 +- .../VoiceWakeTesterTests.swift | 2 +- .../WorkActivityStoreTests.swift | 2 +- .../AssistantTextParserTests.swift | 2 +- .../BonjourEscapesTests.swift | 1 - .../ClawdbotKitTests/CanvasA2UITests.swift | 1 - .../CanvasSnapshotFormatTests.swift | 1 - .../ClawdbotKitTests/ChatThemeTests.swift | 2 +- .../ClawdbotKitTests/ChatViewModelTests.swift | 28 ++++++++++++------- .../JPEGTranscoderTests.swift | 3 +- .../TalkPromptBuilderTests.swift | 1 - 44 files changed, 85 insertions(+), 89 deletions(-) diff --git a/Swabble/Sources/SwabbleKit/WakeWordGate.swift b/Swabble/Sources/SwabbleKit/WakeWordGate.swift index 6957f7a63..5a93a1316 100644 --- a/Swabble/Sources/SwabbleKit/WakeWordGate.swift +++ b/Swabble/Sources/SwabbleKit/WakeWordGate.swift @@ -13,7 +13,7 @@ public struct WakeWordSegment: Sendable, Equatable { self.range = range } - public var end: TimeInterval { self.start + self.duration } + public var end: TimeInterval { start + duration } } public struct WakeWordGateConfig: Sendable, Equatable { @@ -62,10 +62,10 @@ public enum WakeWordGate { segments: [WakeWordSegment], config: WakeWordGateConfig) -> WakeWordGateMatch? { - let triggerTokens = self.normalizeTriggers(config.triggers) + let triggerTokens = normalizeTriggers(config.triggers) guard !triggerTokens.isEmpty else { return nil } - let tokens = self.normalizeSegments(segments) + let tokens = normalizeSegments(segments) guard !tokens.isEmpty else { return nil } var best: (index: Int, triggerEnd: TimeInterval, gap: TimeInterval)? @@ -89,7 +89,7 @@ public enum WakeWordGate { } guard let best else { return nil } - let command = self.commandText(transcript: transcript, segments: segments, triggerEndTime: best.triggerEnd) + let command = commandText(transcript: transcript, segments: segments, triggerEndTime: best.triggerEnd) .trimmingCharacters(in: Self.whitespaceAndPunctuation) guard command.count >= config.minCommandLength else { return nil } return WakeWordGateMatch(triggerEndTime: best.triggerEnd, postGap: best.gap, command: command) @@ -111,7 +111,7 @@ public enum WakeWordGate { } let text = segments - .filter { $0.start >= threshold && !self.normalizeToken($0.text).isEmpty } + .filter { $0.start >= threshold && !normalizeToken($0.text).isEmpty } .map(\.text) .joined(separator: " ") return text.trimmingCharacters(in: Self.whitespaceAndPunctuation) @@ -121,7 +121,7 @@ public enum WakeWordGate { guard !text.isEmpty else { return false } let normalized = text.lowercased() for trigger in triggers { - let token = trigger.trimmingCharacters(in: self.whitespaceAndPunctuation).lowercased() + let token = trigger.trimmingCharacters(in: whitespaceAndPunctuation).lowercased() if token.isEmpty { continue } if normalized.contains(token) { return true } } @@ -131,11 +131,11 @@ public enum WakeWordGate { public static func stripWake(text: String, triggers: [String]) -> String { var out = text for trigger in triggers { - let token = trigger.trimmingCharacters(in: self.whitespaceAndPunctuation) + let token = trigger.trimmingCharacters(in: whitespaceAndPunctuation) guard !token.isEmpty else { continue } out = out.replacingOccurrences(of: token, with: "", options: [.caseInsensitive]) } - return out.trimmingCharacters(in: self.whitespaceAndPunctuation) + return out.trimmingCharacters(in: whitespaceAndPunctuation) } private static func normalizeTriggers(_ triggers: [String]) -> [TriggerTokens] { @@ -143,7 +143,7 @@ public enum WakeWordGate { for trigger in triggers { let tokens = trigger .split(whereSeparator: { $0.isWhitespace }) - .map { self.normalizeToken(String($0)) } + .map { normalizeToken(String($0)) } .filter { !$0.isEmpty } if tokens.isEmpty { continue } output.append(TriggerTokens(tokens: tokens)) @@ -153,7 +153,7 @@ public enum WakeWordGate { private static func normalizeSegments(_ segments: [WakeWordSegment]) -> [Token] { segments.compactMap { segment in - let normalized = self.normalizeToken(segment.text) + let normalized = normalizeToken(segment.text) guard !normalized.isEmpty else { return nil } return Token( normalized: normalized, @@ -166,7 +166,7 @@ public enum WakeWordGate { private static func normalizeToken(_ token: String) -> String { token - .trimmingCharacters(in: self.whitespaceAndPunctuation) + .trimmingCharacters(in: whitespaceAndPunctuation) .lowercased() } diff --git a/Swabble/Tests/SwabbleKitTests/WakeWordGateTests.swift b/Swabble/Tests/SwabbleKitTests/WakeWordGateTests.swift index b2530f64c..5cc283c35 100644 --- a/Swabble/Tests/SwabbleKitTests/WakeWordGateTests.swift +++ b/Swabble/Tests/SwabbleKitTests/WakeWordGateTests.swift @@ -1,6 +1,6 @@ import Foundation -import Testing import SwabbleKit +import Testing @Suite struct WakeWordGateTests { @Test func matchRequiresGapAfterTrigger() { diff --git a/apps/ios/Tests/CameraControllerErrorTests.swift b/apps/ios/Tests/CameraControllerErrorTests.swift index c2c3a7934..a9459a64f 100644 --- a/apps/ios/Tests/CameraControllerErrorTests.swift +++ b/apps/ios/Tests/CameraControllerErrorTests.swift @@ -5,7 +5,8 @@ import Testing @Test func errorDescriptionsAreStable() { #expect(CameraController.CameraError.cameraUnavailable.errorDescription == "Camera unavailable") #expect(CameraController.CameraError.microphoneUnavailable.errorDescription == "Microphone unavailable") - #expect(CameraController.CameraError.permissionDenied(kind: "Camera").errorDescription == "Camera permission denied") + #expect(CameraController.CameraError.permissionDenied(kind: "Camera") + .errorDescription == "Camera permission denied") #expect(CameraController.CameraError.invalidParams("bad").errorDescription == "bad") #expect(CameraController.CameraError.captureFailed("nope").errorDescription == "nope") #expect(CameraController.CameraError.exportFailed("export").errorDescription == "export") diff --git a/apps/ios/Tests/VoiceWakeGatewaySyncTests.swift b/apps/ios/Tests/VoiceWakeGatewaySyncTests.swift index 340e430a3..5ba2c4d8e 100644 --- a/apps/ios/Tests/VoiceWakeGatewaySyncTests.swift +++ b/apps/ios/Tests/VoiceWakeGatewaySyncTests.swift @@ -20,4 +20,3 @@ import Testing #expect(triggers == nil) } } - diff --git a/apps/ios/Tests/VoiceWakeManagerExtractCommandTests.swift b/apps/ios/Tests/VoiceWakeManagerExtractCommandTests.swift index 92651837e..9e755593f 100644 --- a/apps/ios/Tests/VoiceWakeManagerExtractCommandTests.swift +++ b/apps/ios/Tests/VoiceWakeManagerExtractCommandTests.swift @@ -1,6 +1,6 @@ import Foundation -import Testing import SwabbleKit +import Testing @testable import Clawdbot @Suite struct VoiceWakeManagerExtractCommandTests { diff --git a/apps/ios/Tests/VoiceWakeManagerStateTests.swift b/apps/ios/Tests/VoiceWakeManagerStateTests.swift index a89ae3eda..276ed6c63 100644 --- a/apps/ios/Tests/VoiceWakeManagerStateTests.swift +++ b/apps/ios/Tests/VoiceWakeManagerStateTests.swift @@ -1,6 +1,6 @@ import Foundation -import Testing import SwabbleKit +import Testing @testable import Clawdbot @Suite(.serialized) struct VoiceWakeManagerStateTests { diff --git a/apps/macos/Sources/Clawdbot/RemotePortTunnel.swift b/apps/macos/Sources/Clawdbot/RemotePortTunnel.swift index a241f19c6..4b8bcbe83 100644 --- a/apps/macos/Sources/Clawdbot/RemotePortTunnel.swift +++ b/apps/macos/Sources/Clawdbot/RemotePortTunnel.swift @@ -55,8 +55,8 @@ final class RemotePortTunnel { let sshHost = parsed.host.trimmingCharacters(in: .whitespacesAndNewlines) let remotePortOverride = allowRemoteUrlOverride && remotePort == GatewayEnvironment.gatewayPort() - ? Self.resolveRemotePortOverride(for: sshHost) - : nil + ? Self.resolveRemotePortOverride(for: sshHost) + : nil let resolvedRemotePort = remotePortOverride ?? remotePort if let override = remotePortOverride { Self.logger.info( diff --git a/apps/macos/Tests/ClawdbotIPCTests/AgentEventStoreTests.swift b/apps/macos/Tests/ClawdbotIPCTests/AgentEventStoreTests.swift index 1b0e75207..545adca2d 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/AgentEventStoreTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/AgentEventStoreTests.swift @@ -1,6 +1,6 @@ +import ClawdbotProtocol import Foundation import Testing -import ClawdbotProtocol @testable import Clawdbot @Suite diff --git a/apps/macos/Tests/ClawdbotIPCTests/AnthropicOAuthCodeStateTests.swift b/apps/macos/Tests/ClawdbotIPCTests/AnthropicOAuthCodeStateTests.swift index 3473c6c91..0db0f4617 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/AnthropicOAuthCodeStateTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/AnthropicOAuthCodeStateTests.swift @@ -29,4 +29,3 @@ struct AnthropicOAuthCodeStateTests { #expect(parsed == .init(code: "abcDEF1234", state: "stateXYZ9876")) } } - diff --git a/apps/macos/Tests/ClawdbotIPCTests/CameraCaptureServiceTests.swift b/apps/macos/Tests/ClawdbotIPCTests/CameraCaptureServiceTests.swift index 5be9dd574..1722dc56f 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/CameraCaptureServiceTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/CameraCaptureServiceTests.swift @@ -19,4 +19,3 @@ import Testing #expect(high.quality == 1.0) } } - diff --git a/apps/macos/Tests/ClawdbotIPCTests/CameraIPCTests.swift b/apps/macos/Tests/ClawdbotIPCTests/CameraIPCTests.swift index b12b0918d..d6947feb3 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/CameraIPCTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/CameraIPCTests.swift @@ -59,4 +59,3 @@ import Testing } } } - diff --git a/apps/macos/Tests/ClawdbotIPCTests/CanvasWindowSmokeTests.swift b/apps/macos/Tests/ClawdbotIPCTests/CanvasWindowSmokeTests.swift index 6820e36d7..1168802b2 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/CanvasWindowSmokeTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/CanvasWindowSmokeTests.swift @@ -8,7 +8,8 @@ import Testing @MainActor struct CanvasWindowSmokeTests { @Test func panelControllerShowsAndHides() async throws { - let root = FileManager.default.temporaryDirectory.appendingPathComponent("clawdbot-canvas-test-\(UUID().uuidString)") + let root = FileManager.default.temporaryDirectory + .appendingPathComponent("clawdbot-canvas-test-\(UUID().uuidString)") try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true) defer { try? FileManager.default.removeItem(at: root) } @@ -30,7 +31,8 @@ struct CanvasWindowSmokeTests { } @Test func windowControllerShowsAndCloses() async throws { - let root = FileManager.default.temporaryDirectory.appendingPathComponent("clawdbot-canvas-test-\(UUID().uuidString)") + let root = FileManager.default.temporaryDirectory + .appendingPathComponent("clawdbot-canvas-test-\(UUID().uuidString)") try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true) defer { try? FileManager.default.removeItem(at: root) } diff --git a/apps/macos/Tests/ClawdbotIPCTests/ConfigStoreTests.swift b/apps/macos/Tests/ClawdbotIPCTests/ConfigStoreTests.swift index e309703c2..9c702755f 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/ConfigStoreTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/ConfigStoreTests.swift @@ -10,8 +10,7 @@ struct ConfigStoreTests { await ConfigStore._testSetOverrides(.init( isRemoteMode: { true }, loadLocal: { localHit = true; return ["local": true] }, - loadRemote: { remoteHit = true; return ["remote": true] } - )) + loadRemote: { remoteHit = true; return ["remote": true] })) let result = await ConfigStore.load() @@ -27,8 +26,7 @@ struct ConfigStoreTests { await ConfigStore._testSetOverrides(.init( isRemoteMode: { false }, loadLocal: { localHit = true; return ["local": true] }, - loadRemote: { remoteHit = true; return ["remote": true] } - )) + loadRemote: { remoteHit = true; return ["remote": true] })) let result = await ConfigStore.load() @@ -44,8 +42,7 @@ struct ConfigStoreTests { await ConfigStore._testSetOverrides(.init( isRemoteMode: { true }, saveLocal: { _ in localHit = true }, - saveRemote: { _ in remoteHit = true } - )) + saveRemote: { _ in remoteHit = true })) try await ConfigStore.save(["remote": true]) @@ -60,8 +57,7 @@ struct ConfigStoreTests { await ConfigStore._testSetOverrides(.init( isRemoteMode: { false }, saveLocal: { _ in localHit = true }, - saveRemote: { _ in remoteHit = true } - )) + saveRemote: { _ in remoteHit = true })) try await ConfigStore.save(["local": true]) diff --git a/apps/macos/Tests/ClawdbotIPCTests/CronModelsTests.swift b/apps/macos/Tests/ClawdbotIPCTests/CronModelsTests.swift index 81ef2e96e..0a78674f3 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/CronModelsTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/CronModelsTests.swift @@ -12,7 +12,7 @@ struct CronModelsTests { } @Test func scheduleEveryEncodesAndDecodesWithAnchor() throws { - let schedule = CronSchedule.every(everyMs: 5_000, anchorMs: 10_000) + let schedule = CronSchedule.every(everyMs: 5000, anchorMs: 10000) let data = try JSONEncoder().encode(schedule) let decoded = try JSONDecoder().decode(CronSchedule.self, from: data) #expect(decoded == schedule) diff --git a/apps/macos/Tests/ClawdbotIPCTests/DeviceModelCatalogTests.swift b/apps/macos/Tests/ClawdbotIPCTests/DeviceModelCatalogTests.swift index 985e43e6f..c23c41699 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/DeviceModelCatalogTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/DeviceModelCatalogTests.swift @@ -5,8 +5,10 @@ import Testing struct DeviceModelCatalogTests { @Test func symbolPrefersModelIdentifierPrefixes() { - #expect(DeviceModelCatalog.symbol(deviceFamily: "iPad", modelIdentifier: "iPad16,6", friendlyName: nil) == "ipad") - #expect(DeviceModelCatalog.symbol(deviceFamily: "iPhone", modelIdentifier: "iPhone17,3", friendlyName: nil) == "iphone") + #expect(DeviceModelCatalog + .symbol(deviceFamily: "iPad", modelIdentifier: "iPad16,6", friendlyName: nil) == "ipad") + #expect(DeviceModelCatalog + .symbol(deviceFamily: "iPhone", modelIdentifier: "iPhone17,3", friendlyName: nil) == "iphone") } @Test diff --git a/apps/macos/Tests/ClawdbotIPCTests/GatewayAgentChannelTests.swift b/apps/macos/Tests/ClawdbotIPCTests/GatewayAgentChannelTests.swift index 4664f9484..248712262 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/GatewayAgentChannelTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/GatewayAgentChannelTests.swift @@ -21,4 +21,3 @@ import Testing #expect(GatewayAgentChannel(raw: "unknown") == .last) } } - diff --git a/apps/macos/Tests/ClawdbotIPCTests/GatewayAutostartPolicyTests.swift b/apps/macos/Tests/ClawdbotIPCTests/GatewayAutostartPolicyTests.swift index 1149fccbc..c381121c6 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/GatewayAutostartPolicyTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/GatewayAutostartPolicyTests.swift @@ -29,4 +29,3 @@ struct GatewayAutostartPolicyTests { attachExistingOnly: false)) } } - diff --git a/apps/macos/Tests/ClawdbotIPCTests/GatewayDiscoveryModelTests.swift b/apps/macos/Tests/ClawdbotIPCTests/GatewayDiscoveryModelTests.swift index 16614cfa3..9dbef7601 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/GatewayDiscoveryModelTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/GatewayDiscoveryModelTests.swift @@ -70,7 +70,7 @@ struct GatewayDiscoveryModelTests { "tailnetDns": " peters-mac-studio-1.ts.net ", "sshPort": " 2222 ", "gatewayPort": " 18799 ", - "cliPath": " /opt/clawdbot " + "cliPath": " /opt/clawdbot ", ]) #expect(parsed.lanHost == "studio.local") #expect(parsed.tailnetDns == "peters-mac-studio-1.ts.net") @@ -84,7 +84,7 @@ struct GatewayDiscoveryModelTests { "lanHost": " ", "tailnetDns": "\n", "gatewayPort": "nope", - "sshPort": "nope" + "sshPort": "nope", ]) #expect(parsed.lanHost == nil) #expect(parsed.tailnetDns == nil) diff --git a/apps/macos/Tests/ClawdbotIPCTests/LowCoverageHelperTests.swift b/apps/macos/Tests/ClawdbotIPCTests/LowCoverageHelperTests.swift index 6ee7cc012..49547bd98 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/LowCoverageHelperTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/LowCoverageHelperTests.swift @@ -1,7 +1,7 @@ import AppKit +import ClawdbotProtocol import Foundation import Testing -import ClawdbotProtocol @testable import Clawdbot @@ -98,17 +98,17 @@ struct LowCoverageHelperTests { [ "CLAWDBOT_GATEWAY_BIND": "Lan", "CLAWDBOT_GATEWAY_TOKEN": " secret ", - ]) - { - #expect(GatewayLaunchAgentManager._testPreferredGatewayBind() == "lan") - #expect(GatewayLaunchAgentManager._testPreferredGatewayToken() == "secret") - #expect( - GatewayLaunchAgentManager._testEscapePlistValue("a&b\"'") == - "a&b<c>"'") + ]) { + #expect(GatewayLaunchAgentManager._testPreferredGatewayBind() == "lan") + #expect(GatewayLaunchAgentManager._testPreferredGatewayToken() == "secret") + #expect( + GatewayLaunchAgentManager._testEscapePlistValue("a&b\"'") == + "a&b<c>"'") - #expect(GatewayLaunchAgentManager._testGatewayExecutablePath(bundlePath: "/App") == "/App/Contents/Resources/Relay/clawdbot") - #expect(GatewayLaunchAgentManager._testRelayDir(bundlePath: "/App") == "/App/Contents/Resources/Relay") - } + #expect(GatewayLaunchAgentManager + ._testGatewayExecutablePath(bundlePath: "/App") == "/App/Contents/Resources/Relay/clawdbot") + #expect(GatewayLaunchAgentManager._testRelayDir(bundlePath: "/App") == "/App/Contents/Resources/Relay") + } } @Test func portGuardianParsesListenersAndBuildsReports() { diff --git a/apps/macos/Tests/ClawdbotIPCTests/LowCoverageViewSmokeTests.swift b/apps/macos/Tests/ClawdbotIPCTests/LowCoverageViewSmokeTests.swift index 27aff597e..1ca7c5f97 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/LowCoverageViewSmokeTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/LowCoverageViewSmokeTests.swift @@ -1,7 +1,7 @@ import AppKit +import ClawdbotProtocol import SwiftUI import Testing -import ClawdbotProtocol @testable import Clawdbot diff --git a/apps/macos/Tests/ClawdbotIPCTests/MacNodeBridgeDiscoveryTests.swift b/apps/macos/Tests/ClawdbotIPCTests/MacNodeBridgeDiscoveryTests.swift index 0ba28918a..3863f331c 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/MacNodeBridgeDiscoveryTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/MacNodeBridgeDiscoveryTests.swift @@ -138,7 +138,7 @@ private func waitForListenerReady(_ listener: NWListener, timeoutSeconds: Double switch state { case .ready: finish(.success(())) - case .failed(let err): + case let .failed(err): finish(.failure(err)) case .cancelled: finish(.failure(ListenerTimeoutError())) diff --git a/apps/macos/Tests/ClawdbotIPCTests/MacNodeRuntimeTests.swift b/apps/macos/Tests/ClawdbotIPCTests/MacNodeRuntimeTests.swift index 2dd408f1f..53737e7aa 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/MacNodeRuntimeTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/MacNodeRuntimeTests.swift @@ -15,7 +15,7 @@ struct MacNodeRuntimeTests { @Test func handleInvokeRejectsEmptySystemRun() async throws { let runtime = MacNodeRuntime() let params = ClawdbotSystemRunParams(command: []) - let json = String(data: try JSONEncoder().encode(params), encoding: .utf8) + let json = try String(data: JSONEncoder().encode(params), encoding: .utf8) let response = await runtime.handleInvoke( BridgeInvokeRequest(id: "req-2", command: ClawdbotSystemCommand.run.rawValue, paramsJSON: json)) #expect(response.ok == false) @@ -24,7 +24,7 @@ struct MacNodeRuntimeTests { @Test func handleInvokeRejectsEmptyNotification() async throws { let runtime = MacNodeRuntime() let params = ClawdbotSystemNotifyParams(title: "", body: "") - let json = String(data: try JSONEncoder().encode(params), encoding: .utf8) + let json = try String(data: JSONEncoder().encode(params), encoding: .utf8) let response = await runtime.handleInvoke( BridgeInvokeRequest(id: "req-3", command: ClawdbotSystemCommand.notify.rawValue, paramsJSON: json)) #expect(response.ok == false) @@ -71,7 +71,7 @@ struct MacNodeRuntimeTests { let runtime = MacNodeRuntime(makeMainActorServices: { services }) let params = MacNodeScreenRecordParams(durationMs: 250) - let json = String(data: try JSONEncoder().encode(params), encoding: .utf8) + let json = try String(data: JSONEncoder().encode(params), encoding: .utf8) let response = await runtime.handleInvoke( BridgeInvokeRequest(id: "req-5", command: MacNodeScreenCommand.record.rawValue, paramsJSON: json)) #expect(response.ok == true) diff --git a/apps/macos/Tests/ClawdbotIPCTests/ModelCatalogLoaderTests.swift b/apps/macos/Tests/ClawdbotIPCTests/ModelCatalogLoaderTests.swift index c14969d75..d446dad64 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/ModelCatalogLoaderTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/ModelCatalogLoaderTests.swift @@ -51,4 +51,3 @@ struct ModelCatalogLoaderTests { #expect(choices.isEmpty) } } - diff --git a/apps/macos/Tests/ClawdbotIPCTests/NodeManagerPathsTests.swift b/apps/macos/Tests/ClawdbotIPCTests/NodeManagerPathsTests.swift index 081a85c1f..1300cbf7e 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/NodeManagerPathsTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/NodeManagerPathsTests.swift @@ -43,4 +43,3 @@ import Testing #expect(!bins.contains(missingNodeBin.path)) } } - diff --git a/apps/macos/Tests/ClawdbotIPCTests/NodePairingReconcilePolicyTests.swift b/apps/macos/Tests/ClawdbotIPCTests/NodePairingReconcilePolicyTests.swift index bf782fa41..a53cc9d22 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/NodePairingReconcilePolicyTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/NodePairingReconcilePolicyTests.swift @@ -9,6 +9,6 @@ import Testing } @Test func policyUsesSlowSafetyInterval() { - #expect(NodePairingReconcilePolicy.activeIntervalMs >= 10_000) + #expect(NodePairingReconcilePolicy.activeIntervalMs >= 10000) } } diff --git a/apps/macos/Tests/ClawdbotIPCTests/OnboardingWizardStepViewTests.swift b/apps/macos/Tests/ClawdbotIPCTests/OnboardingWizardStepViewTests.swift index 52d405177..7fd9b9929 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/OnboardingWizardStepViewTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/OnboardingWizardStepViewTests.swift @@ -1,6 +1,6 @@ +import ClawdbotProtocol import SwiftUI import Testing -import ClawdbotProtocol @testable import Clawdbot @Suite(.serialized) diff --git a/apps/macos/Tests/ClawdbotIPCTests/PermissionManagerTests.swift b/apps/macos/Tests/ClawdbotIPCTests/PermissionManagerTests.swift index d6c04d9e9..a5f210661 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/PermissionManagerTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/PermissionManagerTests.swift @@ -1,6 +1,6 @@ -import Testing import ClawdbotIPC import CoreLocation +import Testing @testable import Clawdbot @Suite(.serialized) diff --git a/apps/macos/Tests/ClawdbotIPCTests/ScreenshotSizeTests.swift b/apps/macos/Tests/ClawdbotIPCTests/ScreenshotSizeTests.swift index 874334d37..da983b77e 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/ScreenshotSizeTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/ScreenshotSizeTests.swift @@ -19,4 +19,3 @@ struct ScreenshotSizeTests { #expect(ScreenshotSize.readPNGSize(data: Data("nope".utf8)) == nil) } } - diff --git a/apps/macos/Tests/ClawdbotIPCTests/SessionDataTests.swift b/apps/macos/Tests/ClawdbotIPCTests/SessionDataTests.swift index d52c9aecb..348dd9673 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/SessionDataTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/SessionDataTests.swift @@ -14,7 +14,7 @@ struct SessionDataTests { @Test func sessionTokenStatsFormatKTokensRoundsAsExpected() { #expect(SessionTokenStats.formatKTokens(999) == "999") #expect(SessionTokenStats.formatKTokens(1000) == "1.0k") - #expect(SessionTokenStats.formatKTokens(12_340) == "12k") + #expect(SessionTokenStats.formatKTokens(12340) == "12k") } @Test func sessionTokenStatsPercentUsedClampsTo100() { diff --git a/apps/macos/Tests/ClawdbotIPCTests/SkillsSettingsSmokeTests.swift b/apps/macos/Tests/ClawdbotIPCTests/SkillsSettingsSmokeTests.swift index f2d8a61bf..10d85eb0b 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/SkillsSettingsSmokeTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/SkillsSettingsSmokeTests.swift @@ -1,5 +1,5 @@ -import Testing import ClawdbotProtocol +import Testing @testable import Clawdbot @Suite(.serialized) diff --git a/apps/macos/Tests/ClawdbotIPCTests/TalkAudioPlayerTests.swift b/apps/macos/Tests/ClawdbotIPCTests/TalkAudioPlayerTests.swift index 4be67e89f..a42f5616f 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/TalkAudioPlayerTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/TalkAudioPlayerTests.swift @@ -84,13 +84,13 @@ private func makeWav16Mono(sampleRate: UInt32, samples: Int) -> Data { return data } -private extension Data { - mutating func appendLEUInt16(_ value: UInt16) { +extension Data { + fileprivate mutating func appendLEUInt16(_ value: UInt16) { var v = value.littleEndian Swift.withUnsafeBytes(of: &v) { append(contentsOf: $0) } } - mutating func appendLEUInt32(_ value: UInt32) { + fileprivate mutating func appendLEUInt32(_ value: UInt32) { var v = value.littleEndian Swift.withUnsafeBytes(of: &v) { append(contentsOf: $0) } } diff --git a/apps/macos/Tests/ClawdbotIPCTests/TestIsolation.swift b/apps/macos/Tests/ClawdbotIPCTests/TestIsolation.swift index 03c32607f..c15606a06 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/TestIsolation.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/TestIsolation.swift @@ -98,14 +98,14 @@ enum TestIsolation { _ values: [String: String?], _ body: () async throws -> T) async rethrows -> T { - try await Self.withIsolatedState(env: values, defaults: [:], body) + try await self.withIsolatedState(env: values, defaults: [:], body) } static func withUserDefaultsValues( _ values: [String: Any?], _ body: () async throws -> T) async rethrows -> T { - try await Self.withIsolatedState(env: [:], defaults: values, body) + try await self.withIsolatedState(env: [:], defaults: values, body) } nonisolated static func tempConfigPath() -> String { diff --git a/apps/macos/Tests/ClawdbotIPCTests/VoiceWakeOverlayViewSmokeTests.swift b/apps/macos/Tests/ClawdbotIPCTests/VoiceWakeOverlayViewSmokeTests.swift index 18bb05bf7..8724a7475 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/VoiceWakeOverlayViewSmokeTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/VoiceWakeOverlayViewSmokeTests.swift @@ -26,4 +26,3 @@ struct VoiceWakeOverlayViewSmokeTests { _ = view.body } } - diff --git a/apps/macos/Tests/ClawdbotIPCTests/VoiceWakeRuntimeTests.swift b/apps/macos/Tests/ClawdbotIPCTests/VoiceWakeRuntimeTests.swift index af7f819d1..1fa5d85ec 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/VoiceWakeRuntimeTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/VoiceWakeRuntimeTests.swift @@ -1,6 +1,6 @@ import Foundation -import Testing import SwabbleKit +import Testing @testable import Clawdbot @Suite struct VoiceWakeRuntimeTests { diff --git a/apps/macos/Tests/ClawdbotIPCTests/VoiceWakeTesterTests.swift b/apps/macos/Tests/ClawdbotIPCTests/VoiceWakeTesterTests.swift index fdea24e4d..71af58aaa 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/VoiceWakeTesterTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/VoiceWakeTesterTests.swift @@ -1,6 +1,6 @@ import Foundation -import Testing import SwabbleKit +import Testing struct VoiceWakeTesterTests { @Test func matchRespectsGapRequirement() { diff --git a/apps/macos/Tests/ClawdbotIPCTests/WorkActivityStoreTests.swift b/apps/macos/Tests/ClawdbotIPCTests/WorkActivityStoreTests.swift index 983c394b3..5b2d1f4d4 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/WorkActivityStoreTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/WorkActivityStoreTests.swift @@ -1,6 +1,6 @@ +import ClawdbotProtocol import Foundation import Testing -import ClawdbotProtocol @testable import Clawdbot @Suite diff --git a/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/AssistantTextParserTests.swift b/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/AssistantTextParserTests.swift index 0e6e9c561..9483d68b3 100644 --- a/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/AssistantTextParserTests.swift +++ b/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/AssistantTextParserTests.swift @@ -1,5 +1,5 @@ -@testable import ClawdbotChatUI import Testing +@testable import ClawdbotChatUI @Suite struct AssistantTextParserTests { @Test func splitsThinkAndFinalSegments() { diff --git a/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/BonjourEscapesTests.swift b/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/BonjourEscapesTests.swift index db872d429..6894225f2 100644 --- a/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/BonjourEscapesTests.swift +++ b/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/BonjourEscapesTests.swift @@ -24,4 +24,3 @@ import Testing #expect(BonjourEscapes.decode("Hello\\065World") == "HelloAWorld") } } - diff --git a/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/CanvasA2UITests.swift b/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/CanvasA2UITests.swift index b22754aba..0920c1893 100644 --- a/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/CanvasA2UITests.swift +++ b/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/CanvasA2UITests.swift @@ -40,4 +40,3 @@ import Testing } } } - diff --git a/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/CanvasSnapshotFormatTests.swift b/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/CanvasSnapshotFormatTests.swift index 254d7ad1c..19ef4bfee 100644 --- a/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/CanvasSnapshotFormatTests.swift +++ b/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/CanvasSnapshotFormatTests.swift @@ -13,4 +13,3 @@ import Testing #expect(decoded.format == .jpeg) } } - diff --git a/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/ChatThemeTests.swift b/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/ChatThemeTests.swift index 9f5f2e6b5..c3880966e 100644 --- a/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/ChatThemeTests.swift +++ b/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/ChatThemeTests.swift @@ -1,6 +1,6 @@ -@testable import ClawdbotChatUI import Foundation import Testing +@testable import ClawdbotChatUI #if os(macOS) import AppKit diff --git a/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/ChatViewModelTests.swift b/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/ChatViewModelTests.swift index 392866d6d..b8096fab7 100644 --- a/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/ChatViewModelTests.swift +++ b/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/ChatViewModelTests.swift @@ -1,7 +1,7 @@ -@testable import ClawdbotChatUI import ClawdbotKit import Foundation import Testing +@testable import ClawdbotChatUI private struct TimeoutError: Error, CustomStringConvertible { let label: String @@ -118,20 +118,20 @@ private final class TestChatTransport: @unchecked Sendable, ClawdbotChatTranspor } } -private extension TestChatTransportState { - func setHistoryCallCount(_ v: Int) { +extension TestChatTransportState { + fileprivate func setHistoryCallCount(_ v: Int) { self.historyCallCount = v } - func setSessionsCallCount(_ v: Int) { + fileprivate func setSessionsCallCount(_ v: Int) { self.sessionsCallCount = v } - func sentRunIdsAppend(_ v: String) { + fileprivate func sentRunIdsAppend(_ v: String) { self.sentRunIds.append(v) } - func abortedRunIdsAppend(_ v: String) { + fileprivate func abortedRunIdsAppend(_ v: String) { self.abortedRunIds.append(v) } } @@ -177,7 +177,9 @@ private extension TestChatTransportState { ts: Int(Date().timeIntervalSince1970 * 1000), data: ["text": AnyCodable("streaming…")]))) - try await waitUntil("assistant stream visible") { await MainActor.run { vm.streamingAssistantText == "streaming…" } } + try await waitUntil("assistant stream visible") { + await MainActor.run { vm.streamingAssistantText == "streaming…" } + } transport.emit( .agent( @@ -206,7 +208,9 @@ private extension TestChatTransportState { errorMessage: nil))) try await waitUntil("pending run clears") { await MainActor.run { vm.pendingRunCount == 0 } } - try await waitUntil("history refresh") { await MainActor.run { vm.messages.contains(where: { $0.role == "assistant" }) } } + try await waitUntil("history refresh") { + await MainActor.run { vm.messages.contains(where: { $0.role == "assistant" }) } + } #expect(await MainActor.run { vm.streamingAssistantText } == nil) #expect(await MainActor.run { vm.pendingToolCalls.isEmpty }) } @@ -247,7 +251,9 @@ private extension TestChatTransportState { "args": AnyCodable(["x": 1]), ]))) - try await waitUntil("streaming active") { await MainActor.run { vm.streamingAssistantText == "external stream" } } + try await waitUntil("streaming active") { + await MainActor.run { vm.streamingAssistantText == "external stream" } + } try await waitUntil("tool call pending") { await MainActor.run { vm.pendingToolCalls.count == 1 } } transport.emit( @@ -436,7 +442,9 @@ private extension TestChatTransportState { ts: Int(Date().timeIntervalSince1970 * 1000), data: ["text": AnyCodable("external stream")]))) - try await waitUntil("streaming active") { await MainActor.run { vm.streamingAssistantText == "external stream" } } + try await waitUntil("streaming active") { + await MainActor.run { vm.streamingAssistantText == "external stream" } + } transport.emit( .chat( diff --git a/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/JPEGTranscoderTests.swift b/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/JPEGTranscoderTests.swift index d0181bcbd..9f5c1a145 100644 --- a/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/JPEGTranscoderTests.swift +++ b/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/JPEGTranscoderTests.swift @@ -80,7 +80,8 @@ import UniformTypeIdentifiers } let encoded = NSMutableData() - guard let dest = CGImageDestinationCreateWithData(encoded, UTType.jpeg.identifier as CFString, 1, nil) else { + guard let dest = CGImageDestinationCreateWithData(encoded, UTType.jpeg.identifier as CFString, 1, nil) + else { throw NSError(domain: "JPEGTranscoderTests", code: 9) } CGImageDestinationAddImage(dest, img, nil) diff --git a/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/TalkPromptBuilderTests.swift b/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/TalkPromptBuilderTests.swift index 2016ba553..7aa94271b 100644 --- a/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/TalkPromptBuilderTests.swift +++ b/apps/shared/ClawdbotKit/Tests/ClawdbotKitTests/TalkPromptBuilderTests.swift @@ -13,4 +13,3 @@ final class TalkPromptBuilderTests: XCTestCase { XCTAssertTrue(prompt.contains("Assistant speech interrupted at 1.2s.")) } } -