mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-07 08:27:12 +00:00
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:
parent
4c11da4a30
commit
43dc4a04d0
5 changed files with 17 additions and 13 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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>>,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue