fix(plc): test data and excluded paths leave the PLC analysis too #828

Merged
sharang merged 1 commits from fix/plc-left-out into main 2026-11-04 09:32:36 +00:00
Owner

Follow-up to #820 and #825.

Why

run_plc_scan reads the ingested trees itself and never goes through scan_tree. So test data (#820) and excluded paths (#825) still reached the PLC control-logic analysis, the native-project check (#827) and the CODESYS SBOM. A git checkout is fetched again for the PLC pass, and that restores whatever the code pass removed.

What

  • Pruning: each PLC source tree goes through prune_left_out (configured paths first, then test data) before anything reads it. What was left out is noted on the run, exactly as for a code scan.
  • Closing stale findings: PLC findings are inserted directly, with no seen-set, so nothing ever closed them. The new RunFindings::resolve_left_out(db, target, scanner) closes the undecided findings of one scanner whose file lies in an excluded path (NowExcluded) or in test data (NowTestData), and nothing else. A finding the scan simply did not see again is not closed as fixed. Person-made decisions stay. Issues follow through IssueSync.
  • Docs: guide/plc.

Tests

  • Integration test only_what_was_left_out_is_closed_for_a_stage_without_a_seen_set (Mongo) covers:
    • excluded and test-data PLC findings close, each with its reason;
    • other PLC findings and other scanners' findings stay open;
    • an accepted risk stays.
  • CI only.

🤖 Generated with Claude Code

Follow-up to #820 and #825. ## Why `run_plc_scan` reads the ingested trees itself and never goes through `scan_tree`. So test data (#820) and excluded paths (#825) still reached the PLC control-logic analysis, the native-project check (#827) and the CODESYS SBOM. A git checkout is fetched again for the PLC pass, and that restores whatever the code pass removed. ## What - **Pruning:** each PLC source tree goes through `prune_left_out` (configured paths first, then test data) before anything reads it. What was left out is noted on the run, exactly as for a code scan. - **Closing stale findings:** PLC findings are inserted directly, with no seen-set, so nothing ever closed them. The new `RunFindings::resolve_left_out(db, target, scanner)` closes the undecided findings of one scanner whose file lies in an excluded path (`NowExcluded`) or in test data (`NowTestData`), and nothing else. A finding the scan simply did not see again is not closed as fixed. Person-made decisions stay. Issues follow through `IssueSync`. - **Docs:** `guide/plc`. ## Tests - Integration test `only_what_was_left_out_is_closed_for_a_stage_without_a_seen_set` (Mongo) covers: - excluded and test-data PLC findings close, each with its reason; - other PLC findings and other scanners' findings stay open; - an accepted risk stays. - CI only. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sharang added 1 commit 2026-11-04 09:14:23 +00:00
fix(plc): test data and excluded paths leave the PLC analysis too
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 5m10s
CI / Check (pull_request) Successful in 17m38s
2e9976f6b5
The PLC control-logic analysis reads the ingested trees itself, outside
the code scan's stages, so #820 (test data) and #825 (excluded paths)
did not reach it: fixtures and excluded paths in a PLC target were
still analysed.

- run_plc_scan prunes each source tree with prune_left_out before the
  analysis, the native-project check and the SBOM, and notes what was
  left out, as a code scan does.
- PLC findings are stored without a seen-set, so nothing used to close
  them. RunFindings::resolve_left_out closes the undecided findings of
  one scanner whose file lies in what was left out (NowExcluded,
  NowTestData), and only those; their issues follow through issue sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sharang merged commit c16e91f981 into main 2026-11-04 09:32:36 +00:00
Sign in to join this conversation.