fix(dashboard): target page reloads findings, SBOM and CRA status when a scan finishes #530

Merged
sharang merged 2 commits from fix/b-target-refresh into main 2026-10-08 21:50:23 +00:00
Owner

What was wrong

On the Prüfobjekt detail page the scan history (Prüfläufe) already refreshed itself every 5 s while a run was running (#423). But everything above it was loaded once: offene Befunde, the SBOM card (Komponenten, bekannte Schwachstellen), the CRA status bar and the detected facts. After a scan completed they kept their old values (often empty for a first scan) until the page was reloaded by hand.

I did not find a defect in the run-list poll itself (fetch_target_scan_runs is a POST server fn, so no browser caching; same use_future pattern as the Prüfobjekte list). If on stage the run badge itself stays at "läuft", that is a separate issue; please say so.

What changed

  • ScanRunList takes an optional on_finished handler, called once when a run it saw running has finished (completed, failed or interrupted). Covers scans started on the page and scans started elsewhere (webhook, schedule) while the page is open.
  • The target page passes a handler that reloads the CRA/SBOM status, the open findings and the target (detected facts). No additional polling: the existing run-list poll is the only timer.
  • The transition detection is now a pure function run_transitions with a unit test.
  • A poll no longer re-arms the "expect a just-started run" flag for a scan that was already expected, so the list stops polling as soon as the run finishes (before it kept polling up to a minute longer).

Tests

  • New components::scan_runs::tests::a_run_seen_running_counts_as_finished_once; cargo test -p compliance-dashboard --features server --no-default-features --lib components::scan_runs (4 passed).
  • cargo fmt --all --check, clippy -D warnings for compliance-dashboard with server and with web.
  • Not verified in a browser locally.

Stage re-test

  1. Open a Prüfobjekt and click "Prüfung starten"; stay on the page.
  2. Watch Prüfläufe: the run shows as running with its steps, then switches to abgeschlossen without a reload.
  3. At that moment the cards update by themselves: offene Befunde (count and list), SBOM Komponenten / bekannte Schwachstellen and the CRA bar.
  4. Open the Netzwerk tab of the browser dev tools after the run finished: the scan-run requests stop within ~5 s.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p

## What was wrong On the Prüfobjekt detail page the scan history (Prüfläufe) already refreshed itself every 5 s while a run was running (#423). But everything above it was loaded once: offene Befunde, the SBOM card (Komponenten, bekannte Schwachstellen), the CRA status bar and the detected facts. After a scan completed they kept their old values (often empty for a first scan) until the page was reloaded by hand. I did not find a defect in the run-list poll itself (`fetch_target_scan_runs` is a POST server fn, so no browser caching; same `use_future` pattern as the Prüfobjekte list). If on stage the run badge itself stays at "läuft", that is a separate issue; please say so. ## What changed - `ScanRunList` takes an optional `on_finished` handler, called once when a run it saw running has finished (completed, failed or interrupted). Covers scans started on the page and scans started elsewhere (webhook, schedule) while the page is open. - The target page passes a handler that reloads the CRA/SBOM status, the open findings and the target (detected facts). No additional polling: the existing run-list poll is the only timer. - The transition detection is now a pure function `run_transitions` with a unit test. - A poll no longer re-arms the "expect a just-started run" flag for a scan that was already expected, so the list stops polling as soon as the run finishes (before it kept polling up to a minute longer). ## Tests - New `components::scan_runs::tests::a_run_seen_running_counts_as_finished_once`; `cargo test -p compliance-dashboard --features server --no-default-features --lib components::scan_runs` (4 passed). - `cargo fmt --all --check`, clippy `-D warnings` for compliance-dashboard with `server` and with `web`. - Not verified in a browser locally. ## Stage re-test 1. Open a Prüfobjekt and click "Prüfung starten"; stay on the page. 2. Watch Prüfläufe: the run shows as running with its steps, then switches to abgeschlossen without a reload. 3. At that moment the cards update by themselves: offene Befunde (count and list), SBOM Komponenten / bekannte Schwachstellen and the CRA bar. 4. Open the Netzwerk tab of the browser dev tools after the run finished: the scan-run requests stop within ~5 s. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang added 1 commit 2026-10-08 21:21:39 +00:00
fix(dashboard): target page reloads findings, SBOM and CRA status when a scan finishes
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 / Check (pull_request) Successful in 13m14s
5fe9562536
The scan history on the target page already polled while a run was
running, but the cards above it (offene Befunde, SBOM components and known
vulnerabilities, CRA status, detected facts) were loaded once and stayed
at their old values until a manual reload.

ScanRunList now reports a run it saw running that has finished
(on_finished), and the target page reloads those resources then. The
transition is a pure function with a unit test. A poll no longer
re-expects an already expected started scan, so the list stops polling
right after the run finishes instead of up to a minute later.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang added 1 commit 2026-10-08 21:36:37 +00:00
docs(scanning): the target page updates its cards when a scan finishes
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 / Check (pull_request) Successful in 12m34s
48f3606b75
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang merged commit 10cebd894f into main 2026-10-08 21:50:23 +00:00
Sign in to join this conversation.