- Verified all 12 MockUpstream scenarios work correctly
- Verified all 6 MockUpstream methods work correctly
- All tests pass: scenarios, methods, and proxy integration
- Comprehensive test coverage in mockupstream_test.go
- Add GetTestMaxRetries_WithOverride test to verify MAX_RETRIES env var handling
- Add ConfigureTestEnv test to verify all required environment variables are set
- Test coverage includes: valid/invalid env values, all 7 required vars
- All acceptance criteria for bead bf-4lid are now verified
All required changes were already present in docs/plan/plan.md from
commit cadc7da. This note documents verification of acceptance criteria:
- Header versions match proxy/VERSION and dashboard/VERSION
- Tokens panel row includes cache-read/cache-write series
- Collector fields table includes cache token rates
- Docs inventory lists all four new documents
All acceptance criteria verified - TestAdaptiveRateLimiter_BasicBounds
already exists and passes with injected window duration.
Co-Authored-By: Claude <noreply@anthropic.com>
Add comprehensive test infrastructure for retry/response-validation tests
in proxy package. Provides httptest-based mock upstream server, test
helpers for request/response handling, and test-mode configuration for
fast test execution.
New file: proxy/helpers_test.go
- MockUpstream: Configurable HTTP server simulating Z.AI upstream
- Test scenarios: 429 with/without Retry-After, empty/invalid JSON body,
empty streaming, 422/500/404 responses, network errors, success
- Request builders: CreateProxyRequest, CreateMessagesRequest,
CreateStreaming/NonStreaming* helpers
- Response assertions: AssertStatusCode, AssertJSONBody, AssertResponseField,
AssertEmptyBody, AssertHeader, AssertContentType
- Proxy handler factory: CreateTestProxyHandler for configured test handlers
- Test execution helpers: ExecuteProxyRequest, ExecuteMessagesRequest
- Test-mode config: ConfigureTestEnv, GetTestMaxRetries (defaults to 1 for fast tests)
- Backoff delay helpers: CalculateBackoffDelay, CalculateTotalMaxDelay
Acceptance criteria met:
✅ New test helpers with httptest servers
✅ Helper functions for requests and assertions
✅ Test-mode env var for fast tests (MAX_RETRIES=1 default)
✅ go test ./proxy/ -run TestHelper passes
Co-Authored-By: Claude <noreply@anthropic.com>
- TestAdaptiveRateLimiter_BasicState already exists in proxy/ratelimiter_test.go
- All acceptance criteria already met and verified passing
- No code changes required
Co-Authored-By: Claude <noreply@anthropic.com>
Add NewAdaptiveRateLimiterWithWindow constructor for test-only refactor:
- Production code uses NewAdaptiveRateLimiter with default 30s window
- Tests can inject shorter durations (e.g., 100ms) for fast execution
- No behavior changes to production rate limiting logic
Acceptance criteria:
- NewAdaptiveRateLimiterWithWindow accepts configurable window duration
- Production callers continue using default 30s window
- Tests can inject millisecond-scale windows for fast iteration
- No changes to rate limiting logic or defaults
Co-Authored-By: Claude <noreply@anthropic.com>
All migration items completed:
- Workflow templates pushed to declarative-config (May 17)
- Documentation updated to point to new repo (ardenone-cluster commit 79b9a9cf8)
- Old container directories retired (ardenone-cluster commit 4b4468842)
The zai-proxy project now lives at git.ardenone.com/jedarden/zai-proxy
with CI/CD workflow templates deployed via ArgoCD.
Note: Commit pending push due to Forgejo network connectivity issue.
Bead-Id: bf-4a2