Commit graph

13 commits

Author SHA1 Message Date
jedarden
4216114dd1 docs(bf-4gif): verify MockUpstream server scenarios and methods
- 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
2026-07-02 18:50:04 -04:00
jedarden
07f348c55e docs(bf-1sba): document that shared DefaultConfig logic already exists 2026-07-02 18:31:17 -04:00
jedarden
624047e1df docs(bf-4lid): verify test environment configuration helpers
All acceptance criteria verified:
1. IsTestMode() correctly detects test mode
2. GetTestMaxRetries() returns DefaultTestMaxRetries (1) by default
3. GetTestMaxRetries() respects MAX_RETRIES environment variable
4. ConfigureTestEnv() sets all 7 required environment variables

All 19 subtests in TestHelperFunctions pass.
2026-07-02 18:05:40 -04:00
jedarden
1b597190b1 test(bf-4lid): add comprehensive test environment config helper tests
- 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
2026-07-02 17:39:34 -04:00
jedarden
ef301090ce docs(bf-2kk): verify response validation test coverage
All required tests already exist and pass:
- Empty/invalid JSON body (non-streaming) triggers retries → 502
- Empty streaming response (zero bytes) triggers retries → 502
- Upstream call counts verified (1 + MAX_RETRIES)
- Metric assertions verified (error_type labels)
- go test ./proxy/ -run TestResponseValidation -race PASS

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-02 15:33:08 -04:00
jedarden
fceff86231 docs(bf-244): verify 429 retry logic unit tests
- Confirmed comprehensive 429 retry tests exist in proxy/retry_test.go
- All tests pass with -race flag
- Test coverage includes:
  - 429 with Retry-After header (delay honored, metric tracked, call counts verified)
  - 429 without Retry-After (exponential backoff, metric tracked, call counts verified)
  - Multiple retries, metric labels, concurrent scenarios
  - Integration tests with real ProxyHandler

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-02 15:04:19 -04:00
jedarden
26ab25bc93 notes(bf-4k9): verify plan.md already up-to-date for dashboard 1.1.0
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
2026-07-02 13:53:45 -04:00
jedarden
906da31dec 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 <noreply@anthropic.com>
2026-07-02 13:19:04 -04:00
jedarden
2cdef80126 test(bf-3zp): add mock upstream server test infrastructure
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>
2026-07-02 12:45:10 -04:00
jedarden
49471e87a7 docs(bf-47d): document that TestAdaptiveRateLimiter_BasicState already exists
- 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>
2026-07-02 12:30:34 -04:00
jedarden
ee39121cd9 test(ratelimiter): make AdaptiveRateLimiter testable via window duration injection
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>
2026-07-02 10:55:06 -04:00
jedarden
769c33ea3a docs(notes): document bead bf-4co completion - README fixes already done in a106abd 2026-07-02 07:59:17 -04:00
jedarden
36727ac66d docs(plan): mark migration checklist complete
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
2026-06-21 10:38:46 -04:00