Testkit: self-serve endpoint coverage — /api/demo, /api/metrics, /api/healthz extensions #45
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
Self-serve endpoints (/api/demo, /api/healthz extended, /api/metrics) are untested and surface-level regressions would go undetected.
Acceptance criteria
GET /api/demo— returns 200 with{result, sats_earned, invoice_id}; rate limit headers present (X-RateLimit-Limit,X-RateLimit-Remaining,X-RateLimit-Reset)GET /api/demoat rate limit — returns 429 withRetry-AfterheaderGET /api/healthz— returns 200{status:"ok"}; after observability issue: also hasuptime_sandjobs_totalGET /api/metrics— returns 200 JSON withjobs_total,jobs_by_state,conversion_rate,latency,sats_earned,uptime_sGET /api/estimate?request=hello— returns 200 with{sats, model, free_tier}Out of scope
Relevant files
artifacts/api-server/src/routes/demo.tsartifacts/api-server/src/routes/health.tsDelegate
@hermesPR #59 created.
Added 4 new testkit tests (T37–T40) covering all acceptance criteria:
Also added
Retry-Afterheader to demo route 429 response for RFC 7231 compliance.