From 90bcb6e4f8dc1ab973a208c7faa76061673a2f48 Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Date: Thu, 8 Oct 2026 23:26:00 +0200 Subject: [PATCH] fix(plc): a committed CODESYS project types a repository PLC only on its own A code repository that also keeps a CODESYS project (a package.json, pom.xml or Cargo.toml beside it) stays a code target and keeps its code scans; its CODESYS components and runtime CVEs are collected by the code pipeline either way. The committed-files verdict drops below the backend manifests; a repository with nothing but the archive is still PLC. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p --- compliance-agent/src/classify/language.rs | 12 ++++++++---- docs/guide/plc.md | 9 ++++++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/compliance-agent/src/classify/language.rs b/compliance-agent/src/classify/language.rs index ac2cf63..332427c 100644 --- a/compliance-agent/src/classify/language.rs +++ b/compliance-agent/src/classify/language.rs @@ -471,11 +471,15 @@ impl HeuristicClassifier { facts_lang("iec-61131-3"), )); } - // A CODESYS project (or its archive) committed to the repository. + // A CODESYS project (or its archive) committed to the repository: + // PLC when nothing else is there. Below a backend manifest, so a + // code repository that also keeps a PLC project stays a code + // target (its CODESYS components are collected either way) and + // keeps its code scans. if m.has_ext("projectarchive") || m.has_ext("project") { out.push(verdict( TargetType::PlcSps, - 0.85, + 0.5, "CODESYS project files", facts_lang("iec-61131-3"), )); @@ -908,7 +912,7 @@ mod tests { } #[tokio::test] - async fn a_committed_codesys_archive_is_plc_even_beside_a_backend_manifest() { + async fn a_committed_codesys_archive_is_plc_unless_code_is_beside_it() { let only_archive = classify_tree(|root| { fs::write(root.join("Line.projectarchive"), b"PK").unwrap(); }) @@ -920,7 +924,7 @@ mod tests { fs::write(root.join("package.json"), "{}").unwrap(); }) .await; - assert_eq!(top(&mixed), TargetType::PlcSps); + assert_eq!(top(&mixed), TargetType::BackendService); } #[tokio::test] diff --git a/docs/guide/plc.md b/docs/guide/plc.md index 5a0b8ea..7704eae 100644 --- a/docs/guide/plc.md +++ b/docs/guide/plc.md @@ -134,9 +134,12 @@ my-plc-project/ ::: A `.projectarchive` (or a CODESYS `.project`) in a repository or an uploaded -archive marks it as a PLC project when Prüfwerk detects the type. A repository -created through the managed git source therefore becomes **SPS / PLC** on its -first scan, and later scans run the control-logic analysis. Whatever the +archive marks it as a PLC project when Prüfwerk detects the type and the +repository holds no application code with a build manifest. A repository +created through the managed git source with only a CODESYS project therefore +becomes **SPS / PLC** on its first scan, and later scans run the control-logic +analysis; one that also holds, say, a `package.json` or `pom.xml` stays a code +target. Whatever the target's type, the library + runtime SBOM and its CVEs come from every `.projectarchive` the code holds, so a target kept as **Backend / API** still lists its CODESYS components.