Skip to content

chore: fix push sort order to be latest-first#1431

Merged
kriswest merged 4 commits intofinos:mainfrom
qube-rt:move-sort-to-db
Mar 3, 2026
Merged

chore: fix push sort order to be latest-first#1431
kriswest merged 4 commits intofinos:mainfrom
qube-rt:move-sort-to-db

Conversation

@andypols
Copy link
Contributor

@andypols andypols commented Mar 2, 2026

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.

@andypols andypols requested a review from a team as a code owner March 2, 2026 11:21
@netlify
Copy link

netlify bot commented Mar 2, 2026

Deploy Preview for endearing-brigadeiros-63f9d0 canceled.

Name Link
🔨 Latest commit 5b992bd
🔍 Latest deploy log https://app.netlify.com/projects/endearing-brigadeiros-63f9d0/deploys/69a6a0e75e38ce00087447a5

@codecov
Copy link

codecov bot commented Mar 2, 2026

Codecov Report

❌ Patch coverage is 73.33333% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.77%. Comparing base (25277e3) to head (5b992bd).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
src/db/file/pushes.ts 84.61% 2 Missing ⚠️
src/db/mongo/pushes.ts 0.00% 2 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@dcoric dcoric left a comment

Choose a reason for hiding this comment

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

Looks good to me overall.

Non-blocking suggestion: we should add follow-up tests for the new sort behavior.

  • Add a getPushes unit test in test/db/file/pushes.test.ts to assert NeDB query uses .sort({ timestamp: -1 }).
  • Add a getPushes unit test in test/db/mongo/pushes.test.ts to assert findDocuments is called with sort: { timestamp: -1 } and timestamp in projection.

@andypols
Copy link
Contributor Author

andypols commented Mar 2, 2026

@dcoric Good shout on the tests. Ok if I add a separate PR for that?

Copy link
Contributor

@jescalada jescalada left a comment

Choose a reason for hiding this comment

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

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.

@kriswest kriswest merged commit 019c8a6 into finos:main Mar 3, 2026
25 checks passed
@andypols andypols deleted the move-sort-to-db branch March 4, 2026 17:55
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.

4 participants