Fix clippy type_complexity lints with OnNodeCallback type alias

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-03-28 17:11:40 -04:00
parent 4c11da4a30
commit 43dc4a04d0
No known key found for this signature in database
5 changed files with 17 additions and 13 deletions

View file

@ -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<Arc<dyn Fn(&str) + Send + Sync>> =
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<dyn Fn(&str) + Send + Sync>
});
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<dyn Fn(&str) + Send + Sync>
});
let github_app = shared::github::build_github_app_credentials(cli_settings.app_id());
let git_author = GitAuthor::from_options(

View file

@ -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<Arc<dyn Fn(&str) + Send + Sync>>;
/// 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)

View file

@ -61,7 +61,7 @@ pub(crate) struct WorkflowLifecycle {
disk: DiskLifecycle,
git: GitLifecycle,
artifact: ArtifactLifecycle,
on_node: Option<Arc<dyn Fn(&str) + Send + Sync>>,
on_node: crate::OnNodeCallback,
/// Set in on_edge_selected when loop_restart approved; read+cleared by EventLifecycle::on_run_start
restarted_from: Arc<Mutex<Option<(String, String)>>>,
/// Shared git checkpoint result (written by git, read by event)
@ -85,7 +85,7 @@ impl WorkflowLifecycle {
run_dir: &PathBuf,
run_options: &Arc<RunOptions>,
is_resume: bool,
on_node: Option<Arc<dyn Fn(&str) + Send + Sync>>,
on_node: crate::OnNodeCallback,
) -> Self {
let runtime_state = RuntimeState::new(run_dir);
let restarted_from: Arc<Mutex<Option<(String, String)>>> = Arc::new(Mutex::new(None));

View file

@ -42,7 +42,7 @@ struct RunSession {
sandbox: SandboxSpec,
llm: LlmSpec,
interviewer: Arc<dyn Interviewer>,
on_node: Option<Arc<dyn Fn(&str) + Send + Sync>>,
on_node: crate::OnNodeCallback,
lifecycle: LifecycleOptions,
hooks: fabro_hooks::HookConfig,
sandbox_env: SandboxEnvSpec,
@ -67,7 +67,7 @@ pub struct StartServices {
pub interviewer: Arc<dyn Interviewer>,
pub git_author: GitAuthor,
pub github_app: Option<fabro_github::GitHubAppCredentials>,
pub on_node: Option<Arc<dyn Fn(&str) + Send + Sync>>,
pub on_node: crate::OnNodeCallback,
pub registry_override: Option<Arc<HandlerRegistry>>,
}

View file

@ -251,7 +251,7 @@ pub struct Initialized {
pub emitter: Arc<EventEmitter>,
pub sandbox: Arc<dyn Sandbox>,
pub registry: Arc<HandlerRegistry>,
pub on_node: Option<Arc<dyn Fn(&str) + Send + Sync>>,
pub on_node: crate::OnNodeCallback,
pub hook_runner: Option<Arc<HookRunner>>,
pub env: HashMap<String, String>,
pub dry_run: bool,