fix(github): split a saturated quarter by month to recover dropped repos

Quarterly windows were not enough for the busiest quarter: a live run
warned that 2026-04-01..2026-06-30 still came back at the 100-repo
ceiling, so its seed list was truncated and those repos never got
probed for commit history.

Re-ask a saturated quarter month by month and merge only the repo
lists. The quarter has already contributed its calendar days and commit
totals, so the month passes skip that fold; verified by forcing the
ceiling down to 20 and confirming all six calendar-derived cards stay
byte-identical. Warn only when a month itself saturates, since there is
no finer window left to ask for.
This commit is contained in:
tiennm99 committed 2026-08-13 13:34:08 +07:00
1 parent 7832842c5d
commit 2c3667d28c
4 files changed
+104 -28

No files matched your search

+5 -3
View File
@@ -40,8 +40,10 @@ FetchContributionsAllTime(ctx, profile, opts)
│ per quarter: totalCommitContributions +
│ contributionCalendar.weeks +
│ commitContributionsByRepository(maxRepositories: 100)
│ quarters keep each window under the 100-repo ceiling, which a
│ year-wide window silently truncates at
│ quarters keep most windows under the 100-repo ceiling, which a
│ year-wide window silently truncates at; a quarter that still
│ saturates is re-queried per month for repos only (its days and
│ totals are already folded in)
│ yields: SeedRepos (deduped),
│ DailyContributionsAllTime,
│ TotalCommitsAllTime
@@ -68,7 +70,7 @@ All three queries live in `internal/github/queries.go`.
| Query | Purpose | Cost estimate |
| --- | --- | --- |
| `profileQuery` | Profile identity + totals + owned repos + last-year calendar | 1–10 calls (100 repos/page × ≤10 pages safety cap) |
| `contributionYearQuery` | Per-quarter calendar + seed list | 4 calls per active year (typically 4–40) |
| `contributionYearQuery` | Per-quarter calendar + seed list | 4 calls per active year, +3 per saturated quarter |
| `commitHistoryQuery` | Authored commits on default branch | 1 call per 100 commits per seed repo |
Typical run (8 active years, 30 seed repos, avg 50 commits each):