Only undecided findings are grouped: open, triaged, needs_review. This is the same set as health::OPEN_STATUSES and finding_store::UNDECIDED.
Key: (repo_id, scanner, rule, scope, place).
rule is rule_id, or the title when a finding has no rule id.
scanner is part of the key because rule ids belong to each tool. #464 keys on the scanner too.
File scope: the findings of one rule in one file form one group.
Directory scope: when a rule fires in DIRECTORY_MIN_FILES (3) or more distinct files of the same directory, those files form one group for the directory.
Only files directly in the directory count, not files in subdirectories.
The top level is "".
A stored #464 group (non-empty occurrences) is a group of its own with scope repository, keyed by its fingerprint. It is never merged with other findings. places counts its occurrences.
Findings without a file (dependency, endpoint) group by rule, with place: null.
Sort order: highest severity first, then most places, then the key.
AI reason:
needs_review plus triage_action == "dismiss" reads as "KI: wohl Fehlalarm".
Any other needs_review reads as "KI: unsicher".
The card shows how many members the verdict covers ("3 von 12") and the first rationale, a dismissal's first.
API
GET /api/v1/finding-groups[?target=<repo_id>]
{"data":[{"key":{"repo_id":"...","scanner":"gdpr-patterns","rule":"pii-logged","scope":"file"|"directory"|"repository","place":"src/patterns.rs"},"title":"PII data potentially logged","severity":"medium","places":12,"review":{"likely_false_alarm":3,"unsure":0,"rationale":"..."},"members":[Finding,...]}],"total":4}
The members are read without code_snippet, suggested_fix, remediation, status_history and legacy_fingerprints. Those are on each finding's own page.
POST /api/v1/finding-groups/decide, body { "key": GroupKey, "status": FindingStatus, "reason"?: string }, answers { "status": "updated", "members": n, "modified_count": n }.
422 when the status is not a decision. open, triaged and needs_review are refused.
422 for accepted_risk or wrong_mapping without a reason. This check comes from the shared status_update.
404 when the group has no undecided member any more.
400 for an unknown status or scope (serde).
Write role: the endpoint is a POST and not in READ_ONLY_POSTS, so the existing org-role middleware enforces write access. CXO and Legal get 403, and support follows the support rules. Both routes are added to the router-gate test table.
API keys: the new routes are not added to KEY_SCOPES, because the key surface is curated. Adding them would be a two-line follow-up (findings.read / findings.write).
How a decision reuses the single-status path
The members are found again from the key at decide time. Only undecided findings of that rule in that target are candidates, and the same group_findings picks the group.
The update filter also requires an undecided status. A member someone decided in the meantime keeps that decision, and the decision applies to what is open now, not to what a stale view showed.
The change is built by status_update, which also serves single changes. It records who, when and why, including support marking.
It is applied by findings::apply_status, which I extracted from bulk_update_finding_status. The bulk handler calls it too. It runs update_many and then issue_sync.spawn(ids), so each member's issue closes or reopens exactly as with a single change.
compliance_core::models::finding_group::group_findings(findings) -> Vec<FindingGroup> and members_of(findings, &key) -> Vec<ObjectId> are pure functions with no database access. They live in compliance-core, so the agent handlers and the dashboard share the wire types. is_undecided(&status) is public too.
The AI-reason predicate is copied into finding_group::ai_review because Finding::review_reason() from #958 is not merged yet. Once #958 lands, ai_review should switch to Finding::review_reason() (one function). I did not touch finding.rs, triage.rs or finding_detail.rs.
UI
Findings list:
Toggle: a "Gruppiert / Einzeln" toggle, default Gruppiert.
Group view: lives in the new components/finding_groups.rs. pages/findings.rs only gets the toggle, the mount (one guard arm in the existing match, so no re-indent), disabled on the filters that do not apply, and the bulk bar hidden in grouped view.
Cards show:
the severity badge
the line "PII data potentially logged — 12 Stellen in patterns.rs", with the full path as the tooltip
the tool and the rule; the target name too when all targets are listed
the AI verdict and reason
"Stellen zeigen", which expands to the member rows, each linking to /findings/{id}
Group actions: "Fehlalarm (alle N)" and "Risiko akzeptiert (alle N)". The second opens an inline reason field, because an accepted risk needs a reason. Read-only roles see no actions.
Filters: in grouped view only the target filter applies. Severity, type, status, variant and search are disabled, and the hint line under the toggle says so.
Not included:
Ticket für alle N: no finding-to-ticket endpoint exists (only GET /issues). Issue creation is pipeline-side (issue_creation.rs, owned by #948), and adding it here would not be small.
Texts are in German and English (texts::finding_groups). Styles are small fgroup-* / view-switch* classes appended to main.css.
How it was tested
compliance-core: 13 unit tests plus 1 doctest. They cover:
same rule, same file gives one group, members ordered by line
different files, rules or tools give separate groups
3 or more files in one directory give a directory group; subdirectories and other directories stay apart
2 files stay one group each
top-level directory
decided findings are left out (triaged stays in)
a stored #464 group is not merged and places counts its occurrences
findings without a file or rule still group
severity sort
AI review counts and rationale
members_of by key, including an unknown key
key serde
compliance-agent: 4 tests on the decide path's validation:
only decisions are accepted
an accepted risk needs a reason and the history records who and why
the key reads from the wire, and an unknown status or scope is refused
the candidate filter
The router-gate tests now include both routes. The read-only roles test checks the GET is allowed and the POST is refused. The existing findings handler tests still pass after the apply_status extraction.
compliance-dashboard: 3 text tests and 3 component tests (place labels, target names).
Part of epic #955. A rule that fires at several places in one file is now one decision.
## Approach: (a) read-side grouping
I went with **(a)**: groups are computed when they are read, and nothing about them is stored.
I did not extend the #464 model (`pipeline::grouping::group_repetitive`) for these reasons:
- #464 rewrites the stored findings at scan time. The group gets a repo-wide fingerprint, its own issue, and `Grouped`/`Inherited` history entries.
- Lowering its threshold would change stored data, issue creation and history for every tenant on their next scan.
- It would also merge places permanently: a later fix to one place could no longer close that one finding.
With (a), every group decision is an ordinary per-finding status change. The status history, the issue sync, VEX and the evidence pack work unchanged.
## Grouping rules (`compliance_core::models::finding_group`)
- **Only undecided findings** are grouped: `open`, `triaged`, `needs_review`. This is the same set as `health::OPEN_STATUSES` and `finding_store::UNDECIDED`.
- **Key**: `(repo_id, scanner, rule, scope, place)`.
- `rule` is `rule_id`, or the title when a finding has no rule id.
- `scanner` is part of the key because rule ids belong to each tool. #464 keys on the scanner too.
- **File scope**: the findings of one rule in one file form one group.
- **Directory scope**: when a rule fires in `DIRECTORY_MIN_FILES` (3) or more distinct files of the same directory, those files form one group for the directory.
- Only files directly in the directory count, not files in subdirectories.
- The top level is `""`.
- **A stored #464 group** (non-empty `occurrences`) is a group of its own with scope `repository`, keyed by its fingerprint. It is never merged with other findings. `places` counts its occurrences.
- **Findings without a file** (dependency, endpoint) group by rule, with `place: null`.
- **Sort order**: highest severity first, then most places, then the key.
- **AI reason**:
- `needs_review` plus `triage_action == "dismiss"` reads as "KI: wohl Fehlalarm".
- Any other `needs_review` reads as "KI: unsicher".
- The card shows how many members the verdict covers ("3 von 12") and the first rationale, a dismissal's first.
## API
`GET /api/v1/finding-groups[?target=<repo_id>]`
```json
{ "data": [ { "key": { "repo_id": "...", "scanner": "gdpr-patterns", "rule": "pii-logged",
"scope": "file" | "directory" | "repository", "place": "src/patterns.rs" },
"title": "PII data potentially logged", "severity": "medium", "places": 12,
"review": { "likely_false_alarm": 3, "unsure": 0, "rationale": "..." },
"members": [ Finding, ... ] } ],
"total": 4 }
```
The members are read without `code_snippet`, `suggested_fix`, `remediation`, `status_history` and `legacy_fingerprints`. Those are on each finding's own page.
`POST /api/v1/finding-groups/decide`, body `{ "key": GroupKey, "status": FindingStatus, "reason"?: string }`, answers `{ "status": "updated", "members": n, "modified_count": n }`.
- **422** when the status is not a decision. `open`, `triaged` and `needs_review` are refused.
- **422** for `accepted_risk` or `wrong_mapping` without a reason. This check comes from the shared `status_update`.
- **404** when the group has no undecided member any more.
- **400** for an unknown status or scope (serde).
**Write role**: the endpoint is a POST and not in `READ_ONLY_POSTS`, so the existing org-role middleware enforces write access. CXO and Legal get 403, and support follows the support rules. Both routes are added to the router-gate test table.
**API keys**: the new routes are not added to `KEY_SCOPES`, because the key surface is curated. Adding them would be a two-line follow-up (`findings.read` / `findings.write`).
## How a decision reuses the single-status path
1. The members are found again from the key at decide time. Only undecided findings of that rule in that target are candidates, and the same `group_findings` picks the group.
2. The update filter also requires an undecided status. A member someone decided in the meantime keeps that decision, and the decision applies to what is open now, not to what a stale view showed.
3. The change is built by `status_update`, which also serves single changes. It records who, when and why, including support marking.
4. It is applied by `findings::apply_status`, which I extracted from `bulk_update_finding_status`. The bulk handler calls it too. It runs `update_many` and then `issue_sync.spawn(ids)`, so each member's issue closes or reopens exactly as with a single change.
## How #950 (Heute inbox) can call it
`compliance_core::models::finding_group::group_findings(findings) -> Vec<FindingGroup>` and `members_of(findings, &key) -> Vec<ObjectId>` are pure functions with no database access. They live in `compliance-core`, so the agent handlers and the dashboard share the wire types. `is_undecided(&status)` is public too.
## PR #958 note
The AI-reason predicate is copied into `finding_group::ai_review` because `Finding::review_reason()` from #958 is not merged yet. Once #958 lands, `ai_review` should switch to `Finding::review_reason()` (one function). I did not touch `finding.rs`, `triage.rs` or `finding_detail.rs`.
## UI
Findings list:
- **Toggle**: a "Gruppiert / Einzeln" toggle, default Gruppiert.
- **Group view**: lives in the new `components/finding_groups.rs`. `pages/findings.rs` only gets the toggle, the mount (one guard arm in the existing `match`, so no re-indent), `disabled` on the filters that do not apply, and the bulk bar hidden in grouped view.
- **Cards** show:
- the severity badge
- the line "PII data potentially logged — 12 Stellen in patterns.rs", with the full path as the tooltip
- the tool and the rule; the target name too when all targets are listed
- the AI verdict and reason
- "Stellen zeigen", which expands to the member rows, each linking to `/findings/{id}`
- **Group actions**: "Fehlalarm (alle N)" and "Risiko akzeptiert (alle N)". The second opens an inline reason field, because an accepted risk needs a reason. Read-only roles see no actions.
- **Filters**: in grouped view only the target filter applies. Severity, type, status, variant and search are disabled, and the hint line under the toggle says so.
**Not included:**
- **Ticket für alle N**: no finding-to-ticket endpoint exists (only `GET /issues`). Issue creation is pipeline-side (`issue_creation.rs`, owned by #948), and adding it here would not be small.
- **Später**: this is the snooze from #950.
Texts are in German and English (`texts::finding_groups`). Styles are small `fgroup-*` / `view-switch*` classes appended to `main.css`.
## How it was tested
- `compliance-core`: 13 unit tests plus 1 doctest. They cover:
- same rule, same file gives one group, members ordered by line
- different files, rules or tools give separate groups
- 3 or more files in one directory give a directory group; subdirectories and other directories stay apart
- 2 files stay one group each
- top-level directory
- decided findings are left out (triaged stays in)
- a stored #464 group is not merged and `places` counts its occurrences
- findings without a file or rule still group
- severity sort
- AI review counts and rationale
- `members_of` by key, including an unknown key
- key serde
- `compliance-agent`: 4 tests on the decide path's validation:
- only decisions are accepted
- an accepted risk needs a reason and the history records who and why
- the key reads from the wire, and an unknown status or scope is refused
- the candidate filter
- The router-gate tests now include both routes. The read-only roles test checks the GET is allowed and the POST is refused. The existing findings handler tests still pass after the `apply_status` extraction.
- `compliance-dashboard`: 3 text tests and 3 component tests (place labels, target names).
Checks (`-j8`, `RUSTFLAGS="-D warnings"`), all clean:
- `cargo fmt --all --check`
- `cargo clippy -p compliance-core --all-targets -- -D warnings`
- `cargo clippy -p compliance-agent --all-targets -- -D warnings`
- `cargo clippy -p compliance-dashboard --features server --no-default-features --all-targets -- -D warnings`
- `cargo clippy -p compliance-dashboard --features web --no-default-features --all-targets -- -D warnings`
Not exercised locally: the endpoints against a live MongoDB, and the UI in a browser.
## Open points
- **No paging**: the all-targets group list is one unpaged query, with a light projection. If a tenant outgrows it, it needs paging or a `target` default.
- **No auto-refresh**: the grouped view does not refresh by itself while a scan runs. The single view still does.
Closes #951
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Rebased onto #964 (findings charts), which also edits pages/findings.rs. Resolution:
Imports, module registrations and CSS: both sides are kept.
Grouped view vs. chart filters: the grouped view ignores the type, severity and path filters, but #964's charts open the list through exactly those filters. While the URL carries a chart filter (scan_type, severity or path), the page starts in, and switches to, the single list. Without one it defaults to grouped as before. The toggle still works.
Checked locally on the merged tree: fmt, clippy -D warnings (agent, dashboard server and web), dashboard lib tests (155), core finding tests (33) and agent API tests (109).
Rebased onto #964 (findings charts), which also edits `pages/findings.rs`. Resolution:
- Imports, module registrations and CSS: both sides are kept.
- Grouped view vs. chart filters: the grouped view ignores the type, severity and path filters, but #964's charts open the list through exactly those filters. While the URL carries a chart filter (`scan_type`, `severity` or `path`), the page starts in, and switches to, the single list. Without one it defaults to grouped as before. The toggle still works.
Checked locally on the merged tree: fmt, clippy `-D warnings` (agent, dashboard server and web), dashboard lib tests (155), core finding tests (33) and agent API tests (109).
Undecided findings are grouped on read, by target, tool, rule and file,
and by directory when a rule fires in three or more files of one
directory. A stored #464 group stays a group of its own. Nothing about
groups is stored.
- compliance-core: models::finding_group with the pure group_findings
and members_of, for the findings list and later the Heute inbox.
- GET /api/v1/finding-groups[?target=] lists the groups;
POST /api/v1/finding-groups/decide gives every undecided member the
same status through the bulk path (status history, issue sync), so
VEX and the evidence pack see ordinary per-finding changes.
- Findings list: Gruppiert / Einzeln toggle (default grouped) with group
cards, the AI's reason, the places, and Fehlalarm / Risiko akzeptiert
for all places of a group.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Part of epic #955. A rule that fires at several places in one file is now one decision.
Approach: (a) read-side grouping
I went with (a): groups are computed when they are read, and nothing about them is stored.
I did not extend the #464 model (
pipeline::grouping::group_repetitive) for these reasons:Grouped/Inheritedhistory entries.With (a), every group decision is an ordinary per-finding status change. The status history, the issue sync, VEX and the evidence pack work unchanged.
Grouping rules (
compliance_core::models::finding_group)open,triaged,needs_review. This is the same set ashealth::OPEN_STATUSESandfinding_store::UNDECIDED.(repo_id, scanner, rule, scope, place).ruleisrule_id, or the title when a finding has no rule id.scanneris part of the key because rule ids belong to each tool. #464 keys on the scanner too.DIRECTORY_MIN_FILES(3) or more distinct files of the same directory, those files form one group for the directory."".occurrences) is a group of its own with scoperepository, keyed by its fingerprint. It is never merged with other findings.placescounts its occurrences.place: null.needs_reviewplustriage_action == "dismiss"reads as "KI: wohl Fehlalarm".needs_reviewreads as "KI: unsicher".API
GET /api/v1/finding-groups[?target=<repo_id>]The members are read without
code_snippet,suggested_fix,remediation,status_historyandlegacy_fingerprints. Those are on each finding's own page.POST /api/v1/finding-groups/decide, body{ "key": GroupKey, "status": FindingStatus, "reason"?: string }, answers{ "status": "updated", "members": n, "modified_count": n }.open,triagedandneeds_revieware refused.accepted_riskorwrong_mappingwithout a reason. This check comes from the sharedstatus_update.Write role: the endpoint is a POST and not in
READ_ONLY_POSTS, so the existing org-role middleware enforces write access. CXO and Legal get 403, and support follows the support rules. Both routes are added to the router-gate test table.API keys: the new routes are not added to
KEY_SCOPES, because the key surface is curated. Adding them would be a two-line follow-up (findings.read/findings.write).How a decision reuses the single-status path
group_findingspicks the group.status_update, which also serves single changes. It records who, when and why, including support marking.findings::apply_status, which I extracted frombulk_update_finding_status. The bulk handler calls it too. It runsupdate_manyand thenissue_sync.spawn(ids), so each member's issue closes or reopens exactly as with a single change.How #950 (Heute inbox) can call it
compliance_core::models::finding_group::group_findings(findings) -> Vec<FindingGroup>andmembers_of(findings, &key) -> Vec<ObjectId>are pure functions with no database access. They live incompliance-core, so the agent handlers and the dashboard share the wire types.is_undecided(&status)is public too.PR #958 note
The AI-reason predicate is copied into
finding_group::ai_reviewbecauseFinding::review_reason()from #958 is not merged yet. Once #958 lands,ai_reviewshould switch toFinding::review_reason()(one function). I did not touchfinding.rs,triage.rsorfinding_detail.rs.UI
Findings list:
components/finding_groups.rs.pages/findings.rsonly gets the toggle, the mount (one guard arm in the existingmatch, so no re-indent),disabledon the filters that do not apply, and the bulk bar hidden in grouped view./findings/{id}Not included:
GET /issues). Issue creation is pipeline-side (issue_creation.rs, owned by #948), and adding it here would not be small.Texts are in German and English (
texts::finding_groups). Styles are smallfgroup-*/view-switch*classes appended tomain.css.How it was tested
compliance-core: 13 unit tests plus 1 doctest. They cover:placescounts its occurrencesmembers_ofby key, including an unknown keycompliance-agent: 4 tests on the decide path's validation:apply_statusextraction.compliance-dashboard: 3 text tests and 3 component tests (place labels, target names).Checks (
-j8,RUSTFLAGS="-D warnings"), all clean:cargo fmt --all --checkcargo clippy -p compliance-core --all-targets -- -D warningscargo clippy -p compliance-agent --all-targets -- -D warningscargo clippy -p compliance-dashboard --features server --no-default-features --all-targets -- -D warningscargo clippy -p compliance-dashboard --features web --no-default-features --all-targets -- -D warningsNot exercised locally: the endpoints against a live MongoDB, and the UI in a browser.
Open points
targetdefault.Closes #951
🤖 Generated with Claude Code
Rebased onto #964 (findings charts), which also edits
pages/findings.rs. Resolution:scan_type,severityorpath), the page starts in, and switches to, the single list. Without one it defaults to grouped as before. The toggle still works.Checked locally on the merged tree: fmt, clippy
-D warnings(agent, dashboard server and web), dashboard lib tests (155), core finding tests (33) and agent API tests (109).757ae148aeto93c9446490