Repository navigation
Conversation
…deletes The delete option on Merge Findings called QuerySet.delete(). That skips Finding.delete(), so it skipped the duplicate-cluster handling, the JIRA sync, the ordered tag removal and the product grading. A deleted original left its duplicates pointing at a row that no longer exists. Delete each finding with Finding.delete(), like the bulk delete route does. The test makes the deleted finding the original of a duplicate and checks that the duplicate becomes the new original.
Collaborator
Author
|
[sc-15583] |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The "delete" option on Merge Findings called
.delete()on the queryset. That skipsFinding.delete(), so the merge skipped the duplicate-cluster handling, the JIRA sync, the ordered tag removal and the product grading. If a deleted finding was the original of a duplicate cluster, its duplicates kept pointing at a row that no longer existed.This PR deletes each finding with
Finding.delete(), the same way the bulk delete route does.Behavior change for users who can already delete: a merge with "delete" now re-grades the product and runs the normal JIRA sync for each deleted finding.
Test results
test_merge_delete_promotes_a_new_original_for_the_duplicate_clusterinunittests/test_bulk_finding_authorization.py. It makes the deleted finding the original of a duplicate, then checks that the duplicate becomes the new original. It fails before the fix and passes after it.unittests.test_bulk_finding_authorization,unittests.test_merge_findings_locationsandunittests.test_finding_template_merge_endpoints_v3: 17 tests, all pass.ruff check .with ruff 0.16.9: all checks pass.Documentation
No documentation change. The merge form and its options do not change.
Checklist
dev.devbranch.