diff --git a/compliance-agent/src/pipeline/orchestrator.rs b/compliance-agent/src/pipeline/orchestrator.rs index 0addf3a..6b8df66 100644 --- a/compliance-agent/src/pipeline/orchestrator.rs +++ b/compliance-agent/src/pipeline/orchestrator.rs @@ -1928,7 +1928,9 @@ impl PipelineOrchestrator { // A control application known only by the Siemens controllers // it runs on (SPS item 4a): they are its SBOM, matched against // Siemens' advisories as with a project. - if !target.devices.is_empty() { + // Also when the last one was removed, so its components and + // alerts go with it. + if target.target_type == TargetType::PlcSps || !target.devices.is_empty() { let devices = crate::pipeline::sbom::devices::entries(&target.devices, &target_id); if let Err(e) = self @@ -2321,9 +2323,8 @@ impl PipelineOrchestrator { scan_run_id: &str, mut entries: Vec, ) -> Result<(), AgentError> { - if entries.is_empty() { - return Ok(()); - } + // Empty entries are stored too: the components and alerts of the + // last scan are then gone (callers skip it when nothing was read). crate::pipeline::component_changes::record( &self.db, scan_run_id,