Skip to content

fix(findings): check each moved duplicate's engagement on a manual duplicate mark - #16963

Merged
blakeaowens merged 3 commits into
devfrom
fix/mark-duplicate-member-engagement
Nov 18, 2026
Merged

blakeaowens merged 3 commits into
devfrom
fix/mark-duplicate-member-engagement

Conversation

@blakeaowens

@blakeaowens blakeaowens commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Description

Marking a finding as a duplicate (finding/<duplicate_id>/duplicate/<original_id>) moves that finding's own duplicates onto the cluster root with it. The engagement deduplication check only compared the marked finding with the root (since #16921), so a duplicate of the marked finding that sat in a third engagement was moved under a root in another engagement while deduplication_on_engagement was enabled.

Reproduced on dev with dojo_testdata.json: finding 4 re-pointed at finding 7 and moved to engagement 4 (same product as engagement 1), engagements 1 and 4 with deduplication_on_engagement=True, then POST /finding/7/duplicate/3. Finding 7 lands under root 2 (engagement 1, correct), and finding 4 (engagement 4) is moved under 2 as well, with no refusal.

What changed

  • mark_finding_duplicate refuses the mark when any duplicate of the marked finding sits in another engagement than the root's and either engagement has deduplication_on_engagement. The message names that duplicate and says to reset its duplicate status first. The check is one SELECT ... LIMIT 1 over the members, the same at any cluster size.
  • A root outside the marked finding's product is refused with a 404, as an original outside it already is. Only reachable with inconsistent data (a root moved to another product).
  • A duplicate of the marked finding that sits in another product is refused with a 404 too, in the same single query (members in another product first). Also only reachable with inconsistent data.
  • calculate_possible_related_actions_for_similar_finding keeps "Reset duplicate status" on a row that is a duplicate even when the engagement check refuses the linking actions, so the reset the refusal names is reachable from that duplicate's row.
  • Docs: the Similar Findings pages (Open Source and Pro) say a mark is refused when one of the finding's own duplicates would cross an engagement boundary, and that the duplicate's row still offers the reset.

Testing

  • unittests/test_mark_finding_duplicate_self_reference.py: five new tests that post to the real route and reload the rows. On dev, four of them fail for the reported reason (the member is moved; the cross-product mark saves) and the control passes. With this change both modules pass, 31 of 31 (unittests/test_manual_duplicate_onto_mitigated.py included). Four more tests cover a member in another product (engagement deduplication off and on) and the reset on a cross-engagement duplicate row (and nothing extra on a row that is not a duplicate); the first three fail without the change.
  • ruff check with ruff 0.16.10 and ruff.toml: clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GLL1WfJLfxsDJMCrh85XNG

…plicate mark

Marking a finding as a duplicate moves that finding's own duplicates onto the
cluster root with it, but the engagement deduplication check only compared the
marked finding with the root. A duplicate of the marked finding that sat in a
third engagement was moved under a root in another engagement while
deduplication_on_engagement was on.

The mark is now refused when any of those duplicates is in another engagement
than the root's and either engagement has deduplication_on_engagement, and the
message names that duplicate. A root outside the marked finding's product is
refused like an original outside it (404). The Similar Findings docs say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HJqD5FkqTDyyjgEBBQKHdb
blakeaowens and others added 2 commits November 17, 2026 18:26
… cross-engagement duplicate

A refused manual duplicate mark names a duplicate in another engagement and says
to reset its duplicate status first, but the similar-findings calculator answered
None for that row before reaching its reset branch, so no menu offered it. The
calculator now keeps Reset duplicate status on a row that is a duplicate even when
the engagement check refuses the linking actions; resetting only takes it out of
its cluster. The docs say where the action is.

A duplicate of the marked finding sitting in another product is refused (404),
the same way a root in another product is, in the same single query, members in
another product first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GLL1WfJLfxsDJMCrh85XNG
@blakeaowens
blakeaowens added this pull request to the merge queue Nov 18, 2026
Merged via the queue into dev with commit b6a810d Nov 18, 2026
50 checks passed
@blakeaowens
blakeaowens deleted the fix/mark-duplicate-member-engagement branch November 18, 2026 07:02
blakeaowens added a commit that referenced this pull request Nov 18, 2026
#16963 added a product check to the mark route and a reset on duplicate rows
in another engagement to the menu. The route keeps its product check on top of
cluster_root(). The menu keeps this branch's version, which already offers the
reset on any duplicate row; it returns the reset first, so the row renders it
(the row template shows None alone when the first action is None, so the
["None", "reset"] list on dev never rendered the reset). The #16963 test now
expects ["reset_finding_duplicate_status"] and checks the rendered link.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0143hYTGieXXrTHYeTDhwri2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants