From 906da31decb36fc5868cc51cc26125837efb54a4 Mon Sep 17 00:00:00 2001 From: jedarden Date: Thu, 2 Jul 2026 13:17:39 -0400 Subject: [PATCH] notes(bf-32n): document that bounds enforcement tests already exist All acceptance criteria verified - TestAdaptiveRateLimiter_BasicBounds already exists and passes with injected window duration. Co-Authored-By: Claude --- notes/bf-32n.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 notes/bf-32n.md diff --git a/notes/bf-32n.md b/notes/bf-32n.md new file mode 100644 index 0000000..157f298 --- /dev/null +++ b/notes/bf-32n.md @@ -0,0 +1,29 @@ +# Bead bf-32n: Add bounds enforcement tests + +## Status + +**Already complete** - The required test `TestAdaptiveRateLimiter_BasicBounds` already exists and passes all acceptance criteria. + +## Verification + +All acceptance criteria met: + +1. ✅ TestAdaptiveRateLimiter_BasicBounds test function exists (line 982) +2. ✅ Table-driven with multiple bound scenarios (4 test cases) +3. ✅ Tests use injected window duration (testWindow = 10ms, no sleep calls) +4. ✅ Tests verify rate stays in [minRate, maxRate] under all conditions +5. ✅ Tests pass: `go test ./proxy -v -run TestAdaptiveRateLimiter_BasicBounds` + +## Scope Coverage + +All required scenarios covered: +- ✅ Rate never drops below minRate (default: 10) +- ✅ Rate never exceeds maxRate (default: 100) +- ✅ Heavy 429 load drives rate to min but not below +- ✅ Continuous success drives rate to max but not above + +## Original Implementation + +Test was added in commit 88358f9 ("test(ratelimiter): add basic state and bounds tests for AdaptiveRateLimiter") and improved in commit 22644ea to use injected window duration for faster test execution. + +Location: `proxy/ratelimiter_test.go:982-1066`