ADR 0014 — Periods and Resets: UTC Calendar Windows or Billing-Period Anchored
Status: Accepted ★
Context
Section titled “Context”Metered features reset: per day, month, or “every billing cycle” (which starts on the subscription’s anchor day, not the 1st). Resets must not need a cron job, and two servers must agree on the window.
Decision
Section titled “Decision”reset: "day" | "week" | "month" | "quarter" | "year" | "billing_period" | "never"on metered and credits features (plans may override per feature).- Calendar windows are UTC (
weekstarts Monday, ISO).billing_perioduses the entitled base subscription’speriodStart/periodEnd(rolling monthly from its start, Stripe-style day clamping, when the period data is stale); without one (free plan) it falls back to UTC calendar months. (An earlier draft anchored on the customer’screatedAt, but a never-written customer has no stablecreatedAt, and re-anchoring on the first write would reset usage mid-month.) - The period key is derived (
m:2026-11,w:2026-11-16,bp:2026-11-14T08:00:00.000Z,all), so a reset is simply a new counter key — nothing to delete. Old keys get anexpiresAtretention hint. resetsAtis reported on every decision.ent.resetUsage(customer, feature)(admin) deletes the current period key.- Rollover of unused allowance is not in 0.x (use grants).
Consequences
Section titled “Consequences”- Zero background jobs for correctness; consistent across instances with synchronized clocks.
- Time zones other than UTC are a possible future option, not a default.