feat(dashboard): Heute inbox with urgency buckets and dated resubmission (#950) #965

Merged
sharang merged 2 commits from feat/950-heute-inbox into main 2026-11-10 17:22:59 +00:00
Owner

A new landing page Heute: the workspace's open decisions as cards in four urgency buckets. You decide, put off ("Später" with a date) or open the details from the card. The old overview moves to /overview and stays in the sidebar. Nothing is deleted, and the existing lists are unchanged.

Buckets and their exact rules

Pure functions in compliance-core/src/models/inbox.rs (natural_bucket, place), unit-tested. The rules are checked in this order:

  1. KI: wohl Fehlalarm (likely_false_positive): the finding has status == needs_review && triage_action == "dismiss" (every finding of the card, once grouped).
  2. Heute handeln (today): any one of
    • a CVE in CISA KEV;
    • an EPSS percentile ≥ the CVE issues' threshold (CVE_ISSUE_EPSS_PERCENTILE, default 0.95, read through cve_issues::epss_percentile);
    • a CRA Art. 14 notification due (enisa_docs::reportability == Reportable). The chip shows the most urgent stage from enisa_docs::deadlines ("CRA-Frühwarnung in 14 h" / "… überfällig");
    • a secret in code: scan_type == secretdetection with a place outside test code. is_test_path uses the same patterns as gitleaks and triage: test/ tests/ fixtures/ testdata/ __mocks__/, _test., .test., .spec., test_*, mock. A history secret without a path counts as code.
  3. Diese Woche (this_week): severity ≥ high, or a fix version is known (CVE cards).
  4. Später (later): everything else (medium, low, info).

Resubmission: a card with a snooze whose until > now is hidden. Once it is due, the card shows under Später with a "Wiedervorlage seit …" chip, whatever its natural bucket.

Cards: a finding is one card for now (OneCardPerFinding). CVE alerts make one card per (target, package, version), with N CVEs, the highest severity, KEV/EPSS/CRA chips and the highest fixed version (version::cmp_dotted). Within a bucket, cards sort by severity, then by number of reasons, then by number of items.

Decisions that differ from the brief's literal wording (please check)

  • Diese Woche includes critical findings, and CVE cards with severity ≥ high even without a fix. The brief says "high findings; CVEs with a fix". Read literally, a critical finding or a critical CVE without a fix would land in Später.
  • KI comes before Heute. An AI-dismissed secret lands in KI, not in Heute, because the card's decision is "confirm or overrule the AI". Swapping the order is one line in natural_bucket.
  • Due resubmissions go to Später, as the decided rule says, not back to their natural bucket. This also applies to a card that would be Heute.
  • Erstbewertung (Progress): decided / total.
    • decided = findings with status false_positive | ignored | accepted_risk | wrong_mapping, plus alerts still reported with VEX affected | not_affected | fixed.
    • total = decided + open findings (open | triaged | needs_review) + open alerts (no statement or under_investigation).
    • Two deviations: resolved findings and alerts are in neither number (fixed or gone, not a decision), and under_investigation is not decided (the model calls it "not assessed yet"). Items count one by one: a package card with 5 CVEs is 5 alerts.
    • It is scoped to the workspace or to ?target.

API

All routes are tenant-scoped (tenant DB). Writes are POST/DELETE, so the existing org-role middleware gates them (CXO/LEGAL get 403, API keys get scope_missing). Support changes are audited like every other write. Router tests for the new routes are added in role_gate/router_tests.rs.

  • GET /api/v1/inbox?target=<id>&bucket=today|this_week|later|likely_false_positive&limit=<n> returns {data: InboxView}:
    • bucket, counts {today, this_week, later, likely_false_positive}, progress {decided, total};
    • targets [{id, name, cards}]: always every target with cards, for the chips;
    • cards [InboxCard]: the bucket's cards only. Default limit 100, at most 500; the counts always cover all cards.
    • InboxCard: {key, kind: finding|cve_package, bucket, target_id, title, subtitle, severity, count, reasons: [{kind: ai_dismissed|kev|epss|enisa_deadline|secret_in_code|fix_available|resubmission, …}], item_ids, actions: [..], fix_version?, note?}. The primary action comes first.
    • Card keys are stable and URL-safe: f-<finding id>, c-<target id>-<sha256(package\0version)[..16]>.
  • POST /api/v1/inbox/decide {key, action: false_positive|accepted_risk|confirm|not_affected|affected, reason?, justification?, statement?} returns {key, action, previous: [{kind: finding, id, status} | {kind: cve, id, vex}]}.
    • 400 for a malformed key, 409 when nothing on the card is undecided any more, 422 when the card does not offer the action or the reason, justification or statement is missing.
    • A successful decision drops the card's snooze.
  • POST /api/v1/inbox/undo {key, previous}: puts the items back. Refuses (422) items that do not belong to the card, and previous states that were not open.
  • POST /api/v1/inbox/snooze {key, for: {kind: week} | {kind: month} | {kind: date, date: "2026-12-01"}} returns {key, until}. The server computes the date (a date means its start, UTC); a date that is not in the future gets 422. A second snooze replaces the first.
  • DELETE /api/v1/inbox/snooze/{key}: the undo of a snooze (idempotent).

Snooze storage

A new collection inbox_snoozes in each tenant DB: {key, until, by, by_name, at}, with a unique index on key and an index on until (Database::ensure_indexes). This is additive: Finding and CveAlert are not touched (the issue text suggested a field on them; the decision was a separate collection).

How decisions reuse the existing paths

No changes to findings.rs or vex.rs; the inbox calls the existing handlers as functions:

  • Findings: handlers::findings::bulk_update_finding_status with BulkUpdateStatusRequest, the same code as PATCH /api/v1/findings/bulk-status. You get the status-history entry with who and why, the reason check for accepted_risk, and the issue sync. confirm on a KI card sets triaged.
  • CVE cards: handlers::vex::set_cve_vex per alert with VexRequest, the same code as PATCH /api/v1/cves/{id}/vex, including the OpenVEX validation. not_affected takes a justification (select) and/or an impact statement. affected takes an action statement, prefilled with "Auf Version X aktualisieren." when a fix is known.

Undo goes through the same handlers:

  • A finding gets its previous open status back as a new history entry, so the decision stays on record.
  • An alert gets under_investigation, also when it had no statement before. This avoids an $unset outside the VEX code, and both states leave it open, but the alert now carries an under_investigation statement by the user.
  • Undo does not bring back a snooze that the decision dropped.

Dashboard

  • Routes: / is now HeutePage, and OverviewPage moves to /overview (same enum variant, so every Route::OverviewPage link still works).
  • Sidebar: a new first entry, "Heute", shows the workspace's "Heute handeln" count. It is fetched once and kept current by the page through a GlobalSignal. It is a separate TodayNavItem; the existing nav items are unchanged.
  • The page:
    • the Erstbewertung progress bar;
    • target chips;
    • four bucket tiles with counts;
    • the cards of the chosen bucket: severity, title, place or CVE ids, target, reason chips, and the AI's reasoning on KI cards;
    • per card: the primary and secondary action, "Später ▾" (1 Woche, 1 Monat, date input), and "Details →" (to the finding, or to the target page with the CVE/VEX panel for CVE cards);
    • an inline input for decisions that need one (Enter to decide, Esc to cancel);
    • an undo strip for 8 s after each decision or snooze;
    • an empty state per bucket;
    • read-only roles see the cards without actions.
  • Keyboard, registered on the page's own focusable container, so it is never active on other pages. Inputs stop the event, so nothing fires while you type.
    • j/k move between cards.
    • f = false alarm (on CVE cards: not affected).
    • a = risk accepted (on CVE cards: affected).
    • s = later, one week.
    • Esc closes an input.
    • The page takes the focus back after each decision.
    • a does nothing on KI cards, which offer "Fehlalarm bestätigen" and "Doch echt" instead.
  • Code: texts DE+EN in a new texts::inbox module (appended at the end of the file); styles are new inbox-* and nav-count classes at the end of main.css, using the existing tokens.

How #958, #951 and #949 plug in

  • #958: InboxFinding::ai_dismissed() implements the same predicate as Finding::review_reason() (not merged yet). Once #958 merges, switch it to review_reason(). There is a note in the doc comment.
  • #951: findings become cards through the FindingGrouping trait (groups + key). OneCardPerFinding is today's source; a rule+file grouping replaces it in get_inbox. resolve_card and belongs_to then need an arm for the group key prefix.
  • #949: the per-alert set_cve_vex loop (set_vex) can become one call to the group-VEX endpoint. Today a store error in the middle of the loop leaves the earlier alerts stated; validation fails on the first call, before anything is written.

Known trade-offs and follow-ups

  • The snooze key of a CVE card is (target, package, version), so a new CVE arriving for a snoozed package version stays hidden until the date, including a new KEV.
  • GET /inbox loads every open finding (projected to the inbox fields) and every open alert. There is no index on findings.status, which is a possible follow-up.
  • The issue's "after the release" snooze option is not built (decided: 1 week, 1 month, or a date).

How tested

  • Core: 18 unit tests in models::inbox: each bucket rule, KI precedence, a snooze not yet due is hidden, a due one goes to Später, card building for findings and CVE packages (KEV, EPSS threshold on and off, CRA deadline chip, highest fix, actions), decided and resolved alerts, test-path recognition, card keys, snooze dates, view counts, target scoping and limit, wire names.
  • Agent: integration test compliance-agent/tests/inbox.rs, run locally against MongoDB 7 (podman). It covers:
    • the buckets and the Erstbewertung;
    • a CVE decision that needs its justification, then not_affected on both alerts, 409 when deciding again, and undo;
    • accepted_risk without a reason (422) and with one (stored with the reason in the history), and undo;
    • an action the card does not offer (422) and an undo with foreign items (422);
    • the AI confirmation;
    • a snooze in the past (422), a week (hidden), a due one (Später plus chip), and unsnooze.
  • Role gate: router tests include the new routes.
  • Dashboard: unit tests for the shortcut mapping, decision input and fields, chips, texts, and the landing route.
  • Checks:
    • cargo fmt --all --check;
    • clippy -D warnings for compliance-core, compliance-agent, and the dashboard with server and with web;
    • cargo check of the dashboard for wasm32-unknown-unknown.
  • Not verified in a browser: no local stack with Keycloak, so the UI is checked by compile and unit tests only.

Closes #950

🤖 Generated with Claude Code

A new landing page **Heute**: the workspace's open decisions as cards in four urgency buckets. You decide, put off ("Später" with a date) or open the details from the card. The old overview moves to `/overview` and stays in the sidebar. Nothing is deleted, and the existing lists are unchanged. ## Buckets and their exact rules Pure functions in `compliance-core/src/models/inbox.rs` (`natural_bucket`, `place`), unit-tested. The rules are checked in this order: 1. **KI: wohl Fehlalarm** (`likely_false_positive`): the finding has `status == needs_review && triage_action == "dismiss"` (every finding of the card, once grouped). 2. **Heute handeln** (`today`): any one of - a CVE in CISA KEV; - an EPSS percentile ≥ the CVE issues' threshold (`CVE_ISSUE_EPSS_PERCENTILE`, default 0.95, read through `cve_issues::epss_percentile`); - a CRA Art. 14 notification due (`enisa_docs::reportability == Reportable`). The chip shows the most urgent stage from `enisa_docs::deadlines` ("CRA-Frühwarnung in 14 h" / "… überfällig"); - a secret in code: `scan_type == secretdetection` with a place outside test code. `is_test_path` uses the same patterns as gitleaks and triage: `test/ tests/ fixtures/ testdata/ __mocks__/`, `_test.`, `.test.`, `.spec.`, `test_*`, `mock`. A history secret without a path counts as code. 3. **Diese Woche** (`this_week`): severity ≥ high, or a fix version is known (CVE cards). 4. **Später** (`later`): everything else (medium, low, info). **Resubmission:** a card with a snooze whose `until > now` is hidden. Once it is due, the card shows under **Später** with a "Wiedervorlage seit …" chip, whatever its natural bucket. **Cards:** a finding is one card for now (`OneCardPerFinding`). CVE alerts make one card per (target, package, version), with N CVEs, the highest severity, KEV/EPSS/CRA chips and the highest fixed version (`version::cmp_dotted`). Within a bucket, cards sort by severity, then by number of reasons, then by number of items. ### Decisions that differ from the brief's literal wording (please check) - **Diese Woche includes critical findings, and CVE cards with severity ≥ high even without a fix.** The brief says "high findings; CVEs with a fix". Read literally, a critical finding or a critical CVE without a fix would land in Später. - **KI comes before Heute.** An AI-dismissed secret lands in KI, not in Heute, because the card's decision is "confirm or overrule the AI". Swapping the order is one line in `natural_bucket`. - **Due resubmissions go to Später**, as the decided rule says, not back to their natural bucket. This also applies to a card that would be Heute. - **Erstbewertung** (`Progress`): `decided / total`. - decided = findings with status `false_positive | ignored | accepted_risk | wrong_mapping`, plus alerts still reported with VEX `affected | not_affected | fixed`. - total = decided + open findings (`open | triaged | needs_review`) + open alerts (no statement or `under_investigation`). - Two deviations: **resolved findings and alerts are in neither number** (fixed or gone, not a decision), and **`under_investigation` is not decided** (the model calls it "not assessed yet"). Items count one by one: a package card with 5 CVEs is 5 alerts. - It is scoped to the workspace or to `?target`. ## API All routes are tenant-scoped (tenant DB). Writes are POST/DELETE, so the existing org-role middleware gates them (CXO/LEGAL get 403, API keys get `scope_missing`). Support changes are audited like every other write. Router tests for the new routes are added in `role_gate/router_tests.rs`. - `GET /api/v1/inbox?target=<id>&bucket=today|this_week|later|likely_false_positive&limit=<n>` returns `{data: InboxView}`: - `bucket`, `counts {today, this_week, later, likely_false_positive}`, `progress {decided, total}`; - `targets [{id, name, cards}]`: always every target with cards, for the chips; - `cards [InboxCard]`: the bucket's cards only. Default limit 100, at most 500; the counts always cover all cards. - `InboxCard`: `{key, kind: finding|cve_package, bucket, target_id, title, subtitle, severity, count, reasons: [{kind: ai_dismissed|kev|epss|enisa_deadline|secret_in_code|fix_available|resubmission, …}], item_ids, actions: [..], fix_version?, note?}`. The primary action comes first. - Card keys are stable and URL-safe: `f-<finding id>`, `c-<target id>-<sha256(package\0version)[..16]>`. - `POST /api/v1/inbox/decide {key, action: false_positive|accepted_risk|confirm|not_affected|affected, reason?, justification?, statement?}` returns `{key, action, previous: [{kind: finding, id, status} | {kind: cve, id, vex}]}`. - 400 for a malformed key, 409 when nothing on the card is undecided any more, 422 when the card does not offer the action or the reason, justification or statement is missing. - A successful decision drops the card's snooze. - `POST /api/v1/inbox/undo {key, previous}`: puts the items back. Refuses (422) items that do not belong to the card, and previous states that were not open. - `POST /api/v1/inbox/snooze {key, for: {kind: week} | {kind: month} | {kind: date, date: "2026-12-01"}}` returns `{key, until}`. The server computes the date (a date means its start, UTC); a date that is not in the future gets 422. A second snooze replaces the first. - `DELETE /api/v1/inbox/snooze/{key}`: the undo of a snooze (idempotent). ## Snooze storage A new collection `inbox_snoozes` in each tenant DB: `{key, until, by, by_name, at}`, with a unique index on `key` and an index on `until` (`Database::ensure_indexes`). This is additive: `Finding` and `CveAlert` are not touched (the issue text suggested a field on them; the decision was a separate collection). ## How decisions reuse the existing paths No changes to `findings.rs` or `vex.rs`; the inbox calls the existing handlers as functions: - **Findings:** `handlers::findings::bulk_update_finding_status` with `BulkUpdateStatusRequest`, the same code as `PATCH /api/v1/findings/bulk-status`. You get the status-history entry with who and why, the reason check for `accepted_risk`, and the issue sync. `confirm` on a KI card sets `triaged`. - **CVE cards:** `handlers::vex::set_cve_vex` per alert with `VexRequest`, the same code as `PATCH /api/v1/cves/{id}/vex`, including the OpenVEX validation. `not_affected` takes a justification (select) and/or an impact statement. `affected` takes an action statement, prefilled with "Auf Version X aktualisieren." when a fix is known. **Undo** goes through the same handlers: - A finding gets its previous open status back as a new history entry, so the decision stays on record. - An alert gets `under_investigation`, also when it had no statement before. This avoids an `$unset` outside the VEX code, and both states leave it open, but the alert now carries an `under_investigation` statement by the user. - Undo does not bring back a snooze that the decision dropped. ## Dashboard - **Routes:** `/` is now `HeutePage`, and `OverviewPage` moves to `/overview` (same enum variant, so every `Route::OverviewPage` link still works). - **Sidebar:** a new first entry, "Heute", shows the workspace's "Heute handeln" count. It is fetched once and kept current by the page through a `GlobalSignal`. It is a separate `TodayNavItem`; the existing nav items are unchanged. - **The page:** - the Erstbewertung progress bar; - target chips; - four bucket tiles with counts; - the cards of the chosen bucket: severity, title, place or CVE ids, target, reason chips, and the AI's reasoning on KI cards; - per card: the primary and secondary action, "Später ▾" (1 Woche, 1 Monat, date input), and "Details →" (to the finding, or to the target page with the CVE/VEX panel for CVE cards); - an inline input for decisions that need one (Enter to decide, Esc to cancel); - an undo strip for 8 s after each decision or snooze; - an empty state per bucket; - read-only roles see the cards without actions. - **Keyboard**, registered on the page's own focusable container, so it is never active on other pages. Inputs stop the event, so nothing fires while you type. - `j`/`k` move between cards. - `f` = false alarm (on CVE cards: not affected). - `a` = risk accepted (on CVE cards: affected). - `s` = later, one week. - `Esc` closes an input. - The page takes the focus back after each decision. - `a` does nothing on KI cards, which offer "Fehlalarm bestätigen" and "Doch echt" instead. - **Code:** texts DE+EN in a new `texts::inbox` module (appended at the end of the file); styles are new `inbox-*` and `nav-count` classes at the end of `main.css`, using the existing tokens. ## How #958, #951 and #949 plug in - **#958:** `InboxFinding::ai_dismissed()` implements the same predicate as `Finding::review_reason()` (not merged yet). **Once #958 merges, switch it to `review_reason()`.** There is a note in the doc comment. - **#951:** findings become cards through the `FindingGrouping` trait (`groups` + `key`). `OneCardPerFinding` is today's source; a rule+file grouping replaces it in `get_inbox`. `resolve_card` and `belongs_to` then need an arm for the group key prefix. - **#949:** the per-alert `set_cve_vex` loop (`set_vex`) can become one call to the group-VEX endpoint. Today a store error in the middle of the loop leaves the earlier alerts stated; validation fails on the first call, before anything is written. ## Known trade-offs and follow-ups - The snooze key of a CVE card is (target, package, version), so a new CVE arriving for a snoozed package version stays hidden until the date, including a new KEV. - GET `/inbox` loads every open finding (projected to the inbox fields) and every open alert. There is no index on `findings.status`, which is a possible follow-up. - The issue's "after the release" snooze option is not built (decided: 1 week, 1 month, or a date). ## How tested - **Core:** 18 unit tests in `models::inbox`: each bucket rule, KI precedence, a snooze not yet due is hidden, a due one goes to Später, card building for findings and CVE packages (KEV, EPSS threshold on and off, CRA deadline chip, highest fix, actions), decided and resolved alerts, test-path recognition, card keys, snooze dates, view counts, target scoping and limit, wire names. - **Agent:** integration test `compliance-agent/tests/inbox.rs`, run locally against MongoDB 7 (podman). It covers: - the buckets and the Erstbewertung; - a CVE decision that needs its justification, then `not_affected` on both alerts, 409 when deciding again, and undo; - `accepted_risk` without a reason (422) and with one (stored with the reason in the history), and undo; - an action the card does not offer (422) and an undo with foreign items (422); - the AI confirmation; - a snooze in the past (422), a week (hidden), a due one (Später plus chip), and unsnooze. - **Role gate:** router tests include the new routes. - **Dashboard:** unit tests for the shortcut mapping, decision input and fields, chips, texts, and the landing route. - **Checks:** - `cargo fmt --all --check`; - clippy `-D warnings` for compliance-core, compliance-agent, and the dashboard with `server` and with `web`; - `cargo check` of the dashboard for `wasm32-unknown-unknown`. - **Not verified in a browser:** no local stack with Keycloak, so the UI is checked by compile and unit tests only. Closes #950 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

Rebased onto the merged dashboard PRs. Resolution:

  • Routes (finding-groups from #961 and inbox), CSS and texts: both sides are kept.
  • The CVE card's "Details" link built Route::TargetPage { id }. #962 gave that route a CVE-cell query, so the link now uses Route::target(...).

Checked locally: fmt, clippy -D warnings (agent, dashboard server and web), dashboard lib tests (178) and core models::inbox (18).

Rebased onto the merged dashboard PRs. Resolution: - Routes (`finding-groups` from #961 and `inbox`), CSS and texts: both sides are kept. - The CVE card's "Details" link built `Route::TargetPage { id }`. #962 gave that route a CVE-cell query, so the link now uses `Route::target(...)`. Checked locally: fmt, clippy `-D warnings` (agent, dashboard server and web), dashboard lib tests (178) and core `models::inbox` (18).
sharang added 2 commits 2026-11-10 17:00:55 +00:00
GET /api/v1/inbox sorts the open findings and CVE alerts into four buckets
(Heute handeln, Diese Woche, Später, KI: wohl Fehlalarm), one card per
decision: a finding, or the CVE alerts of one package version. Decisions on
a card go through the findings' bulk-status and the VEX handlers, undo
restores the previous open state, and snoozes live in inbox_snoozes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
feat(dashboard): Heute inbox with urgency buckets and dated resubmission (#950)
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 6m22s
CI / Check (pull_request) Successful in 21m37s
f0542325ee
A new landing page "Heute" (the overview moves to /overview and stays in
the sidebar): the Erstbewertung, target chips, the four bucket tiles and
the cards of the chosen bucket with their decisions, "Später" with one
week, one month or a date, "Details", an undo strip after each decision,
and the keys j/k/f/a/s on this page only. The sidebar's "Heute" entry
shows the workspace's "Heute handeln" count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sharang force-pushed feat/950-heute-inbox from 3c806d12b4 to f0542325ee 2026-11-10 17:00:55 +00:00 Compare
sharang merged commit d6986d23b1 into main 2026-11-10 17:22:59 +00:00
Sign in to join this conversation.