Skip to content

chore(desktop): remove dead code warnings on non-Windows builds - #1416

Merged
swjnxyf merged 1 commit into
yyjeqhc:mainfrom
HarpeLm:chore/desktop-remove-dead-code-warnings
Nov 10, 2026
Merged

swjnxyf merged 1 commit into
yyjeqhc:mainfrom
HarpeLm:chore/desktop-remove-dead-code-warnings

Conversation

@HarpeLm

@HarpeLm HarpeLm commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

What changed

Every non-Windows Desktop build reported six dead-code warnings. cargo check --all-targets in apps/desktop/src-tauri now reports none on macOS.

Item Change Why
Presentation.controlling, update_edge, start_computer_observer, pause_computer #[cfg(windows)] Their only callers are already Windows-only
AppState::new #[cfg(test)] Production uses new_resolved
AppState::shutdown_until #[cfg(any(windows, test))] Used by the Windows session-shutdown path and by tests
DesktopCore::configure_remote_setup, store_identity Removed No production caller remains

AppState::configure_remote_setup now goes through configure_environment with mode: "join", so the DesktopCore method it used to reach is no longer called. The now-unused validate_server_url re-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.md asks for dedicated tests to go with a retired concept. If you still run it manually, it would need porting to configure_environment, and I'm happy to do that instead.

Validation

On macOS arm64, in apps/desktop/src-tauri:

  • cargo check --all-targets: 0 warnings
  • cargo test --lib: 368 passed, 4 ignored
  • cargo fmt --check

Not verified: a Windows build. Cross-checking from macOS stops in the ring build script. On Windows the added cfg attributes are always true, and the removed items have no callers on any platform, but the Windows CI is the real check.

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 swjnxyf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_setup had no production caller. Its only direct callers were inside the now-removed, ignored windows_remote_full_dogfood_reuses_enrollment_without_local_server test. The configure_remote_setup Tauri command and AppState::configure_remote_setup public wrapper remain and now reach DesktopCore::configure_environment through EnvironmentInput { mode: "join", ... }. Remote Join functionality is not removed by this PR.
  • DesktopCore::store_identity was 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_url is only the unused webcodex module re-export; the actual validator in adapter.rs and its live callers/tests remain.
  • The newly gated presentation/observer/pause items are reached only by Windows-gated callers; AppState::new is used in tests while production calls new_resolved; shutdown_until is 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.

@swjnxyf
swjnxyf merged commit f8228b6 into yyjeqhc:main Nov 10, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants