From 43dc4a04d0b0fa29a29b39e1ba32ab9af06138fe Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Sat, 28 Mar 2026 17:11:40 -0400 Subject: [PATCH] Fix clippy type_complexity lints with OnNodeCallback type alias Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/crates/fabro-cli/src/commands/run/detached.rs | 15 +++++++-------- lib/crates/fabro-workflows/src/lib.rs | 5 +++++ lib/crates/fabro-workflows/src/lifecycle/mod.rs | 4 ++-- .../fabro-workflows/src/operations/start.rs | 4 ++-- lib/crates/fabro-workflows/src/pipeline/types.rs | 2 +- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/lib/crates/fabro-cli/src/commands/run/detached.rs b/lib/crates/fabro-cli/src/commands/run/detached.rs index 32c2b7bda..979ea62ca 100644 --- a/lib/crates/fabro-cli/src/commands/run/detached.rs +++ b/lib/crates/fabro-cli/src/commands/run/detached.rs @@ -20,14 +20,13 @@ pub(crate) async fn execute(run_dir: PathBuf, launcher_path: PathBuf, resume: bo }); let cli_settings = cli_config::load_cli_settings(None)?; - let on_node: Option> = - RunRecord::load(&run_dir).ok().map(|record| { - let short_id = super::short_run_id(&record.run_id).to_string(); - fabro_proctitle::set(&format!("fabro: {short_id}")); - Arc::new(move |node_id: &str| { - fabro_proctitle::set(&format!("fabro: {short_id} {node_id}")); - }) as Arc - }); + let on_node: fabro_workflows::OnNodeCallback = RunRecord::load(&run_dir).ok().map(|record| { + let short_id = super::short_run_id(&record.run_id).to_string(); + fabro_proctitle::set(&format!("fabro: {short_id}")); + Arc::new(move |node_id: &str| { + fabro_proctitle::set(&format!("fabro: {short_id} {node_id}")); + }) as Arc + }); let github_app = shared::github::build_github_app_credentials(cli_settings.app_id()); let git_author = GitAuthor::from_options( diff --git a/lib/crates/fabro-workflows/src/lib.rs b/lib/crates/fabro-workflows/src/lib.rs index f134ab282..5139e7209 100644 --- a/lib/crates/fabro-workflows/src/lib.rs +++ b/lib/crates/fabro-workflows/src/lib.rs @@ -1,6 +1,11 @@ +use std::sync::Arc; + use fabro_retro::retro::CompletedStage; use serde::de::DeserializeOwned; +/// Callback invoked when a workflow node starts executing. +pub type OnNodeCallback = Option>; + /// Convert a Duration's milliseconds to u64, saturating on overflow. pub(crate) fn millis_u64(d: std::time::Duration) -> u64 { u64::try_from(d.as_millis()).unwrap_or(u64::MAX) diff --git a/lib/crates/fabro-workflows/src/lifecycle/mod.rs b/lib/crates/fabro-workflows/src/lifecycle/mod.rs index 8bf3a315c..bc5d9d66d 100644 --- a/lib/crates/fabro-workflows/src/lifecycle/mod.rs +++ b/lib/crates/fabro-workflows/src/lifecycle/mod.rs @@ -61,7 +61,7 @@ pub(crate) struct WorkflowLifecycle { disk: DiskLifecycle, git: GitLifecycle, artifact: ArtifactLifecycle, - on_node: Option>, + on_node: crate::OnNodeCallback, /// Set in on_edge_selected when loop_restart approved; read+cleared by EventLifecycle::on_run_start restarted_from: Arc>>, /// Shared git checkpoint result (written by git, read by event) @@ -85,7 +85,7 @@ impl WorkflowLifecycle { run_dir: &PathBuf, run_options: &Arc, is_resume: bool, - on_node: Option>, + on_node: crate::OnNodeCallback, ) -> Self { let runtime_state = RuntimeState::new(run_dir); let restarted_from: Arc>> = Arc::new(Mutex::new(None)); diff --git a/lib/crates/fabro-workflows/src/operations/start.rs b/lib/crates/fabro-workflows/src/operations/start.rs index 6efbf426a..161d389a9 100644 --- a/lib/crates/fabro-workflows/src/operations/start.rs +++ b/lib/crates/fabro-workflows/src/operations/start.rs @@ -42,7 +42,7 @@ struct RunSession { sandbox: SandboxSpec, llm: LlmSpec, interviewer: Arc, - on_node: Option>, + on_node: crate::OnNodeCallback, lifecycle: LifecycleOptions, hooks: fabro_hooks::HookConfig, sandbox_env: SandboxEnvSpec, @@ -67,7 +67,7 @@ pub struct StartServices { pub interviewer: Arc, pub git_author: GitAuthor, pub github_app: Option, - pub on_node: Option>, + pub on_node: crate::OnNodeCallback, pub registry_override: Option>, } diff --git a/lib/crates/fabro-workflows/src/pipeline/types.rs b/lib/crates/fabro-workflows/src/pipeline/types.rs index 02a017beb..e5c5b4ea1 100644 --- a/lib/crates/fabro-workflows/src/pipeline/types.rs +++ b/lib/crates/fabro-workflows/src/pipeline/types.rs @@ -251,7 +251,7 @@ pub struct Initialized { pub emitter: Arc, pub sandbox: Arc, pub registry: Arc, - pub on_node: Option>, + pub on_node: crate::OnNodeCallback, pub hook_runner: Option>, pub env: HashMap, pub dry_run: bool,