fix: two-pass merged-PR fetch to defeat GitHub 1000-result search cap#6
Merged
Conversation
GitHub's Search API hard-caps at 1000 results regardless of pagination. With sort:updated-desc, the least-recently-updated PRs fall off the cap. For users with >1000 merged PRs in 12 months, that silently drops items in qualifying repos from the card's filtered count. Fix: when the first pass (updated-desc) returns fewer items than totalCount, run a second pass with sort:updated-asc and dedupe by URL. Effective ceiling: ~2000 unique items. cappedMerged now reflects whether items actually cover totalCount instead of the coarse `merged >= 1000`. Verified against costajohnt's account: 1074 totalCount, previously fetched 1000 items (102 external, 101 in 50+ star repos). Two-pass recovers all 1074, yielding 114 merged PRs in 50+ star external repos (matches the expected count within search-index lag). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
sort:updated-descdrops the oldest-updated PRs, undercounting users with >1000 merged PRs/year.sort:updated-desc+sort:updated-asc, deduped by URL) raises the effective ceiling to ~2000.cappedMergednow reflects whether items actually covertotalCountinstead of the coarsemerged >= 1000.Test plan
pnpm test(116/116 pass; added 2 tests, updated 1)pnpm run typecheckcleantotalCount, 114 merged PRs in 50+ star external repos (was 101)🤖 Generated with Claude Code