fix: paginate up to 1000-item cap when total_count exceeds it#1
Merged
Conversation
paginateSearch returned only page 1 (100 items) when total_count >= maxItems, truncating topRepos, dailyActivity, and streak for users with 1000+ merged PRs in the last 12 months. The most-recently-updated PRs (often in the user's own/work repos) dominated page 1, hiding external OSS contributions from the aggregated view. Now clamps totalCount to maxItems and paginates to the GitHub Search API's 10-page cap, so the items array reflects up to 1000 PRs as intended.
This was referenced May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
paginateSearchreturned only page 1 (100 items) whenevertotal_count >= maxItems, truncatingtopRepos,dailyActivity, andstreakfor users with 1000+ merged PRs in the last 12 months.external + 50+ starsfilter.totalCounttomaxItemsand paginates to the GitHub Search API's 10-page cap. ThecappedMergedflag is unaffected since it reads fromtotal_count.Test plan
pnpm test— 109/109 passingpnpm run typecheck— cleanflags capped results when total_count exceeds 1000test to assert 12 search calls (10 merged pages + open + closed) and thattopReposreflects paginated items/api/card/costajohnt?cache=noand confirm 111 PRs / 34 repos