Skip to content

Align listing windows with day boundaries - #168

Merged
vertti merged 1 commit into
mainfrom
perf/window-alignment
Jul 15, 2026
Merged

Align listing windows with day boundaries#168
vertti merged 1 commit into
mainfrom
perf/window-alignment

Conversation

@vertti

@vertti vertti commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Fixes ROADMAP P3 and P4 — the two halves of the same seam: GitHub's created filter is date-only and inclusive, and both bugs came from mixing it with timestamp arithmetic.

P3 (window overlap): windowStart = windowEnd put the seam day in both windows — boundary runs double-listed, double-hydrated, double-counted by the budget, double-saved (~4 duplicated days per 30d scan). Next window now starts the day after. Red test captures the created params and asserts disjoint + contiguous; the old sliding-window test's "3 calls for 15 days" expectation encoded the overlap and is updated to 2.

P4 (perpetual boundary re-fetch): a mid-day --since timestamp meant the API listed the since-day's morning runs on every scan while RunsSince's timestamp comparison never recognized them as cached — the steady "21 to fetch" visible in every earlier verbose run, re-hydrated forever. Relative forms now truncate to UTC midnight so filter and cache agree. --since 0d stays rejected (validated pre-truncation, caught by the existing U7 test on the first cut).

Live proof: two consecutive --since 7d -v scans of cli/cli: before — 783 cached, 21 to fetch on every run; after — 808 cached, 0 to fetch on the second run. Estimated GraphQL calls: ~0.

P3: windowStart = windowEnd with an inclusive date-only created filter
put the seam day in BOTH windows — boundary runs were double-listed,
double-hydrated, double-counted by the rate budget, and double-saved
(~4 duplicated days per default 30d scan). The next window now starts
the day after the previous ends; pinned by a disjoint-and-contiguous
test over the captured created params.

P4: relative --since forms (7d, 2w, 3mo) now truncate to UTC midnight.
GitHub's created filter is date-only, so a mid-day since timestamp
disagreed with what the API returned: runs from the since-day's morning
were listed every scan but never matched RunsSince's timestamp
comparison — cached yet re-hydrated on every invocation, forever.
--since 0d is still rejected (validated before truncation).

Live: two consecutive 7d scans of cli/cli went from a steady '21 to
fetch' on every run to 808 cached / 0 to fetch.
(ROADMAP P3 + P4)
@vertti
vertti enabled auto-merge July 15, 2026 14:18
@vertti
vertti merged commit a264dea into main Jul 15, 2026
1 check passed
@vertti
vertti deleted the perf/window-alignment branch July 15, 2026 14:20
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