fix(desktop): resolve clippy dead_code and lint warnings from push gate

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This commit is contained in:
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7
2026-08-03 01:47:18 -04:00
co-authored by Will Pfleger
parent 370de88dac
commit 27370bc46f
6 changed files with 21 additions and 4 deletions
@@ -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,
@@ -51,8 +51,11 @@ pub fn scope_for_arrival(
) -> Option<RetentionScope> {
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)
}
@@ -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).
@@ -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<String>,
}
@@ -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: `<agents-base>/scopes/<scope_id>/`.
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")
}
@@ -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<Vec<TeamRecord>, 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<Vec<Tea
}
/// Scoped variant: save teams into the given definitions dir.
#[allow(dead_code)] // Part of the scoped _at() API; called by load_teams_at (idempotent write).
pub(crate) fn save_teams_at(
definitions_dir: &std::path::Path,
records: &[TeamRecord],