Repository navigation
fix(findings): gate the similar findings Mark as Duplicate on the cluster root - #16980
Conversation
…ster root The classic View Finding page offered Mark as Duplicate on a similar finding after comparing its engagement with the finding on the page, but the mark route compares it with the page finding's cluster root, the finding it lands under. On a duplicate's page whose root sits in another engagement with engagement deduplication on, the menu offered a mark the route refuses and hid one it accepts. The menu now checks Mark as Duplicate against the cluster root and keeps the page-finding check for Set as Original and Reset Duplicate Status, as their routes do. A row shows None when no action survives. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0143hYTGieXXrTHYeTDhwri2
Adversarial review: changes requiredTier: full (backend change to which write actions the classic View Finding page offers), confirmed from the diff. Model: Opus. Fresh session, no author context. CI read, not re-run: every check green on 05cc979 (ruff, Migration Graph Check, Rest Framework Unit Tests both variants, every User Interface Tests shard, k8s, performance). Regression test: the new file's 6 tests run against the PR head's calculator: 6 pass. The same 6 run against What I drove: the classic Break attempts
No screenshot pair: the classic page is not reachable in a Pro stack, so the check was on rendered HTML, listed above. Findings
RecommendationChanges required: 5 Checked only statically or not at all: the OSS-only classic page in a browser (rendered the view's HTML instead); a production-sized cluster (the extra cost is two queries per page, independent of row count). |
…pts it Review follow-up. Reset Duplicate Status is offered on any duplicate row again, since its route compares no engagements. The cluster root lookup is one cluster_root() helper shared by the mark route, the mitigated-original check and the menu, and the menu reuses is_deduplication_on_engagement_mismatch, so the menu and the routes cannot drift apart again. The engagement mismatch reason reads in plain words, the docs list uses colons, and a test renders the View Finding page and checks the row links. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0143hYTGieXXrTHYeTDhwri2
|
Resolution of the review verdict:
Verification: the new file has 8 tests; 5 fail on |
#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
Description
The classic View Finding page builds the similar findings row actions with
calculate_possible_related_actions_for_similar_finding. Its engagement deduplication check compared the similar finding with the finding on the page. Since #16921 the Mark as Duplicate route compares the similar finding with the page finding's cluster root instead (the finding the mark lands under).On a duplicate's page, when the root and the page finding sit in different engagements and
deduplication_on_engagementis on, the menu therefore:The calculator now offers each action where its route accepts it. Mark as Duplicate is checked against the cluster root (the page finding's
duplicate_findingwhen it is a duplicate, otherwise the page finding), as the mark route does. Set as Original keeps the page-finding check, as its route does. Reset Duplicate Status is offered on any duplicate row, since its route compares no engagements. A row shows None when no action is left, and that reason now reads in plain words.The cluster root lookup is one
cluster_root()helper indojo/finding/deduplication.py, shared by the mark route,manual_duplicate_hides_open_findingand the calculator, and the calculator reusesis_deduplication_on_engagement_mismatch, so the menu and the routes read the same rules.With #16963 now on
dev, the mark route keeps its product check on top ofcluster_root(). #16963 also offered a reset on a duplicate row in another engagement as["None", "reset_finding_duplicate_status"], but the row template shows None alone when the first action is None, so that reset never rendered. Here the reset comes first and renders; its test expects["reset_finding_duplicate_status"]and checks the rendered link.Test results
New
unittests/test_similar_finding_related_actions.py(8 tests) builds a duplicate whose root sits in another engagement of the same product:On
devfive of them fail ('mark_finding_duplicate' unexpectedly found in [...],['None'] != ['mark_finding_duplicate'], and the page and reset cases); with this change all eight pass. The neighbouring suites (test_mark_finding_duplicate_self_reference,test_manual_duplicate_onto_mitigated,test_permissions_audit,test_finding_view_followups,test_finding_model,test_post_handler_permissions,test_bulk_finding_authorization,test_prepare_duplicates_for_delete,test_read_only_mode) pass too: 298 tests, 0 failures.ruff checkpasses on the changed files.Performance, View Finding for a duplicate with 50 similar rows split across the two engagements (a third of them duplicates of another cluster): 133 queries before and after, since the rows' relations are already prefetched. Wall time is unchanged within run-to-run noise (two interleaved rounds each: medians 362 and 449 ms on
dev, 345 and 427 ms with the change).Documentation
OS__similar_findings.md: the Mark as duplicate entry now says the mark lands under the cluster's original and, with Engagement-level deduplication, is offered only for a similar finding in that original's Engagement. The action list uses colons after each label.🤖 Generated with Claude Code
https://claude.ai/code/session_0143hYTGieXXrTHYeTDhwri2