feat(api): the machine page's overview, CVEs and history (#1026) #1037

Merged
sharang merged 3 commits from feat/machine-overview into main 2026-11-17 11:57:04 +00:00
Owner

Part of #1026. This PR is the agent side of the approved machine mockup (https://claude.ai/artifact/XsQesAfoWPYF77y6xTzkhF). The dashboard page follows in its own PR.

Each endpoint resolves the machine as #1036 does: a product project, with its targets that are not archived as its parts.

What

  • GET /api/v1/projects/{id}/overview feeds the "Bestandteile" screen:
    • each part with its supplier, its open CVEs per severity, and when it was last scanned;
    • across all parts:
      • open CVEs per severity: the parts' counts added up, since each part decides on its own (a CVE in two parts counts twice, like the two decisions it needs);
      • undecided ones (no person's statement yet), and how many of those carry a supplier statement;
      • components, each counted once, and how many sit in more than one part. MongoDB counts these, so no entries are loaded;
      • the suppliers' advisories: how many, from how many providers, and when one was last read.
  • GET /api/v1/projects/{id}/cves feeds the "Schwachstellen" screen:
    • the open alerts of every part, grouped by component with the existing grouping, so a component in two parts is one group;
    • the alerts, each naming its part (repo_id). Whether a CVE affects the machine is still decided per part, as on the target.
  • GET /api/v1/projects/{id}/scan-changes?limit= feeds the "Verlauf" screen:
    • the last scans of every part, newest first (at most 50 in total), each naming its part, with its new and gone CVEs and the components it added, updated or removed;
    • a supplier's new version shows as its product updated (from → to);
    • a target's own history moved into a helper (target_changes) that both endpoints use.
  • SeverityCounts::plus sums group counts.
  • Docs: docs/guide/sbom.md.

Differences from the mockup (for the dashboard PR)

  • No "Bestandteil hinzugefügt" row: assigning a target to a project records no history, so the Verlauf can't show it.
  • No SBOM file name in the Verlauf: a scan doesn't record which file it read.

Tests

  • Integration:
    • parts, suppliers and per-part counts;
    • a settled alert and a gone alert are not counted;
    • the undecided counts, the shared component, the advisory count, and the CVE groups with their parts;
    • the history interleaves the parts' scans newest first and keeps the baseline flag.
  • Local runs: the OpenAPI gates, clippy (core and agent, --all-targets -D warnings), and the agent test suite are green.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9

Part of #1026. This PR is the agent side of the approved machine mockup (https://claude.ai/artifact/XsQesAfoWPYF77y6xTzkhF). The dashboard page follows in its own PR. Each endpoint resolves the machine as #1036 does: a product project, with its targets that are not archived as its parts. ## What - **`GET /api/v1/projects/{id}/overview`** feeds the "Bestandteile" screen: - each part with its supplier, its open CVEs per severity, and when it was last scanned; - across all parts: - open CVEs per severity: the parts' counts added up, since each part decides on its own (a CVE in two parts counts twice, like the two decisions it needs); - undecided ones (no person's statement yet), and how many of those carry a supplier statement; - components, each counted once, and how many sit in more than one part. MongoDB counts these, so no entries are loaded; - the suppliers' advisories: how many, from how many providers, and when one was last read. - **`GET /api/v1/projects/{id}/cves`** feeds the "Schwachstellen" screen: - the open alerts of every part, grouped by component with the existing grouping, so a component in two parts is one group; - the alerts, each naming its part (`repo_id`). Whether a CVE affects the machine is still decided per part, as on the target. - **`GET /api/v1/projects/{id}/scan-changes?limit=`** feeds the "Verlauf" screen: - the last scans of every part, newest first (at most 50 in total), each naming its part, with its new and gone CVEs and the components it added, updated or removed; - a supplier's new version shows as its product updated (`from` → `to`); - a target's own history moved into a helper (`target_changes`) that both endpoints use. - `SeverityCounts::plus` sums group counts. - **Docs:** `docs/guide/sbom.md`. ## Differences from the mockup (for the dashboard PR) - **No "Bestandteil hinzugefügt" row:** assigning a target to a project records no history, so the Verlauf can't show it. - **No SBOM file name in the Verlauf:** a scan doesn't record which file it read. ## Tests - **Integration:** - parts, suppliers and per-part counts; - a settled alert and a gone alert are not counted; - the undecided counts, the shared component, the advisory count, and the CVE groups with their parts; - the history interleaves the parts' scans newest first and keeps the baseline flag. - **Local runs:** the OpenAPI gates, clippy (core and agent, `--all-targets -D warnings`), and the agent test suite are green. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang force-pushed feat/machine-overview from dfd2156821 to 27301e38f2 2026-11-17 10:27:31 +00:00 Compare
sharang added 3 commits 2026-11-17 11:35:09 +00:00
GET /api/v1/projects/{id}/overview: the machine's parts with their
supplier, open CVEs and last scan; across them the open and undecided
CVEs (and the undecided ones the supplier states something on), the
components each once and how many parts share, and the suppliers'
advisories. GET /api/v1/projects/{id}/cves: the open alerts of all parts,
grouped by component; a component in two parts is one group, its alerts
still decided per part. Both resolve the machine as the SBOM export does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
GET /api/v1/projects/{id}/scan-changes merges the last scans of the
machine's parts, newest first, each with its part and what it changed
(new and gone CVEs, components added, updated and removed), as a
target's own history; a target's history moves into a helper both use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
fix(api): a machine's open CVEs are its parts' together, as each decides alone (#1026)
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 5m8s
CI / Check (pull_request) Successful in 21m27s
ae3e777228
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang force-pushed feat/machine-overview from 27301e38f2 to ae3e777228 2026-11-17 11:35:09 +00:00 Compare
sharang merged commit 6f42fbd583 into main 2026-11-17 11:57:04 +00:00
sharang deleted branch feat/machine-overview 2026-11-17 11:57:04 +00:00
Sign in to join this conversation.