Skip to content

Commit 4401ff2

Browse files
authored
refactor(macos): remove final private test seams (#122202)
* test(macos): remove final private test seams * chore(macos): refresh native i18n inventory
1 parent 9fea528 commit 4401ff2

9 files changed

Lines changed: 80 additions & 232 deletions

‎apps/.i18n/native-source.json‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38875,135 +38875,135 @@
3887538875
},
3887638876
{
3887738877
"kind": "ui-call",
38878-
"line": 104,
38878+
"line": 90,
3887938879
"path": "apps/macos/Sources/OpenClaw/TailscaleIntegrationSection.swift",
3888038880
"source": "Tailscale (dashboard access)",
3888138881
"surface": "apple",
3888238882
"id": "native.apple.96bb9bb74999aec3"
3888338883
},
3888438884
{
3888538885
"kind": "ui-call",
38886-
"line": 125,
38886+
"line": 111,
3888738887
"path": "apps/macos/Sources/OpenClaw/TailscaleIntegrationSection.swift",
3888838888
"source": "Local mode required. Update settings on the gateway host.",
3888938889
"surface": "apple",
3889038890
"id": "native.apple.5a382f1b024300a1"
3889138891
},
3889238892
{
3889338893
"kind": "ui-call",
38894-
"line": 170,
38894+
"line": 156,
3889538895
"path": "apps/macos/Sources/OpenClaw/TailscaleIntegrationSection.swift",
3889638896
"source": "Refresh",
3889738897
"surface": "apple",
3889838898
"id": "native.apple.26e0afc4575fbc70"
3889938899
},
3890038900
{
3890138901
"kind": "ui-call",
38902-
"line": 192,
38902+
"line": 178,
3890338903
"path": "apps/macos/Sources/OpenClaw/TailscaleIntegrationSection.swift",
3890438904
"source": "App Store",
3890538905
"surface": "apple",
3890638906
"id": "native.apple.62dcf1a51e15d52a"
3890738907
},
3890838908
{
3890938909
"kind": "ui-call",
38910-
"line": 194,
38910+
"line": 180,
3891138911
"path": "apps/macos/Sources/OpenClaw/TailscaleIntegrationSection.swift",
3891238912
"source": "Direct Download",
3891338913
"surface": "apple",
3891438914
"id": "native.apple.fe89247395645ff4"
3891538915
},
3891638916
{
3891738917
"kind": "ui-call",
38918-
"line": 196,
38918+
"line": 182,
3891938919
"path": "apps/macos/Sources/OpenClaw/TailscaleIntegrationSection.swift",
3892038920
"source": "Setup Guide",
3892138921
"surface": "apple",
3892238922
"id": "native.apple.fc4886c7228bc04f"
3892338923
},
3892438924
{
3892538925
"kind": "ui-call",
38926-
"line": 204,
38926+
"line": 190,
3892738927
"path": "apps/macos/Sources/OpenClaw/TailscaleIntegrationSection.swift",
3892838928
"source": "Exposure mode",
3892938929
"surface": "apple",
3893038930
"id": "native.apple.726161ce2c382170"
3893138931
},
3893238932
{
3893338933
"kind": "ui-call",
38934-
"line": 206,
38934+
"line": 192,
3893538935
"path": "apps/macos/Sources/OpenClaw/TailscaleIntegrationSection.swift",
3893638936
"source": "Exposure",
3893738937
"surface": "apple",
3893838938
"id": "native.apple.fadc7522289dd272"
3893938939
},
3894038940
{
3894138941
"kind": "ui-call",
38942-
"line": 223,
38942+
"line": 209,
3894338943
"path": "apps/macos/Sources/OpenClaw/TailscaleIntegrationSection.swift",
3894438944
"source": "Dashboard URL:",
3894538945
"surface": "apple",
3894638946
"id": "native.apple.657ee675aa5c5d91"
3894738947
},
3894838948
{
3894938949
"kind": "ui-call",
38950-
"line": 235,
38950+
"line": 221,
3895138951
"path": "apps/macos/Sources/OpenClaw/TailscaleIntegrationSection.swift",
3895238952
"source": "Start Tailscale to get your tailnet hostname.",
3895338953
"surface": "apple",
3895438954
"id": "native.apple.b40617c102f55113"
3895538955
},
3895638956
{
3895738957
"kind": "ui-call",
38958-
"line": 241,
38958+
"line": 227,
3895938959
"path": "apps/macos/Sources/OpenClaw/TailscaleIntegrationSection.swift",
3896038960
"source": "Start Tailscale",
3896138961
"surface": "apple",
3896238962
"id": "native.apple.719949d1f6bdc263"
3896338963
},
3896438964
{
3896538965
"kind": "ui-call",
38966-
"line": 249,
38966+
"line": 235,
3896738967
"path": "apps/macos/Sources/OpenClaw/TailscaleIntegrationSection.swift",
3896838968
"source": "Require credentials",
3896938969
"surface": "apple",
3897038970
"id": "native.apple.8fedb0008df7e179"
3897138971
},
3897238972
{
3897338973
"kind": "ui-call",
38974-
"line": 254,
38974+
"line": 240,
3897538975
"path": "apps/macos/Sources/OpenClaw/TailscaleIntegrationSection.swift",
3897638976
"source": "Serve uses Tailscale identity headers; no password required.",
3897738977
"surface": "apple",
3897838978
"id": "native.apple.de7ce19eaf2a6fee"
3897938979
},
3898038980
{
3898138981
"kind": "ui-call",
38982-
"line": 263,
38982+
"line": 249,
3898338983
"path": "apps/macos/Sources/OpenClaw/TailscaleIntegrationSection.swift",
3898438984
"source": "Funnel requires authentication.",
3898538985
"surface": "apple",
3898638986
"id": "native.apple.f00022aabd2fa142"
3898738987
},
3898838988
{
3898938989
"kind": "ui-call",
38990-
"line": 272,
38990+
"line": 258,
3899138991
"path": "apps/macos/Sources/OpenClaw/TailscaleIntegrationSection.swift",
3899238992
"source": "Password",
3899338993
"surface": "apple",
3899438994
"id": "native.apple.9b1c9f02ab3eefa5"
3899538995
},
3899638996
{
3899738997
"kind": "ui-call",
38998-
"line": 276,
38998+
"line": 262,
3899938999
"path": "apps/macos/Sources/OpenClaw/TailscaleIntegrationSection.swift",
3900039000
"source": "Stored in ~/.openclaw/openclaw.json. Prefer OPENCLAW_GATEWAY_PASSWORD for production.",
3900139001
"surface": "apple",
3900239002
"id": "native.apple.800bb607f45c05e4"
3900339003
},
3900439004
{
3900539005
"kind": "ui-call",
39006-
"line": 279,
39006+
"line": 265,
3900739007
"path": "apps/macos/Sources/OpenClaw/TailscaleIntegrationSection.swift",
3900839008
"source": "Update password",
3900939009
"surface": "apple",

‎apps/macos/Sources/OpenClaw/QuickChatController+Testing.swift‎

Lines changed: 0 additions & 64 deletions
This file was deleted.

‎apps/macos/Sources/OpenClaw/QuickChatController.swift‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -935,18 +935,6 @@ final class QuickChatController: NSObject, NSWindowDelegate {
935935
}
936936

937937
#if DEBUG
938-
var hasGlobalMonitorForTesting: Bool {
939-
self.globalMonitor != nil
940-
}
941-
942-
var hasLocalMonitorForTesting: Bool {
943-
self.localMonitor != nil
944-
}
945-
946-
var hotkeyRegisteredForTesting: Bool {
947-
self.hotkeyRegistered
948-
}
949-
950938
func handleSendAcceptedForTesting(openChat: Bool) {
951939
self.handleSendAccepted(openChat: openChat)
952940
}

‎apps/macos/Sources/OpenClaw/TailscaleIntegrationSection.swift‎

Lines changed: 15 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ struct TailscaleIntegrationSection: View {
7070
let isPaused: Bool
7171

7272
@Environment(TailscaleService.self) private var tailscaleService
73-
#if DEBUG
74-
private var testingService: TailscaleService?
75-
#endif
7673

7774
@State private var hasLoaded = false
7875
@State private var tailscaleMode: GatewayTailscaleMode = .serve
@@ -86,17 +83,6 @@ struct TailscaleIntegrationSection: View {
8683
init(connectionMode: AppState.ConnectionMode, isPaused: Bool) {
8784
self.connectionMode = connectionMode
8885
self.isPaused = isPaused
89-
#if DEBUG
90-
self.testingService = nil
91-
#endif
92-
}
93-
94-
private var effectiveService: TailscaleService {
95-
#if DEBUG
96-
return self.testingService ?? self.tailscaleService
97-
#else
98-
return self.tailscaleService
99-
#endif
10086
}
10187

10288
var body: some View {
@@ -106,7 +92,7 @@ struct TailscaleIntegrationSection: View {
10692

10793
self.statusRow
10894

109-
if !self.effectiveService.isInstalled {
95+
if !self.tailscaleService.isInstalled {
11096
self.installButtons
11197
} else {
11298
self.modePicker
@@ -145,7 +131,7 @@ struct TailscaleIntegrationSection: View {
145131
guard !self.hasLoaded else { return }
146132
await self.loadConfig()
147133
self.hasLoaded = true
148-
await self.effectiveService.checkTailscaleStatus()
134+
await self.tailscaleService.checkTailscaleStatus()
149135
self.startStatusTimer()
150136
}
151137
.onDisappear {
@@ -168,32 +154,32 @@ struct TailscaleIntegrationSection: View {
168154
.font(.callout)
169155
Spacer()
170156
Button("Refresh") {
171-
Task { await self.effectiveService.checkTailscaleStatus() }
157+
Task { await self.tailscaleService.checkTailscaleStatus() }
172158
}
173159
.buttonStyle(.bordered)
174160
.controlSize(.small)
175161
}
176162
}
177163

178164
private var statusColor: Color {
179-
if !self.effectiveService.isInstalled { return .yellow }
180-
if self.effectiveService.isRunning { return .green }
165+
if !self.tailscaleService.isInstalled { return .yellow }
166+
if self.tailscaleService.isRunning { return .green }
181167
return .orange
182168
}
183169

184170
private var statusText: String {
185-
if !self.effectiveService.isInstalled { return "Tailscale is not installed" }
186-
if self.effectiveService.isRunning { return "Tailscale is installed and running" }
171+
if !self.tailscaleService.isInstalled { return "Tailscale is not installed" }
172+
if self.tailscaleService.isRunning { return "Tailscale is installed and running" }
187173
return "Tailscale is installed but not running"
188174
}
189175

190176
private var installButtons: some View {
191177
HStack(spacing: 12) {
192-
Button("App Store") { self.effectiveService.openAppStore() }
178+
Button("App Store") { self.tailscaleService.openAppStore() }
193179
.buttonStyle(.link)
194-
Button("Direct Download") { self.effectiveService.openDownloadPage() }
180+
Button("Direct Download") { self.tailscaleService.openDownloadPage() }
195181
.buttonStyle(.link)
196-
Button("Setup Guide") { self.effectiveService.openSetupGuide() }
182+
Button("Setup Guide") { self.tailscaleService.openSetupGuide() }
197183
.buttonStyle(.link)
198184
}
199185
.controlSize(.small)
@@ -217,7 +203,7 @@ struct TailscaleIntegrationSection: View {
217203

218204
@ViewBuilder
219205
private var accessURLRow: some View {
220-
if let host = self.effectiveService.tailscaleHostname {
206+
if let host = self.tailscaleService.tailscaleHostname {
221207
let url = "https://\(host)/ui/"
222208
HStack(spacing: 8) {
223209
Text("Dashboard URL:")
@@ -231,14 +217,14 @@ struct TailscaleIntegrationSection: View {
231217
.font(.system(.caption, design: .monospaced))
232218
}
233219
}
234-
} else if !self.effectiveService.isRunning {
220+
} else if !self.tailscaleService.isRunning {
235221
Text("Start Tailscale to get your tailnet hostname.")
236222
.font(.caption)
237223
.foregroundStyle(.secondary)
238224
}
239225

240-
if self.effectiveService.isAppInstalled, !self.effectiveService.isRunning {
241-
Button("Start Tailscale") { self.effectiveService.openTailscaleApp() }
226+
if self.tailscaleService.isAppInstalled, !self.tailscaleService.isRunning {
227+
Button("Start Tailscale") { self.tailscaleService.openTailscaleApp() }
242228
.buttonStyle(.borderedProminent)
243229
.controlSize(.small)
244230
}
@@ -510,7 +496,7 @@ struct TailscaleIntegrationSection: View {
510496
self.stopStatusTimer()
511497
if ProcessInfo.processInfo.isRunningTests { return }
512498
self.statusTimer = Timer.scheduledTimer(withTimeInterval: 5, repeats: true) { _ in
513-
Task { await self.effectiveService.checkTailscaleStatus() }
499+
Task { await self.tailscaleService.checkTailscaleStatus() }
514500
}
515501
}
516502

@@ -522,26 +508,6 @@ struct TailscaleIntegrationSection: View {
522508

523509
#if DEBUG
524510
extension TailscaleIntegrationSection {
525-
mutating func setTestingState(
526-
mode: String,
527-
requireCredentials: Bool,
528-
password: String = "secret",
529-
statusMessage: String? = nil,
530-
validationMessage: String? = nil)
531-
{
532-
if let mode = GatewayTailscaleMode(rawValue: mode) {
533-
self.tailscaleMode = mode
534-
}
535-
self.requireCredentialsForServe = requireCredentials
536-
self.password = password
537-
self.statusMessage = statusMessage
538-
self.validationMessage = validationMessage
539-
}
540-
541-
mutating func setTestingService(_ service: TailscaleService?) {
542-
self.testingService = service
543-
}
544-
545511
static func simulateHydrationApplyForTesting(
546512
root: [String: Any],
547513
connectionMode: AppState.ConnectionMode,

‎apps/macos/Tests/OpenClawIPCTests/Placeholder.swift‎

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)