diff --git a/compliance-agent/src/api/handlers/health.rs b/compliance-agent/src/api/handlers/health.rs index 24f7977..3148ddc 100644 --- a/compliance-agent/src/api/handlers/health.rs +++ b/compliance-agent/src/api/handlers/health.rs @@ -99,7 +99,12 @@ pub async fn stats_overview( .limit(10) .await { - Ok(cursor) => collect_cursor_async(cursor).await, + Ok(cursor) => { + let mut runs: Vec = collect_cursor_async(cursor).await; + // Runs recorded before notes existed list them among their skips. + runs.iter_mut().for_each(ScanRun::split_notes); + runs + } Err(e) => { tracing::warn!("Failed to fetch recent scans: {e}"); Vec::new() diff --git a/compliance-agent/src/api/handlers/onboarding.rs b/compliance-agent/src/api/handlers/onboarding.rs index bc4074d..9cd82a4 100644 --- a/compliance-agent/src/api/handlers/onboarding.rs +++ b/compliance-agent/src/api/handlers/onboarding.rs @@ -200,7 +200,9 @@ pub(crate) async fn latest_scan_runs( cursor .filter_map(|row| async move { let run = row.ok()?.get_document("run").ok()?.clone(); - let run: ScanRun = mongodb::bson::from_document(run).ok()?; + let mut run: ScanRun = mongodb::bson::from_document(run).ok()?; + // Runs recorded before notes existed list them among their skips. + run.split_notes(); Some((run.repo_id.clone(), run)) }) .collect() diff --git a/compliance-core/src/models/scan.rs b/compliance-core/src/models/scan.rs index 31ce3cd..68397b4 100644 --- a/compliance-core/src/models/scan.rs +++ b/compliance-core/src/models/scan.rs @@ -186,8 +186,9 @@ pub struct ScanRun { pub sbom_quality: Option, } -/// Why a stage was skipped, stable for the dashboard to word in the reader's -/// language. The stage's `reason` next to it is English prose for API +/// Why a stage was skipped, or what a run note is about +/// ([`SkipCode::is_informational`]), stable for the dashboard to word in the +/// reader's language. The stage's `reason` next to it is English prose for API /// readers; neither ever carries a server path or a raw error (those go to /// the log). #[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]