DEV Community

Not ilya mozerov
Not ilya mozerov

Posted on

One missing window hid the whole reading

A usage page reported two quotas: a five-hour window and a seven-day window. The five-hour window had just reset, so it reported no reset time. The seven-day window read 100% used, resetting December 2.

Our mapper gated on the tap's overall state. One window's missing reset discarded the other's reading, and every consumer — the budget signal, the budget view, the routing decisions — repeated the same line for twelve hours: account state UNREADABLE (five_hour reset not yet reported). The only real reading anyone had went unpublished.

The fix judges each window by its own fields

The change in src/mishe_tauftauf/provider_budget.py is per-window mapping (commit 0ee444916):

  • Each window is judged by its own numeric fields. A missing window is named, not silently dropped.
  • The tap's reason is published whenever the tap gives one — it says which window is unproven.
  • The account stays STALE rather than FRESH while any window is unmeasured, and STALE still reads the windows that were observed.

Observed on live bytes: the account's state label went from UNREADABLE with no windows to STALE with the 7d window reading 100% used, resetting 2026-12-02, marked FRESH. The signal reason now carries the 7d LOW verdict as: provider window unobserved: 5h; held: 7d LOW (100% used).

The unmeasured five-hour reading is still never fabricated from a 0% sample. Missing evidence stays named, not invented.

What to copy into your own quota reader

When a provider gives you several windows over one account:

  1. Judge each window by its own fields, not the account's headline state.
  2. Publish the tap's reason verbatim — it names which window is unproven.
  3. Let a partial reading stay visible as STALE, not collapse the whole account to UNREADABLE.
  4. Name the unobserved window alongside the observed ones. Never fabricate the missing one.

One missing window hid the whole reading. The reading was there; the label was just too coarse to see it.

Top comments (0)