mirror of
https://github.com/block/buzz.git
synced 2026-11-14 05:12:27 +00:00
fix(desktop): suppress dead_code clippy warnings on boot-migration shims
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 <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This commit is contained in:
parent
3ea3d70cfe
commit
d8ee40814e
@@ -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::<AppState>();
|
||||
|
||||
@@ -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(());
|
||||
|
||||
@@ -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<String> {
|
||||
let (frontmatter, body) = buzz_persona_pkg::persona::split_frontmatter(content).ok()?;
|
||||
let mut value = serde_yaml::from_str::<serde_yaml::Value>(frontmatter).ok()?;
|
||||
@@ -1116,6 +1119,7 @@ fn rewrite_legacy_persona_md_runtime(content: &str) -> Option<String> {
|
||||
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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user