caelum0x 8558149a2a fix: list_account_allowances returns stale spent_micros for elapsed Rolling windows
GET /v1/accounts/:id/allowances (mint-server's `allowances` handler) calls
store.list_account_allowances, a second read path over the same
AllowanceRecord type as get_allowance/read_allowance. Commit 8e6a6671 fixed
the stale spent_micros/window_start_ms bug for GET /v1/allowances/:id by
projecting AllowanceRecord::as_of(now) onto the single-record read, but
never applied the same fix to this listing call site in either the
in-memory or Postgres store, so a caller polling an account's allowances
after a Rolling window elapsed but before the next spend would still see
the stale, too-low spent_micros.

Apply the same `.as_of(clock.now())` projection to each record returned by
list_account_allowances in both mint-store/src/memory.rs and
mint-store-postgres/src/store.rs. Add a ledger-level regression test
mirroring the existing read_allowance_reflects_rolling_reset test, but
exercising list_account_allowances instead; verified it fails with the
exact stale value (spent_micros 5_000_000 instead of 0) when the fix is
reverted, and passes with the fix applied.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-03 15:56:26 +03:00
..