From 27370bc46fd21c2539674f7ca36be013f43bf564 Mon Sep 17 00:00:00 2001 From: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 Date: Mon, 3 Aug 2026 01:47:18 -0400 Subject: [PATCH] fix(desktop): resolve clippy dead_code and lint warnings from push gate Co-authored-by: Will Pfleger Signed-off-by: Will Pfleger --- .../src-tauri/src/managed_agents/global_config/mod.rs | 1 + desktop/src-tauri/src/managed_agents/retention.rs | 7 +++++-- .../src-tauri/src/managed_agents/runtime_commands.rs | 4 ++-- desktop/src-tauri/src/managed_agents/runtime_types.rs | 1 + desktop/src-tauri/src/managed_agents/scope.rs | 10 ++++++++++ desktop/src-tauri/src/managed_agents/teams.rs | 2 ++ 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/desktop/src-tauri/src/managed_agents/global_config/mod.rs b/desktop/src-tauri/src/managed_agents/global_config/mod.rs index fdcd28803..b67f94137 100644 --- a/desktop/src-tauri/src/managed_agents/global_config/mod.rs +++ b/desktop/src-tauri/src/managed_agents/global_config/mod.rs @@ -233,6 +233,7 @@ pub fn save_global_agent_config(app: &AppHandle, config: &GlobalAgentConfig) -> } /// Scoped variant: save global agent config into the given definitions dir. +#[allow(dead_code)] // Part of the scoped _at() API; not yet called in this release. pub(crate) fn save_global_agent_config_at( definitions_dir: &std::path::Path, config: &GlobalAgentConfig, diff --git a/desktop/src-tauri/src/managed_agents/retention.rs b/desktop/src-tauri/src/managed_agents/retention.rs index 2b463517d..8b1a35393 100644 --- a/desktop/src-tauri/src/managed_agents/retention.rs +++ b/desktop/src-tauri/src/managed_agents/retention.rs @@ -51,8 +51,11 @@ pub fn scope_for_arrival( ) -> Option { let same_relay = normalized_relay_scope(&scope.relay_url) == normalized_relay_scope(arrival_relay_url); - let same_owner = scope.owner_keys.public_key().to_hex().to_ascii_lowercase() - == arrival_owner_pubkey.trim().to_ascii_lowercase(); + let same_owner = scope + .owner_keys + .public_key() + .to_hex() + .eq_ignore_ascii_case(arrival_owner_pubkey.trim()); (same_relay && same_owner).then_some(scope) } diff --git a/desktop/src-tauri/src/managed_agents/runtime_commands.rs b/desktop/src-tauri/src/managed_agents/runtime_commands.rs index b347541e1..1d95e297b 100644 --- a/desktop/src-tauri/src/managed_agents/runtime_commands.rs +++ b/desktop/src-tauri/src/managed_agents/runtime_commands.rs @@ -695,8 +695,8 @@ pub(crate) fn drain_scope_runtimes( } }; runtimes - .iter() - .map(|(key, _runtime)| { + .keys() + .map(|key| { // Look up start_on_app_launch from the current store; if we // can't read it, assume true (safer for compensation — we'd // rather restart too many than too few). diff --git a/desktop/src-tauri/src/managed_agents/runtime_types.rs b/desktop/src-tauri/src/managed_agents/runtime_types.rs index b7efa7a72..132a004f3 100644 --- a/desktop/src-tauri/src/managed_agents/runtime_types.rs +++ b/desktop/src-tauri/src/managed_agents/runtime_types.rs @@ -55,6 +55,7 @@ pub struct ManagedAgentPairRuntime { /// entries (the seam that option 2 background-runtime pinning would build /// on). Under active-scope-only policy, all live entries should always /// match the current scope; this field makes the invariant testable. + #[allow(dead_code)] // Set at spawn; read in tests; seam for future option-2 pinning. pub scope_id: Option, } diff --git a/desktop/src-tauri/src/managed_agents/scope.rs b/desktop/src-tauri/src/managed_agents/scope.rs index 341a931c9..111e4fbc4 100644 --- a/desktop/src-tauri/src/managed_agents/scope.rs +++ b/desktop/src-tauri/src/managed_agents/scope.rs @@ -68,12 +68,17 @@ pub struct WorkspaceAgentScope { /// The normalized relay URL for this scope. pub relay_url: String, /// The owner's hex pubkey. + // Used in tests and by the scope-for-arrival inbound filter. + #[allow(dead_code)] pub owner_pubkey: String, /// The scoped definitions directory: `/scopes//`. pub definitions_dir: PathBuf, /// Monotonically increasing generation counter; incremented on every scope /// change (including identity import that clears the active scope to None). /// Used by long-running operations to detect a mid-flight workspace switch. + // Generation is set at construction and read in tests; the field is the + // durable seam for stale-commit detection in future await-crossing paths. + #[allow(dead_code)] pub generation: u64, } @@ -89,6 +94,7 @@ pub(crate) fn next_scope_generation() -> u64 { } /// Read the current generation without incrementing. +#[allow(dead_code)] // Read in tests; here as a read-only probe for diagnostics. pub fn current_scope_generation() -> u64 { SCOPE_GENERATION.load(Ordering::Acquire) } @@ -146,6 +152,7 @@ impl WorkspaceAgentScope { } /// Ensure the definitions directory exists. + #[allow(dead_code)] // Called in tests; here as a utility for future callers. pub fn ensure_dir(&self) -> Result<(), String> { std::fs::create_dir_all(&self.definitions_dir).map_err(|e| { format!( @@ -156,16 +163,19 @@ impl WorkspaceAgentScope { } /// Path to the scoped `managed-agents.json`. + #[allow(dead_code)] // Called in tests; here as a canonical path accessor. pub fn managed_agents_path(&self) -> PathBuf { self.definitions_dir.join("managed-agents.json") } /// Path to the scoped `teams.json`. + #[allow(dead_code)] // Called in tests; here as a canonical path accessor. pub fn teams_path(&self) -> PathBuf { self.definitions_dir.join("teams.json") } /// Path to the scoped `global-agent-config.json`. + #[allow(dead_code)] // Called in tests; here as a canonical path accessor. pub fn global_config_path(&self) -> PathBuf { self.definitions_dir.join("global-agent-config.json") } diff --git a/desktop/src-tauri/src/managed_agents/teams.rs b/desktop/src-tauri/src/managed_agents/teams.rs index 0ccb84aa2..aa8e2f2b2 100644 --- a/desktop/src-tauri/src/managed_agents/teams.rs +++ b/desktop/src-tauri/src/managed_agents/teams.rs @@ -218,6 +218,7 @@ pub fn save_teams(app: &AppHandle, records: &[TeamRecord]) -> Result<(), String> } /// Scoped variant: load teams from the given definitions dir. +#[allow(dead_code)] // Part of the scoped _at() API; called indirectly via save_teams_at. pub(crate) fn load_teams_at(definitions_dir: &std::path::Path) -> Result, String> { let path = teams_store_path_at(definitions_dir); let now = now_iso(); @@ -242,6 +243,7 @@ pub(crate) fn load_teams_at(definitions_dir: &std::path::Path) -> Result