From bfd9bb79be5b3f0f1a38207d3e33a423d718dc92 Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Date: Tue, 17 Nov 2026 13:15:17 +0100 Subject: [PATCH] fix(scans): a supplier-SBOM-only target's skipped code reads as such, not as the Yocto recipe note (#1042) A target without code recorded one note for its skipped code stages, naming the recipe inventory and recipe lint too; the dashboard matched 'recipe inventory' and showed the Yocto text 'Das Rezept-Inventar ... ist in Arbeit' on any such target. The agent now says what it reads instead (the supplier SBOM, or the build output with its recipe stages), the dashboard words both, an older note reads as the build-output one, and the stage is labelled 'Quellcode'. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9 --- compliance-agent/src/pipeline/orchestrator.rs | 25 ++-- compliance-dashboard/src/i18n/texts.rs | 113 ++++++++++++------ 2 files changed, 96 insertions(+), 42 deletions(-) diff --git a/compliance-agent/src/pipeline/orchestrator.rs b/compliance-agent/src/pipeline/orchestrator.rs index 438d899..3acce96 100644 --- a/compliance-agent/src/pipeline/orchestrator.rs +++ b/compliance-agent/src/pipeline/orchestrator.rs @@ -88,6 +88,16 @@ pub struct PipelineOrchestrator { pub(super) charged_as: Option, } +/// Why a target with only a build output skips its code stages: what the +/// dashboard words from it (`coverage::reason`). +const NO_CODE_BUILD_OUTPUT: &str = "the target has no source code (a git repository or a \ + source archive): only its build output is read; code analysis, the recipe inventory and \ + the recipe lint need the code"; + +/// Why a target with only a supplier SBOM (#1025) skips its code stages. +const NO_CODE_SUPPLIER_SBOM: &str = "the target has no source code (a git repository or a \ + source archive): only its supplier SBOM is read; code analysis needs the code"; + impl PipelineOrchestrator { pub fn new(config: AgentConfig, tenant_id: &str, db: Database, llm: Arc) -> Self { let secrets = SecretBox::from_config(&config); @@ -3213,15 +3223,16 @@ impl PipelineOrchestrator { }) else { return Ok(0); }; + // What is read instead of code: a build output brings the recipe + // stages a supplier SBOM does not (#1042). + let reason = if target.has(ArtifactKind::BuildOutput) { + NO_CODE_BUILD_OUTPUT + } else { + NO_CODE_SUPPLIER_SBOM + }; self.skip_stage( scan_run_id, - SkippedStage::new( - "source_code", - SkipCode::NotAnalysedYet, - "the target has no source code (a git repository or a source archive): only \ - its build output or supplier SBOM is read; code analysis, the recipe \ - inventory and the recipe lint need the code", - ), + SkippedStage::new("source_code", SkipCode::NotAnalysedYet, reason), ) .await; // Under the agent's own work directory, so it is never a tree the diff --git a/compliance-dashboard/src/i18n/texts.rs b/compliance-dashboard/src/i18n/texts.rs index fcc4abc..4c0d945 100644 --- a/compliance-dashboard/src/i18n/texts.rs +++ b/compliance-dashboard/src/i18n/texts.rs @@ -630,6 +630,10 @@ pub mod scans { de: "Codeanalyse", en: "Code analysis", }, + "source_code" => Text { + de: "Quellcode", + en: "Source code", + }, "sast" => Text { de: "Statische Codeanalyse (Semgrep)", en: "Static analysis (semgrep)", @@ -4880,6 +4884,18 @@ pub mod coverage { Firmware-Build", en: "Yocto build analysis is planned (tier 2); a layer tree is not a firmware build", }; + pub const NO_CODE_SUPPLIER_SBOM: Text = Text { + de: "Kein Quellcode (Git-Repository oder Archiv): gelesen wird die SBOM des \ + Zulieferers; die Codeanalyse braucht den Code", + en: "no source code (a git repository or an archive): the supplier's SBOM is read; \ + code analysis needs the code", + }; + pub const NO_CODE_BUILD_OUTPUT: Text = Text { + de: "Kein Quellcode (Git-Repository oder Archiv): gelesen werden nur die \ + Build-Ergebnisse; Codeanalyse, Rezept-Inventar und Rezept-Prüfung brauchen den Code", + en: "no source code (a git repository or an archive): only the build output is read; \ + code analysis, the recipe inventory and recipe lint need the code", + }; pub const RECIPE_INVENTORY_PLANNED: Text = Text { de: "Das Rezept-Inventar (Stückliste und CVEs aus den BitBake-Rezepten) ist in Arbeit", en: "the recipe inventory (SBOM and CVEs from the BitBake recipes) is in progress", @@ -4901,41 +4917,48 @@ pub mod coverage { // Missing artifacts name the kind as `no artifact provided`; // scans no stage runs yet explain themselves in prose. // Yocto first: its image reasons also name firmware images. - let text = if r.contains("yocto build analysis") { - YOCTO_BUILD_PLANNED - } else if r.contains("build_output") { - NEEDS_BUILD_OUTPUT - } else if r.contains("recipe inventory") { - RECIPE_INVENTORY_PLANNED - } else if r.contains("recipe lint") { - RECIPE_LINT_PLANNED - } else if r.contains("uploaded archive") { - UPLOAD_BESIDE_GIT - } else if r.contains("http(s) live url") { - NEEDS_WEB_URL - } else if r.contains("firmware_image") { - NEEDS_FIRMWARE - } else if r.contains("container_image") { - NEEDS_CONTAINER - } else if r.contains("mobile_package") { - NEEDS_MOBILE - } else if r.contains("git_repo") { - NEEDS_CODE - } else if r.contains("plc_project") { - NEEDS_PLC - } else if r.contains("live_url") { - NEEDS_DEVICE - } else if r.contains("firmware image") { - IMAGE_NOT_ANALYSED - } else if r.contains("container images") { - CONTAINER_NOT_SCANNED - } else if r.contains("mobile packages") { - MOBILE_NOT_ANALYSED - } else if r.contains("artifact") { - NEEDS_ARTIFACT - } else { - return None; - }; + // A target without code first: its reason names the recipe stages + // a build output would have run (#1042). + let text = + if r.contains("has no source code") && r.contains("only its supplier sbom is read") { + NO_CODE_SUPPLIER_SBOM + } else if r.contains("has no source code") { + NO_CODE_BUILD_OUTPUT + } else if r.contains("yocto build analysis") { + YOCTO_BUILD_PLANNED + } else if r.contains("build_output") { + NEEDS_BUILD_OUTPUT + } else if r.contains("recipe inventory") { + RECIPE_INVENTORY_PLANNED + } else if r.contains("recipe lint") { + RECIPE_LINT_PLANNED + } else if r.contains("uploaded archive") { + UPLOAD_BESIDE_GIT + } else if r.contains("http(s) live url") { + NEEDS_WEB_URL + } else if r.contains("firmware_image") { + NEEDS_FIRMWARE + } else if r.contains("container_image") { + NEEDS_CONTAINER + } else if r.contains("mobile_package") { + NEEDS_MOBILE + } else if r.contains("git_repo") { + NEEDS_CODE + } else if r.contains("plc_project") { + NEEDS_PLC + } else if r.contains("live_url") { + NEEDS_DEVICE + } else if r.contains("firmware image") { + IMAGE_NOT_ANALYSED + } else if r.contains("container images") { + CONTAINER_NOT_SCANNED + } else if r.contains("mobile packages") { + MOBILE_NOT_ANALYSED + } else if r.contains("artifact") { + NEEDS_ARTIFACT + } else { + return None; + }; Some(text) } } @@ -4996,6 +5019,26 @@ mod coverage_tests { "recipe lint (oelint-adv) over the layers is planned", coverage::RECIPE_LINT_PLANNED, ), + // The agent's notes for a target without code, which name the + // recipe stages too (#1042). + ( + "the target has no source code (a git repository or a source archive): only \ + its supplier SBOM is read; code analysis needs the code", + coverage::NO_CODE_SUPPLIER_SBOM, + ), + ( + "the target has no source code (a git repository or a source archive): only \ + its build output is read; code analysis, the recipe inventory and the recipe \ + lint need the code", + coverage::NO_CODE_BUILD_OUTPUT, + ), + // As runs before #1042 stored it. + ( + "the target has no source code (a git repository or a source archive): only \ + its build output or supplier SBOM is read; code analysis, the recipe \ + inventory and the recipe lint need the code", + coverage::NO_CODE_BUILD_OUTPUT, + ), ]; for (raw, want) in cases { assert_eq!(reason(raw), Some(want), "{raw}");