A soft-delete leak occurs when a query intended to exclude logically deleted rows omits the deletion filter, causing removed records to still appear in lists, counts, or pagination totals.
In simpler words
Deleted tickets are not really gone from the database. If a query forgets to filter them out, they reappear in lists and mess up page counts.
Combines pagination correctness with a realistic soft-delete pitfall.
Explain why soft delete requires filtering in every read query, not only the list
Spot a pagination total that disagrees with the visible rows
Choose a fix that keeps the data query and the count query consistent
Why soft-delete leaks are easy to introduce
Definition
Soft delete marks a row as removed, for example with a deletion timestamp, without a physical delete, so every subsequent read query must explicitly exclude it, unlike a hard delete which removes the row from all future query results automatically.
In simpler words
Marking a row deleted does not stop it from showing up unless every query remembers to check for that mark.
A new query, index, or export path added later can easily forget the exclusion condition older queries already had. The leak often appears in only one endpoint, not all of them.
When the count query and the data query use different filters, the pagination total disagrees with what a user actually sees, producing an empty last page or missing rows.
Keep in mind
Every read query on a soft-deletable entity needs the same exclusion filter; factor it into one shared place.
A pagination total and the data query must share filters or pagination math breaks.
A leak that shows up only on later pages is a strong hint the count and data queries disagree.
Challenge lab
Bug report
Deleted tickets still show up on later pages of the tickets list, and the last page is sometimes empty.
What is broken
The paginated data query filters out soft-deleted tickets, but the separate count query used for the pagination total does not, so the total overcounts and the page math misaligns.