Skip to content

fix: exclude own repos from PR counts and filter by star count#544

Open
costajohnt wants to merge 2 commits intomainfrom
fix/exclude-own-repos-from-pr-counts
Open

fix: exclude own repos from PR counts and filter by star count#544
costajohnt wants to merge 2 commits intomainfrom
fix/exclude-own-repos-from-pr-counts

Conversation

@costajohnt
Copy link
Owner

Summary

  • Add -user: qualifier to GitHub Search API query to exclude own repos at the API level, preventing pagination waste (89/100 results were from costajohnt/oss-autopilot)
  • Add 50+ star threshold in getStats() so only meaningful OSS contributions count toward merged/closed totals
  • Bump cache key to v2 to invalidate stale cached data that included own-repo noise

Changes

github-stats.ts

  • Search query now includes -user:${githubUsername} so the API itself filters out own repos instead of wasting pagination slots
  • Cache key bumped from pr-counts:${label} to pr-counts:v2:${label} to invalidate stale data

state.ts

  • getStats() now skips repos with stargazersCount < 50 — only repos with 50+ stars count toward merged/closed/tracked totals

Tests

  • Updated cache key references in github-stats.test.ts
  • Added test verifying -user: qualifier is included in search query
  • Added stargazersCount to all getStats() test fixtures
  • Added tests for 50-star threshold (below threshold, boundary at exactly 50, undefined stargazersCount)

Test plan

  • All 174 existing tests pass
  • New test: verifies -user: qualifier in search query
  • New tests: 50-star threshold filtering in getStats()
  • Manual verification: run /oss and confirm merged PR count reflects only 50+ star repos

Closes #543

- Add -user: qualifier to GitHub Search API query to exclude own repos
  at the API level, preventing pagination waste (89/100 results were
  from own repos)
- Add 50+ star threshold in getStats() so only meaningful OSS
  contributions count toward merged/closed totals
- Bump cache key to v2 to invalidate stale cached data

Closes #543
The stdio transport tests spawn a real child process via `npx tsx`,
which has variable startup time on CI runners. The default 5s vitest
timeout is too tight — bump to 30s for the stdio describe block.
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.

Merged/closed PR counts drastically undercounted due to own-repo pagination waste

1 participant