Freeze the first reproduction
Create an invented fixed set with several records sharing the visible sort value. Traverse every page and retain the IDs in order. A complaint based only on changing production data cannot distinguish an unstable tie from records genuinely inserted between reads.
- Record sort direction, page size, filters and any related-table ordering.
- Inspect later order_by calls that may replace the intended ordering.
- Compare duplicate IDs and omitted IDs, not only page counts.
A tie-breaker fixes one class of problem
Django documents that ordering is guaranteed only when the chosen fields uniquely identify results. Add the appropriate unique tie-breaker to the declared order and repeat the fixed-set traversal. Ordering through a multi-valued relation can produce repeated objects for a different reason; investigate that join rather than blindly applying distinct().
- Do not reorder after slicing and assume the same query contract.
- Check ties at the exact page boundary.
- Retain each parsed page's synthetic IDs as the assertion evidence.
A moving list needs a different policy
Even deterministic ordering does not make several offset page reads a snapshot when records are inserted or removed. This is an engineering inference, not a claim that the reference promises snapshot exports. Ask whether the owner needs a live browsing list, a fixed report set or a cursor-based traversal. Define a cutoff or cursor contract separately before implementing it.
- An authored acceptance test first covers the unchanged set, then the agreed insertion/removal case.
- Do not promise gap-free reporting for arbitrary concurrent edits.
- No traversal or report has been executed for this candidate.
Non-fit and priced route
An ordinary fixed-set ordering defect reproducible with synthetic records may fit fix-one-bug-with-regression-test, from £295 after bounded reproduction and a fixed repair quote. A new snapshot/cursor feature needs its own criteria and can be discussed under ship-one-feature-with-running-preview, from £750; a data-platform redesign is not included. If business policy for changing data is unclear, the report owner must decide it first.
- Do not share customer IDs, report dumps or source code in an enquiry.
- Proposed prices are not paying-intent evidence; production data repair and deployment remain separately authorised.
Sources and limits
- Django 5.2 QuerySet ordering and slicing; BSD-licensed project documentation Checked 2026-10-11.
- Unspecified ordering is not guaranteed.
- A guaranteed ordering requires fields that uniquely identify each result.
- Successive order_by calls replace prior ordering.
- Ordering across multi-valued relations can duplicate result objects.
- Current reproducible-bug offer Checked 2026-10-11.