From d8ee40814e3074163878f6c085b82acd8f31fdf2 Mon Sep 17 00:00:00 2001 From: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 Date: Mon, 3 Aug 2026 03:02:23 -0400 Subject: [PATCH] fix(desktop): suppress dead_code clippy warnings on boot-migration shims MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After C5 stripped the per-scope definition migrations from the global boot path, the app-level wrapper functions (fold, materialize, backfill, detach, team_suffix, refresh_builtin_agent_avatars, reconcile_*) became unused. Their scoped _at()/_in_dir() variants are what the pipeline calls. Add #[allow(dead_code)] with a rationale comment to each wrapper rather than deleting them — the wrappers document the prior call shape and serve as reference for future integration. Also drop the spurious let _ = binding on remove_agent_runtime_receipt (returns (), not Result) flagged by clippy::let-unit-value. Co-authored-by: Will Pfleger Signed-off-by: Will Pfleger --- desktop/src-tauri/src/managed_agents/restore.rs | 3 ++- desktop/src-tauri/src/migration.rs | 7 +++++++ desktop/src-tauri/src/migration/backfill.rs | 1 + desktop/src-tauri/src/migration/detach.rs | 1 + desktop/src-tauri/src/migration/fold.rs | 1 + desktop/src-tauri/src/migration/materialize.rs | 1 + desktop/src-tauri/src/migration/team_suffix.rs | 1 + 7 files changed, 14 insertions(+), 1 deletion(-) diff --git a/desktop/src-tauri/src/managed_agents/restore.rs b/desktop/src-tauri/src/managed_agents/restore.rs index 9bb09d9fa4..6e702e20e6 100644 --- a/desktop/src-tauri/src/managed_agents/restore.rs +++ b/desktop/src-tauri/src/managed_agents/restore.rs @@ -40,6 +40,7 @@ type AgentSpawnResult = (String, SpawnOutcome); /// If the linked persona is gone, we log loudly and leave the record untouched — /// it stays orphaned and `spawn_agent_child` refuses to start it (see /// `effective_config::resolve_effective_config`'s `OrphanedInstance` arm). +#[allow(dead_code)] // Boot-migration shim; scoped pipeline now uses backfill_persona_snapshots_at. pub fn backfill_persona_snapshots(app: &tauri::AppHandle) -> Result<(), String> { let state = app.state::(); @@ -415,7 +416,7 @@ pub async fn restore_managed_agents_on_launch( "buzz-desktop: restore: {stale_msg}; terminating stale child for {pubkey}" ); let _ = super::terminate_process(process.child.id()); - let _ = super::remove_agent_runtime_receipt(app, key); + super::remove_agent_runtime_receipt(app, key); } } return Ok(()); diff --git a/desktop/src-tauri/src/migration.rs b/desktop/src-tauri/src/migration.rs index 5a4ed7bf6c..2cc23880ea 100644 --- a/desktop/src-tauri/src/migration.rs +++ b/desktop/src-tauri/src/migration.rs @@ -538,6 +538,7 @@ struct LegacyAvatarMatch<'a> { /// exact data URL or content-addressed upload digest makes the migration /// idempotent and avoids relying on timestamps or other persona fields the /// user may also have edited. +#[allow(dead_code)] // Boot-migration shim; scoped pipeline now uses refresh_builtin_agent_avatars_at. fn refresh_builtin_agent_avatars(app: &tauri::AppHandle) { let Ok(dir) = app.path().app_data_dir() else { return; @@ -1078,6 +1079,7 @@ fn reconcile_legacy_command_names_in_file(path: &Path) { }); } +#[allow(dead_code)] // Helper for reconcile_legacy_command_names (boot-migration shim). fn reconcile_legacy_persona_runtimes_in_file(path: &Path) { patch_json_records(path, |obj| { let Some(runtime) = obj.get("runtime").and_then(|v| v.as_str()) else { @@ -1103,6 +1105,7 @@ fn reconcile_legacy_persona_runtimes_in_file(path: &Path) { }); } +#[allow(dead_code)] // Helper for reconcile_legacy_command_names (boot-migration shim). fn rewrite_legacy_persona_md_runtime(content: &str) -> Option { let (frontmatter, body) = buzz_persona_pkg::persona::split_frontmatter(content).ok()?; let mut value = serde_yaml::from_str::(frontmatter).ok()?; @@ -1116,6 +1119,7 @@ fn rewrite_legacy_persona_md_runtime(content: &str) -> Option { Some(format!("---\n{frontmatter}---\n{body}")) } +#[allow(dead_code)] // Helper for reconcile_legacy_command_names (boot-migration shim). fn reconcile_legacy_team_persona_runtime_files(dir: &Path) { let Ok(entries) = std::fs::read_dir(dir) else { return; @@ -1166,6 +1170,7 @@ fn reconcile_legacy_team_persona_runtime_files(dir: &Path) { /// Reconcile exact built-in command values persisted before the Sprout→Buzz /// rename. Custom commands and explicit paths are left untouched. +#[allow(dead_code)] // Boot-migration shim; scoped pipeline now uses reconcile_legacy_command_names_at. pub fn reconcile_legacy_command_names(app: &tauri::AppHandle) { let Ok(current_dir) = app.path().app_data_dir() else { return; @@ -1196,6 +1201,7 @@ pub fn reconcile_legacy_command_names(app: &tauri::AppHandle) { /// discovery table. Known runtimes get their canonical mcp_command; /// unknown/custom agents are left untouched. Covers both the current /// app data dir and the canonical dev data dir (for worktree instances). +#[allow(dead_code)] // Boot-migration shim; scoped pipeline now uses reconcile_provider_mcp_commands_at. pub fn reconcile_provider_mcp_commands(app: &tauri::AppHandle) { let Ok(current_dir) = app.path().app_data_dir() else { return; @@ -1295,6 +1301,7 @@ fn reconcile_databricks_v1_to_v2_in_file(path: &Path, rewrite_v1_provider: bool) /// Covers both the current app data dir and the canonical dev data dir /// (for worktree instances) — same dual-dir pattern as /// `reconcile_legacy_command_names` and `reconcile_provider_mcp_commands`. +#[allow(dead_code)] // Boot-migration shim; scoped pipeline now uses reconcile_databricks_v1_to_v2_at. pub fn reconcile_databricks_v1_to_v2(app: &tauri::AppHandle) { use crate::managed_agents::baked_build_env; // On Block builds, the baked env contains BUZZ_AGENT_PROVIDER=databricks_v2. diff --git a/desktop/src-tauri/src/migration/backfill.rs b/desktop/src-tauri/src/migration/backfill.rs index 0155d86252..f11ce553bf 100644 --- a/desktop/src-tauri/src/migration/backfill.rs +++ b/desktop/src-tauri/src/migration/backfill.rs @@ -31,6 +31,7 @@ use crate::managed_agents::{ /// The manufactured definition's slug is the agent's pubkey: 64-hex passes /// the NIP-AP slug grammar on both relay and desktop ends, and agent pubkeys /// are unique, so the coordinate is collision-free by construction. +#[allow(dead_code)] // Boot-migration shim; scoped pipeline now uses backfill_standalone_agents_in_dir. pub fn backfill_standalone_agents(app: &tauri::AppHandle) { let Ok(base_dir) = crate::managed_agents::managed_agents_base_dir(app) else { return; diff --git a/desktop/src-tauri/src/migration/detach.rs b/desktop/src-tauri/src/migration/detach.rs index bce5492be9..b121c14d9d 100644 --- a/desktop/src-tauri/src/migration/detach.rs +++ b/desktop/src-tauri/src/migration/detach.rs @@ -24,6 +24,7 @@ use crate::managed_agents::{ManagedAgentRecord, TeamRecord}; /// `instructions` if the field is not already set. /// 4. Clear `source_dir`, `is_symlink`, `symlink_target`, `version` on each /// directory-backed `TeamRecord`. +#[allow(dead_code)] // Boot-migration shim; scoped pipeline now uses detach_directory_backed_teams_in_dir. pub fn detach_directory_backed_teams(app: &tauri::AppHandle) { let Ok(base_dir) = crate::managed_agents::managed_agents_base_dir(app) else { return; diff --git a/desktop/src-tauri/src/migration/fold.rs b/desktop/src-tauri/src/migration/fold.rs index 516a1b0afa..fa9aee2fca 100644 --- a/desktop/src-tauri/src/migration/fold.rs +++ b/desktop/src-tauri/src/migration/fold.rs @@ -19,6 +19,7 @@ use std::path::Path; /// `reconcile_provider_mcp_commands`, and `materialize_agent_runtimes` all /// read definitions post-fold via [`load_persona_runtimes`]'s unified-store /// branch. +#[allow(dead_code)] // Boot-migration shim; scoped pipeline now uses fold_personas_in_dir. pub fn fold_personas_into_agent_store(app: &tauri::AppHandle) { let Ok(base_dir) = crate::managed_agents::managed_agents_base_dir(app) else { return; diff --git a/desktop/src-tauri/src/migration/materialize.rs b/desktop/src-tauri/src/migration/materialize.rs index a5de84071d..6bf5425039 100644 --- a/desktop/src-tauri/src/migration/materialize.rs +++ b/desktop/src-tauri/src/migration/materialize.rs @@ -21,6 +21,7 @@ use super::{canonical_dev_data_dir, load_persona_runtimes, patch_json_records}; /// Idempotent: records that already carry `runtime` are untouched, as are /// records with no linked persona or a persona without a runtime (both keep /// resolving through the legacy fallback path unchanged). +#[allow(dead_code)] // Boot-migration shim; scoped pipeline now uses materialize_agent_runtimes_at. pub fn materialize_agent_runtimes(app: &tauri::AppHandle) { let Ok(current_dir) = app.path().app_data_dir() else { return; diff --git a/desktop/src-tauri/src/migration/team_suffix.rs b/desktop/src-tauri/src/migration/team_suffix.rs index 646569468e..c497b65120 100644 --- a/desktop/src-tauri/src/migration/team_suffix.rs +++ b/desktop/src-tauri/src/migration/team_suffix.rs @@ -45,6 +45,7 @@ const TEAM_DELIMITER: &str = "\n\n---\n# Team Instructions\n"; /// `personas.json` are cleaned in the same boot, and BEFORE /// `backfill_standalone_agents` so a manufactured definition never snapshots /// a suffix this migration is about to remove. +#[allow(dead_code)] // Boot-migration shim; scoped pipeline now uses strip_baked_team_instructions_in_dir. pub fn strip_baked_team_instructions(app: &tauri::AppHandle) { let Ok(base_dir) = crate::managed_agents::managed_agents_base_dir(app) else { return;