fix: summary/pages no longer miss the current day #20
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/end-date-semantics"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes goatcounter-stats-gateway-1ca — reported by the nixos-config session (live A/B on chiba: today's hits missing from /stats/hits, present in /stats/locations, same date range).
Root cause, confirmed in upstream source:
/api/v0/stats/hits+/stats/totalparse bare-dateend=into midnight at the start of that day and range-compare full timestamps (ztime.NewRange(start).To(end)) → the end day is excluded. The ranked/stats/{page}endpoints read day-bucketed tables compared at date granularity → inclusive. Ourperiod_rangesentend=todayuniformly, so summary and pages permanently lost the current day while ranked panels were correct.Fix: in the upstream layer (where GoatCounter quirk-knowledge lives — slight placement change vs. the reporter's call-site suggestion, same semantics):
stats_total/stats_hitssendend + 1 day; ranked calls untouched.period_rangekeeps one meaning everywhere (inclusive).Verified: reproduced pre-fix locally (2 seeded today-hits → summary today=0, upstream
start=today&end=today→ total 0), green post-fix (today=2, total 45→47, /today-test in pages). New wiremock regression test asserts the actual wire dates (end=tomorrow for hits/total, end=today for ranked) so this can't silently regress. 29/29 tests, full gate green.Ships as v0.3.2; chiba needs the pin bump after (reporter will be notified).
🤖 Generated with Claude Code
https://claude.ai/code/session_01T5j3dAJVcUjZv9k76sRTt9
GoatCounter parses a bare-date end= into midnight-START of that day and compares full timestamps on /stats/hits and /stats/total — excluding the end day — while the day-bucketed /stats/{page} endpoints treat the same parameter date-inclusively. Reported with a live A/B by the nixos-config session, confirmed in upstream source and reproduced locally (today's seeded hits: summary count 0 pre-fix, 2 post-fix). The upstream layer now absorbs the quirk (+1 day on those two calls only); a wire-level regression test pins end=tomorrow for hits/total and end=today for ranked panels. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T5j3dAJVcUjZv9k76sRTt9