fix(cabana): scope the token last_used_at throttle to the guard instance

- The process-global debounce map was keyed by token ID, so a stamp from one test database suppressed a later write in another and turned TestBackendTokenPostgres red depending on order
- Each compositeGuard now owns a stampThrottle; the backend guard and the ResolveBackend guard of one activation share it, so a single-app binary still writes last_used_at at most once a minute per token
- TestTokenLastUsedThrottlePerGuard pins the per-guard isolation
This commit is contained in:
2026-10-11 15:19:55 +02:00
parent 21fdcfcba6
commit b45af8ebbf
5 changed files with 74 additions and 15 deletions

View File

@@ -348,7 +348,7 @@ func TestTokenGatesSmoke(t *testing.T) {
}
// Stamp debounce: two auths within a minute → one store stamp.
lastStamp.Delete(uint(101))
guard.stamps.last.Delete(uint(101))
store.stampN = 0
r = httptest.NewRequest(http.MethodGet, "/x", nil)
r.Header.Set("Authorization", "Bearer "+demoTok)