From dfd2156821335131e53392dea5408e4678e29b94 Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Date: Tue, 17 Nov 2026 11:24:55 +0100 Subject: [PATCH] fix(api): a machine's open CVEs are its parts' together, as each decides alone (#1026) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9 --- compliance-agent/src/api/handlers/machine.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/compliance-agent/src/api/handlers/machine.rs b/compliance-agent/src/api/handlers/machine.rs index b07e1b8..e27ce18 100644 --- a/compliance-agent/src/api/handlers/machine.rs +++ b/compliance-agent/src/api/handlers/machine.rs @@ -231,7 +231,8 @@ pub struct MachineOverview { pub name: String, /// Its parts, by name. pub parts: Vec, - /// Its open CVEs per severity, a CVE counted once per component. + /// Its open CVEs per severity: its parts' together, as each part + /// decides on its own. pub open: SeverityCounts, /// The open alerts nobody has stated anything on yet. pub undecided: usize, @@ -372,7 +373,7 @@ pub async fn machine_overview( .or_default() .push(alert); } - let parts = machine + let parts: Vec = machine .targets .into_iter() .zip(&machine.ids) @@ -390,9 +391,11 @@ pub async fn machine_overview( let undecided_alerts: Vec<&CveAlert> = alerts.iter().filter(|a| undecided(a)).collect(); Ok(Json(ApiResponse { data: MachineOverview { - name: machine.name, + open: parts + .iter() + .fold(SeverityCounts::default(), |sum, p| sum.plus(p.open)), parts, - open: open_counts(&alerts), + name: machine.name, undecided: undecided_alerts.len(), undecided_with_supplier: undecided_alerts .iter()