fix(findings): groups take over their places' human decisions (#483) #484

Merged
sharang merged 1 commits from fix/483-group-decisions into main 2026-10-06 01:15:49 +00:00
Owner

Closes #483. Follow-up to #464/#477, requested by the platform session. Stage only.

Problem

A group started open even when a person had marked each of its places, one by one, as a false positive, an accepted risk or ignored. The decision was lost on the group, and the group's issue stayed open.

Change

  • Reading the decisions: RunFindings::write_back reads, for each group, the stored single findings of its rule at its places that carry one of those decisions.
    • Each place gets its decision: Occurrence.decision, and in the description …/Main.java:12 [marked false_positive].
  • All places carry the same decision → the group takes it over:
    • History entry by the scan: ScanChangeKind::Inherited, reason "inherited from N grouped findings".
    • This also applies to groups an earlier run stored as open. The groups #477 created are set right on the next scan.
  • A decision on the group itself is never overridden. The update is guarded on the status still being open, triaged or needs_review. Mixed decisions leave the group open, and its description shows each place's decision.
  • Issues:
    • An inherited decision goes into status_changed, so issue sync closes the group's issue with a DE/EN comment ("…übernimmt diese Entscheidung") that quotes the reason.
    • Issue creation skips findings that already carry a decision, so a new group with an inherited decision never opens an issue.
  • Dashboard: history text for the inherited change.

Tests

  • tests/group_decisions.rs (Mongo):
    • all false positive → group FP, history Inherited, in status_changed, places listed with their decision;
    • mixed (3 accepted risk, 3 open) → group open, decisions per place;
    • group stored earlier as open → inherits;
    • group stored earlier as accepted risk → stays accepted risk.
  • Unit tests: unanimity, the description round trip (rule_description ↔ describe), the issue comment.
  • The group_findings, finding_variants, resolve_findings and live_findings integration tests are green.
  • fmt and clippy -D warnings: agent, core, and dashboard (server and wasm).
  • Unit test runs: agent lib 691, dashboard 82, core 85.

To check on stage

  1. Pick a target with a rule that fires at more than 5 places (e.g. android_logging, the nightly target mobile-android-insecure, or a customer-like app). Mark every single finding of that rule Fehlalarm before grouping. On an already grouped target, use the places of an open group.
  2. Rescan. Expect:
    • the group shows "Fehlalarm" with the history line "Von den einzeln bewerteten Stellen übernommen…";
    • its issue (if any) is closed with the comment;
    • the agent logs group inherited the decision on all its places.
  3. Mark one place differently and rescan a fresh target. Expect the group to stay open and list [marked …] per place.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p

Closes #483. Follow-up to #464/#477, requested by the platform session. Stage only. ## Problem A group started `open` even when a person had marked each of its places, one by one, as a false positive, an accepted risk or ignored. The decision was lost on the group, and the group's issue stayed open. ## Change - **Reading the decisions:** `RunFindings::write_back` reads, for each group, the stored single findings of its rule at its places that carry one of those decisions. - Each place gets its decision: `Occurrence.decision`, and in the description `…/Main.java:12 [marked false_positive]`. - **All places carry the same decision** → the group takes it over: - History entry by the scan: `ScanChangeKind::Inherited`, reason "inherited from N grouped findings". - This also applies to **groups an earlier run stored as `open`**. The groups #477 created are set right on the next scan. - **A decision on the group itself is never overridden.** The update is guarded on the status still being open, triaged or needs_review. Mixed decisions leave the group open, and its description shows each place's decision. - **Issues:** - An inherited decision goes into `status_changed`, so issue sync closes the group's issue with a DE/EN comment ("…übernimmt diese Entscheidung") that quotes the reason. - Issue creation skips findings that already carry a decision, so a new group with an inherited decision never opens an issue. - **Dashboard:** history text for the inherited change. ## Tests - `tests/group_decisions.rs` (Mongo): - all false positive → group FP, history `Inherited`, in `status_changed`, places listed with their decision; - mixed (3 accepted risk, 3 open) → group open, decisions per place; - group stored earlier as open → inherits; - group stored earlier as accepted risk → stays accepted risk. - Unit tests: unanimity, the description round trip (`rule_description` ↔ `describe`), the issue comment. - The `group_findings`, `finding_variants`, `resolve_findings` and `live_findings` integration tests are green. - fmt and clippy `-D warnings`: agent, core, and dashboard (server and wasm). - Unit test runs: agent lib 691, dashboard 82, core 85. ## To check on stage 1. Pick a target with a rule that fires at more than 5 places (e.g. `android_logging`, the nightly target `mobile-android-insecure`, or a customer-like app). Mark every single finding of that rule **Fehlalarm** before grouping. On an already grouped target, use the places of an `open` group. 2. Rescan. Expect: - the group shows "Fehlalarm" with the history line "Von den einzeln bewerteten Stellen übernommen…"; - its issue (if any) is closed with the comment; - the agent logs `group inherited the decision on all its places`. 3. Mark one place differently and rescan a fresh target. Expect the group to stay open and list `[marked …]` per place. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang added 1 commit 2026-10-06 01:07:29 +00:00
fix(findings): groups take over their places' human decisions (#483)
CI / Detect Changes (pull_request) Skipped
CI / Check (push) 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 8m6s
6860cdb9ce
Closes #483. A group (#464/#477) started open even when a person had
marked every one of its places, one by one, a false positive, an
accepted risk or ignored; their issues stayed open and the decision was
lost on the group.

- RunFindings::write_back reads, for each group, the stored single
  findings of its rule at its places that carry such a decision. Each
  place lists its decision (Occurrence.decision; the description shows
  "file:line [marked false_positive]").
- When every place carries the same decision, the group takes it, with a
  history entry by the scan (ScanChangeKind::Inherited, "inherited from
  N grouped findings"); also on a group an earlier run stored open, so
  the groups #477 created are set right on the next scan. A decision a
  person made on the group itself is never overridden; mixed decisions
  leave the group open.
- Issues: the inherited decision closes the group's issue with a comment
  (DE/EN, reason quoted); a finding that is already decided never opens
  an issue.
- Dashboard: history wording for the inherited change.
- Tests: tests/group_decisions.rs (Mongo: all-same, mixed, earlier open
  group, decision on the group kept), unit tests for unanimity, the
  description round trip and the issue comment.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang merged commit 770991c2c5 into main 2026-10-06 01:15:49 +00:00
Sign in to join this conversation.