Skip to content

Conversation

@cvxluo
Copy link
Contributor

@cvxluo cvxluo commented Feb 10, 2026

Fixes pagination inconsistencies in the Issues list by ensuring accurate X-Hits and consistent page item counts.

Why these changes?
The Issues list pagination experienced:

  1. Inconsistent X-Hits: The total count (X-Hits header) would fluctuate between pages due to sampling-based estimations and post-filtering.
  2. Short Pages: Post-filtering (e.g., by status) removed items after pagination, leading to pages with fewer items than requested, even when more results existed.

This resulted in incorrect "X–Y of Z" displays and a poor user experience.

What was changed?

  • Adjusted X-Hits for post-filtering: X-Hits is now proportionally adjusted downwards if post-filters remove items from the result set.
  • Capped X-Hits on short first pages: If the first page returns fewer items than requested (and no more results exist or the backend couldn't fill the page), X-Hits is capped to the actual number of items returned.
  • Applied these fixes consistently to both organization and project group index endpoints.
  • Added new tests to verify X-Hits adjustment and capping behavior.

These changes ensure X-Hits remains consistent and accurately reflects the total number of items after all filtering, resolving the pagination display issues.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.


Linear Issue: ID-1343

Open in Cursor Open in Web

- Adjust X-Hits proportionally when post-filtering removes results
- Cap X-Hits to actual count when first page is short (fewer than requested limit)
- Apply consistent fix to both organization and project group index endpoints
- Add tests to verify X-Hits adjustment behavior

Co-authored-by: Charlie Luo <cvxluo@gmail.com>
@cursor
Copy link
Contributor

cursor bot commented Feb 10, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@linear
Copy link

linear bot commented Feb 10, 2026

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Feb 10, 2026
- Break long lines to comply with line length limits
- Improve comment readability

Co-authored-by: Charlie Luo <cvxluo@gmail.com>
The test was expecting X-Hits to remain at the mocked value (100) even when
only 10 results exist. This is incorrect - when we're on the first page with
no more results, X-Hits should be capped to the actual count (10) to prevent
showing incorrect totals like '1-10 of 100' when only 10 items exist.

Co-authored-by: Charlie Luo <cvxluo@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants