Skip to content

fix(sponsors): add deterministic ORDER BY with tiebreaker to paginated dashboard lists (#464) - #466

Open
Proxima84-code wants to merge 1 commit into
MergeFi:mainfrom
Proxima84-code:fix/sponsors-pagination-order-by-464
Open

Proxima84-code wants to merge 1 commit into
MergeFi:mainfrom
Proxima84-code:fix/sponsors-pagination-order-by-464

Conversation

@Proxima84-code

Copy link
Copy Markdown

Resolves #464.

Root Cause

take and skip pagination in SponsorsService lacked explicit ORDER BY clauses across three dashboard queries. In PostgreSQL, query plans can alter row ordering between offset requests (e.g. index scans vs. sequential scans), causing items to duplicate across pages or be omitted entirely.

Fix

  • Added .orderBy('bounty.createdAt', 'DESC').addOrderBy('bounty.id', 'DESC') to activeBounties query builder.
  • Added order: { createdAt: 'DESC', id: 'DESC' } to activeMilestones and milestoneProgress repository find calls.
  • Extended createMockQueryBuilder to support addOrderBy and updated unit test assertions in sponsors.service.spec.ts (12/12 tests passing).

@vercel

vercel Bot commented Sep 27, 2026

Copy link
Copy Markdown

@Proxima84-code is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SponsorsService's paginated activeBounties/activeMilestones/milestoneProgress use take/skip with no ORDER BY, so pages overlap and skip rows

1 participant