Fix bulk edit validation: prevent duplicate findings from being active/verified #13965
+1,166
−318
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
This PR fixes the bug where bulk edit allows duplicate findings to be marked as active/verified, which violates business rules enforced in the regular edit form and API. And it adds other validation rules that were missing from bulk edit.
AI helped me to create test cases. And then I extracted logic into separate methods to please Ruff.
Fixes #11336
Changes
Form Validation ()
FindingBulkUpdateForm.clean()to prevent active findings from being risk acceptedFindingFormbut was missing from the bulk formView Validation ()
actually_updated_countto accurately reflect findings that were actually updated (excluding skipped ones)Validation Rules Enforced
All validation rules from the API and regular forms are now enforced in bulk edit:
User Feedback
Users now receive clear feedback about: