Skip to content

fix: two-pass merged-PR fetch to defeat GitHub 1000-result search cap#6

Merged
costajohnt merged 1 commit into
mainfrom
fix/two-pass-merged-pr-fetch
May 8, 2026
Merged

fix: two-pass merged-PR fetch to defeat GitHub 1000-result search cap#6
costajohnt merged 1 commit into
mainfrom
fix/two-pass-merged-pr-fetch

Conversation

@costajohnt
Copy link
Copy Markdown
Owner

Summary

  • GitHub's Search API caps at 1000 results; sort:updated-desc drops the oldest-updated PRs, undercounting users with >1000 merged PRs/year.
  • Two-pass union (sort:updated-desc + sort:updated-asc, deduped by URL) raises the effective ceiling to ~2000.
  • cappedMerged now reflects whether items actually cover totalCount instead of the coarse merged >= 1000.

Test plan

  • pnpm test (116/116 pass; added 2 tests, updated 1)
  • pnpm run typecheck clean
  • Live verification against costajohnt: 1074 totalCount, 114 merged PRs in 50+ star external repos (was 101)

🤖 Generated with Claude Code

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>
@costajohnt costajohnt merged commit d6eeffe into main May 8, 2026
4 checks passed
@costajohnt costajohnt deleted the fix/two-pass-merged-pr-fetch branch May 8, 2026 04:58
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.

1 participant