Repository navigation
Conversation
hidb4ai
left a comment
There was a problem hiding this comment.
The legacy LaunchAgent approach is reasonable: querying Apple's statusForLegacyURL API distinguishes a present plist from effective OS authorization, and the async command moves blocking OS work off the UI thread. The retry/error UI and request-generation guard are coherent.
7 Settings tests, TypeScript, 48 Linux Rust unit tests (2 ignored), rustfmt and the generated IPC contract check passed. The filesystem/state-machine tests use controlled BTM status inputs. I did not independently run macOS ServiceManagement/System Settings/login acceptance or Windows Registry acceptance; the author's macOS evidence is separately identified, and the platform CI matrix remains incomplete. No new table or public interface. Readiness: 74/100; no actionable code defect found in this review.
Current head: df91a7c. Clean merge with master efba45e. CI: {'IN_PROGRESS': 1, 'SUCCESS': 1}. Skipped jobs are not successful validation.
Which issue or RFC does this PR close?
Closes #3019.
Rationale for this change
Follow-up improvements to Open Desktop at login (#2978):
~/Library/LaunchAgents/PowerContext Desktop.plist, causing Desktop Settings to show the switch as enabled when macOS will not launch it.desktop_loginran synchronous filesystem and Windows Registry calls on the Tauri UI event-loop thread.desktop_loginread failed whenSettingsPagemounted, the switch stayed disabled with no inline retry action.What changes are included in this PR?
desktop/src-tauri/src/desktop_preferences/launch_agent.rs,desktop/src-tauri/Cargo.toml):LaunchAgentplist mechanism rather than migrating toSMAppService.mainAppbecause CI/preview macOS bundles are unsigned (andSMAppService.mainAppfails without proper code signing on unsigned Intel bundles and unbundled dev runs) andLaunchAgentpreserves compatibility with existing registrations.SMAppService::statusForLegacyURL:queries viaServiceManagement.framework(objc2+objc2-foundationNSURL, already inCargo.lock) to read the effective macOS BTM status (NotRegistered,Enabled,RequiresApproval,NotFound).Enabled).RequiresApprovalon enable (Some(true)) asSafeError::Forbiddenso Desktop does not misreport a user-revoked System Settings approval as a generic verification failure.desktop/src-tauri/src/desktop_preferences.rs):desktop_logintoasync fnand moved macOS filesystem/BTM operations and Windows autostart Registry calls ontotauri::async_runtime::spawn_blocking.desktop/ui/src/app/SettingsPage.tsx,desktop/ui/tests/settings.test.tsx):Retry read(重试读取) action insidePageFeedbackwhen the initialdesktopLogin()check fails (nativeLogin === null).runLoginRequesthelper to guard against stale/unmounted async responses across initial load, retry, and toggle updates.desktop_loginreturns"forbidden".Are there any user-facing changes?
How was this change tested?
rustup run 1.95.0 cargo fmt --manifest-path desktop/src-tauri/Cargo.toml --checkrustup run 1.95.0 cargo clippy --locked --manifest-path desktop/src-tauri/Cargo.toml --all-targets -- -D warningsrustup run 1.95.0 cargo test --locked --manifest-path desktop/src-tauri/Cargo.toml(49 unit tests includinglaunch_agentBTM state/polling/FFI tests, plus integration test suites)cd desktop && pnpm lint && pnpm test && pnpm ipc:check && pnpm build(16 Vitest files, 102 tests passed including retry and approval guidance tests)SMAppService.statusForLegacyPlist(at:)behavior empirically on macOS 26.6 against~/Library/LaunchAgents/items (enabled, disabled/RequiresApproval, and newly written plist indexing latency); Windowsspawn_blockingbranch was checked for syntax/types locally and awaits Windows CI verification.AI usage statement
Antigravity (Gemini 4 Hydrogen) assisted with analysis, implementation, and Open Code Review verification.