From 9f8046c5b682a77be722653a2f40475ec3aea15f Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Mar 2026 19:27:08 +0000 Subject: [PATCH] simplify: deduplicate preflight perm_details, remove unnecessary github_app clone --- lib/crates/fabro-workflows/src/cli/run.rs | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/lib/crates/fabro-workflows/src/cli/run.rs b/lib/crates/fabro-workflows/src/cli/run.rs index 57630d4a2..7295dd15f 100644 --- a/lib/crates/fabro-workflows/src/cli/run.rs +++ b/lib/crates/fabro-workflows/src/cli/run.rs @@ -2077,7 +2077,6 @@ async fn run_preflight( let exe_config = resolve_exe_config(run_cfg.as_ref(), run_defaults); let ssh_config = resolve_ssh_config(run_cfg.as_ref(), run_defaults); - let github_app_for_preflight = github_app.clone(); let sandbox_result: Result, String> = match sandbox_provider { SandboxProvider::Docker => { let config = DockerSandboxConfig { @@ -2094,7 +2093,7 @@ async fn run_preflight( let env = crate::daytona_sandbox::DaytonaSandbox::new( daytona_client, config, - github_app, + github_app.clone(), None, None, ); @@ -2270,7 +2269,12 @@ async fn run_preflight( .or(run_defaults.github.as_ref()); if let Some(gh_cfg) = github_permissions { if !gh_cfg.permissions.is_empty() { - match (&github_app_for_preflight, origin_url) { + let perm_details: Vec = gh_cfg + .permissions + .iter() + .map(|(k, v)| CheckDetail::new(format!("{k}: {v}"))) + .collect(); + match (&github_app, origin_url) { (Some(creds), Some(url)) => { match mint_github_token(creds, url, &gh_cfg.permissions).await { Ok(_) => { @@ -2278,11 +2282,7 @@ async fn run_preflight( name: "GitHub Token".into(), status: CheckStatus::Pass, summary: "minted".into(), - details: gh_cfg - .permissions - .iter() - .map(|(k, v)| CheckDetail::new(format!("{k}: {v}"))) - .collect(), + details: perm_details, remediation: None, }); } @@ -2291,11 +2291,7 @@ async fn run_preflight( name: "GitHub Token".into(), status: CheckStatus::Error, summary: "failed".into(), - details: gh_cfg - .permissions - .iter() - .map(|(k, v)| CheckDetail::new(format!("{k}: {v}"))) - .collect(), + details: perm_details, remediation: Some(format!("Failed to mint GitHub token: {e}")), }); }