fix: summary/pages no longer miss the current day #20

Merged
synapse merged 1 commit from fix/end-date-semantics into develop 2026-08-22 09:54:59 +00:00
Owner

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/total parse bare-date end= 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. Our period_range sent end=today uniformly, 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_hits send end + 1 day; ranked calls untouched. period_range keeps 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

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/total` parse bare-date `end=` 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. Our `period_range` sent `end=today` uniformly, 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_hits` send `end + 1 day`; ranked calls untouched. `period_range` keeps 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.com/claude-code) https://claude.ai/code/session_01T5j3dAJVcUjZv9k76sRTt9
fix: summary/pages no longer miss the current day
All checks were successful
ci / gate (pull_request) Successful in 19s
6af6bffecd
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
synapse merged commit f1544d5f88 into develop 2026-08-22 09:54:59 +00:00
synapse deleted branch fix/end-date-semantics 2026-08-22 09:54:59 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
synapse/goatcounter-stats-gateway!20
No description provided.