* macOS: honor Nix defaults suite; auto launch in Nix mode Fixes repeated onboarding in Nix deployments by detecting nixMode from the stable defaults suite (ai.openclaw.mac) and bridging key settings into the current defaults domain. Also enables LaunchAgent autostart by default in Nix mode (escape hatch: openclaw.nixAutoLaunchAtLogin=false). * macOS: keep Nix mode fix focused Drop the automatic launch-at-login behavior from the Nix defaults patch; keep this PR scoped to reliable nixMode detection + defaults bridging. * macOS: simplify nixMode fix Remove the defaults-bridging helper and rely on a single, stable defaults suite (ai.openclaw.mac) for nixMode detection when running as an app bundle. This keeps the fix focused on onboarding suppression and rename churn resilience. * macOS: fix nixMode defaults suite churn (#12205)
47 lines
1.5 KiB
Swift
47 lines
1.5 KiB
Swift
import Foundation
|
|
import Testing
|
|
@testable import OpenClaw
|
|
|
|
@Suite(.serialized)
|
|
struct NixModeStableSuiteTests {
|
|
@Test func resolvesFromStableSuiteForAppBundles() {
|
|
let suite = UserDefaults(suiteName: launchdLabel)!
|
|
let key = "openclaw.nixMode"
|
|
let prev = suite.object(forKey: key)
|
|
defer {
|
|
if let prev { suite.set(prev, forKey: key) } else { suite.removeObject(forKey: key) }
|
|
}
|
|
|
|
suite.set(true, forKey: key)
|
|
|
|
let standard = UserDefaults(suiteName: "NixModeStableSuiteTests.\(UUID().uuidString)")!
|
|
#expect(!standard.bool(forKey: key))
|
|
|
|
let resolved = ProcessInfo.resolveNixMode(
|
|
environment: [:],
|
|
standard: standard,
|
|
stableSuite: suite,
|
|
isAppBundle: true)
|
|
#expect(resolved)
|
|
}
|
|
|
|
@Test func ignoresStableSuiteOutsideAppBundles() {
|
|
let suite = UserDefaults(suiteName: launchdLabel)!
|
|
let key = "openclaw.nixMode"
|
|
let prev = suite.object(forKey: key)
|
|
defer {
|
|
if let prev { suite.set(prev, forKey: key) } else { suite.removeObject(forKey: key) }
|
|
}
|
|
|
|
suite.set(true, forKey: key)
|
|
let standard = UserDefaults(suiteName: "NixModeStableSuiteTests.\(UUID().uuidString)")!
|
|
|
|
let resolved = ProcessInfo.resolveNixMode(
|
|
environment: [:],
|
|
standard: standard,
|
|
stableSuite: suite,
|
|
isAppBundle: false)
|
|
#expect(!resolved)
|
|
}
|
|
}
|