From ad9d1dcebf87008c04f433bb9d2924e1f70fa3db Mon Sep 17 00:00:00 2001 From: Guillaume Lagrange Date: Wed, 4 Feb 2026 17:25:36 +0100 Subject: [PATCH] fix: do not error out if no head report is present after local run This used to happen on local runs with integration when no run on main branch is present. --- src/cli/run/poll_results.rs | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/src/cli/run/poll_results.rs b/src/cli/run/poll_results.rs index acc7b470..beb8220b 100644 --- a/src/cli/run/poll_results.rs +++ b/src/cli/run/poll_results.rs @@ -13,28 +13,25 @@ pub async fn poll_results( ) -> Result<()> { let response = poll_run_report(api_client, upload_result).await?; - let report = response - .run - .head_reports - .into_iter() - .next() - .ok_or_else(|| anyhow!("No head report found in the run report"))?; + let report = response.run.head_reports.into_iter().next(); - if let Some(impact) = report.impact { - let rounded_impact = (impact * 100.0).round(); - let impact_text = if impact > 0.0 { - style(format!("+{rounded_impact}%")).green().bold() - } else { - style(format!("{rounded_impact}%")).red().bold() - }; + if let Some(report) = report { + if let Some(impact) = report.impact { + let rounded_impact = (impact * 100.0).round(); + let impact_text = if impact > 0.0 { + style(format!("+{rounded_impact}%")).green().bold() + } else { + style(format!("{rounded_impact}%")).red().bold() + }; - info!( - "Impact: {} (allowed regression: -{}%)", - impact_text, - (response.allowed_regression * 100.0).round() - ); - } else { - info!("No impact detected, reason: {}", report.conclusion); + info!( + "Impact: {} (allowed regression: -{}%)", + impact_text, + (response.allowed_regression * 100.0).round() + ); + } else { + info!("No impact detected, reason: {}", report.conclusion); + } } if output_json {