Repository navigation
chore(desktop): remove dead code warnings on non-Windows builds - #1416
Conversation
Six dead-code warnings appeared on every non-Windows Desktop build. Gate the Computer presentation and observer helpers on Windows, where their only callers live, and limit AppState::new and shutdown_until to the configurations that use them. Remove DesktopCore::configure_remote_setup and store_identity. Since AppState::configure_remote_setup moved to configure_environment, only an ignored Windows dogfood test still reached them, so it goes with them.
swjnxyf
left a comment
There was a problem hiding this comment.
Reviewed PR #1416 at 6eaaef8327880cb92a89ee60f41b08edf6349a37 on special (no worktree). No blocking issues found (LGTM).
I traced the deleted symbols against the PR's base commit and the surviving production call graph, rather than relying solely on compiler dead-code warnings:
DesktopCore::configure_remote_setuphad no production caller. Its only direct callers were inside the now-removed, ignoredwindows_remote_full_dogfood_reuses_enrollment_without_local_servertest. Theconfigure_remote_setupTauri command andAppState::configure_remote_setuppublic wrapper remain and now reachDesktopCore::configure_environmentthroughEnvironmentInput { mode: "join", ... }. Remote Join functionality is not removed by this PR.DesktopCore::store_identitywas used only by the removed private method. The supported environment path owns persisted setup/identity through the Environment store and journal.- The removed
validate_server_urlis only the unusedwebcodexmodule re-export; the actual validator inadapter.rsand its live callers/tests remain. - The newly gated presentation/observer/pause items are reached only by Windows-gated callers;
AppState::newis used in tests while production callsnew_resolved;shutdown_untilis required by the Windows WM_ENDSESSION path and tests.
Validation: complete GitHub CI is green, including Windows Desktop and macOS Desktop; on special cargo fmt --all -- --check for Desktop and the PR's git diff --check passed.
Non-blocking coverage follow-up: The deleted #[ignore] Windows remote dogfood test covered a useful scenario (join remote Server, then reuse enrollment without a second pairing code and without starting a local Server), but it tested the already-retired DesktopCore path and did not run in regular CI. Please consider adding a fresh Windows integration/dogfood test via the current configure_environment / Join path in a separate PR, rather than preserving obsolete test-only code.
What changed
Every non-Windows Desktop build reported six dead-code warnings.
cargo check --all-targetsinapps/desktop/src-taurinow reports none on macOS.Presentation.controlling,update_edge,start_computer_observer,pause_computer#[cfg(windows)]AppState::new#[cfg(test)]new_resolvedAppState::shutdown_until#[cfg(any(windows, test))]DesktopCore::configure_remote_setup,store_identityAppState::configure_remote_setupnow goes throughconfigure_environmentwithmode: "join", so theDesktopCoremethod it used to reach is no longer called. The now-unusedvalidate_server_urlre-export goes with it.Worth reviewing
This also removes
windows_remote_full_dogfood_reuses_enrollment_without_local_server. It was#[ignore]d, Windows-only, and the only remaining caller of the removed method, so it no longer exercised the path the Desktop command uses.docs/TESTING.mdasks for dedicated tests to go with a retired concept. If you still run it manually, it would need porting toconfigure_environment, and I'm happy to do that instead.Validation
On macOS arm64, in
apps/desktop/src-tauri:cargo check --all-targets: 0 warningscargo test --lib: 368 passed, 4 ignoredcargo fmt --checkNot verified: a Windows build. Cross-checking from macOS stops in the
ringbuild script. On Windows the addedcfgattributes are always true, and the removed items have no callers on any platform, but the Windows CI is the real check.