2 Commits
Author SHA1 Message Date
zeekay 1e81bc7b64 a window is a count and a unit, so 90d and all answer
The relative half of ParseWindow was a table of four spellings. A window nobody
had enumerated — 14d, 90d, all — was an unknown range and a 400, on the surface
an operator reads to see where money went. The stores behind these series keep
two years, so the door was refusing questions the data could answer.

Read the count off the label instead: any <N>h or <N>d resolves, day/week/month
still name the common ones, and all reaches back to Horizon, the retention those
stores keep. Every label the table admitted resolves to the very same window, so
the change only adds.

Past the horizon is still a refusal, by name, rather than a window served short:
on a series that carries money a quiet zero reads as "nothing was spent".
2026-08-13 23:56:10 -07:00
zeekayandHanzo Dev 75b73f4b15 types: the fleet's shared value layer
A value belongs here when two or more services must agree on it exactly and
neither should inherit the other's machinery to do so. The package imports the
standard library only; go list -deps is 63, all stdlib.

Seeded with the metered-series window. Cloud and ai must resolve ?range/?start/
?end to the same [start, end) and the same bucket interval, and cloud reached
that 30-line rule through a package that carries 1925 dependencies.

Interval is a closed type. The bucket function is not bindable in the engines
that serve these series, so the interval reaches a query by interpolation;
ParseWindow yields Hour or Day and nothing else can be constructed through it.

ParseWindow is total: it returns a window or an error, never a zero window a
caller could read as a valid range. It also carries the resolved label, which
every call site previously re-derived.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-26 19:04:56 -07:00