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

@@ -92,3 +92,37 @@ func TestRepoAffiliationsAndOwnership(t *testing.T) {
}
}
}
func TestMonthWindowsCoverQuarterExactly(t *testing.T) {
from := time.Date(2026, 4, 1, 0, 0, 0, 0, time.UTC)
to := time.Date(2026, 6, 30, 23, 59, 59, 0, time.UTC)
got := monthWindows(from, to)
if len(got) != 3 {
t.Fatalf("want 3 months in a quarter, got %d", len(got))
}
if !got[0][0].Equal(from) {
t.Errorf("first month starts at %s, want %s", got[0][0], from)
}
if !got[len(got)-1][1].Equal(to) {
t.Errorf("last month ends at %s, want the quarter's end %s", got[len(got)-1][1], to)
}
for i := 1; i < len(got); i++ {
if !got[i][0].After(got[i-1][1]) {
t.Errorf("month %d overlaps month %d", i, i-1)
}
}
}
func TestMonthWindowsClampPartialFinalMonth(t *testing.T) {
// A current quarter clamped to "now" mid-month must not hand back a
// window running past it.
from := time.Date(2026, 7, 1, 0, 0, 0, 0, time.UTC)
now := time.Date(2026, 8, 13, 10, 30, 0, 0, time.UTC)
got := monthWindows(from, now)
if len(got) != 2 {
t.Fatalf("want July + partial August, got %d", len(got))
}
if !got[1][1].Equal(now) {
t.Errorf("final month ends at %s, want clamped to %s", got[1][1], now)
}
}