fix(api): add id tiebreaker to paginated queries#6127
Conversation
|
Claude finished @gustavosbarreto's task in 3m 45s —— View job Code Review CompleteReviewed 1 file. 1 inline issue posted (1 critical). The fix for deterministic pagination ordering is the right idea, but the hardcoded To request another review round, comment |
13d5e95 to
5cfc499
Compare
|
/review |
|
Claude finished @gustavosbarreto's task in 4m 58s —— View job Code Review CompleteReviewed 7 files. 2 inline issues posted (1 critical, 1 high). The configurable tiebreaker approach is sound and addresses the original review feedback well. The
To request another review round, comment |
5cfc499 to
2a70dda
Compare
Without a secondary sort key, PostgreSQL returns rows in non-deterministic order when the primary sort column has duplicate values. This causes items to shift between pages, making pagination unreliable. Add `id DESC` as a tiebreaker to every sorted query so that ordering is stable across pages. Fixes: #6124
2a70dda to
70ccd47
Compare
|
/review |
|
Claude finished @gustavosbarreto's task in 46s —— View job Code Review CompleteReviewed 12 files across code quality, security, testing, language patterns, and architecture — no issues found. The code looks good as-is. The configurable To request another review round, comment |
Problem
Paginated queries return rows in non-deterministic order when the primary sort column has duplicate values (e.g. multiple devices with the same
last_seen), causing items to shift between pages.Fix
Add
id DESCas a secondary sort key to all paginated queries inSort().Fixes #6124