Skip to content

Fix deterministic ordering for async_dupe_delete when duplicate dates tie#14562

Merged
Maffooch merged 2 commits intoDefectDojo:bugfixfrom
valentijnscholten:fix-async-dupe-delete-order-tiebreak
Mar 23, 2026
Merged

Fix deterministic ordering for async_dupe_delete when duplicate dates tie#14562
Maffooch merged 2 commits intoDefectDojo:bugfixfrom
valentijnscholten:fix-async-dupe-delete-order-tiebreak

Conversation

@valentijnscholten
Copy link
Member

@valentijnscholten valentijnscholten commented Mar 20, 2026

Summary

Excess duplicates are deleted in chronological order, oldest are deleted, newest are retained. In cases where many duplicates had the same date the order of deletion was undefined. This PR as explicit fallback ordering to id.

  • Order excess duplicate findings by date, then id, so deletion removes the oldest duplicates first when many rows share the same date (e.g. scanner-provided dates).
  • Aligns async_dupe_delete with documented behavior: delete the oldest duplicate findings until the configured maximum is satisfied.

[sc-12922]

order_by("date") does not define order for rows with identical dates.
Add id as secondary sort so async_dupe_delete removes oldest duplicates
first (by date, then id), matching documented behavior.
@valentijnscholten valentijnscholten marked this pull request as draft March 20, 2026 18:29
Add test_delete_duplicate_order_same_date_tiebreak_by_id; lower-id
duplicate is removed first when max_dupes is exceeded and date ties.
@valentijnscholten valentijnscholten added this to the 2.56.3 milestone Mar 20, 2026
@valentijnscholten valentijnscholten marked this pull request as ready for review March 20, 2026 18:35
@Maffooch Maffooch requested review from Jino-T and paulOsinski March 20, 2026 20:49
Copy link
Contributor

@paulOsinski paulOsinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Copy link
Contributor

@mtesauro mtesauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@Maffooch Maffooch merged commit 7925a6f into DefectDojo:bugfix Mar 23, 2026
285 checks passed
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.

5 participants