chore: fix push sort order to be latest-first#1431
Conversation
✅ Deploy Preview for endearing-brigadeiros-63f9d0 canceled.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1431 +/- ##
==========================================
- Coverage 81.78% 81.77% -0.01%
==========================================
Files 67 67
Lines 4766 4769 +3
Branches 827 827
==========================================
+ Hits 3898 3900 +2
- Misses 852 853 +1
Partials 16 16 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dcoric
left a comment
There was a problem hiding this comment.
Looks good to me overall.
Non-blocking suggestion: we should add follow-up tests for the new sort behavior.
- Add a
getPushesunit test intest/db/file/pushes.test.tsto assert NeDB query uses.sort({ timestamp: -1 }). - Add a
getPushesunit test intest/db/mongo/pushes.test.tsto assertfindDocumentsis called withsort: { timestamp: -1 }andtimestampin projection.
|
@dcoric Good shout on the tests. Ok if I add a separate PR for that? |
jescalada
left a comment
There was a problem hiding this comment.
LGTM 🚀 This also fixes the issue with E2E tests failing locally due to the most recently added repos not showing up on the first page.
Feel free to add tests in a separate PR! As for the pagination/filtering, it'd be great to implement it after the dust settles on the v2 release - since a few PRs out there (test coverage, any/as refactor) are touching too many files and causing conflicts.
When viewing push requests, the current implementation assumes MongoDB (or the file-based DB) returns results in a consistent order, and the UI simply reverses whatever it receives. Because the database query does not guarantee ordering, pushes could be displayed in an inconsistent (often effectively random) order.
This PR fixes that by:
Adding an explicit sort in the database layer so the most recent pushes are returned first.
Simplifying the push table rendering to rely on backend ordering rather than reordering in the UI.