Testkit: self-serve endpoint coverage — /api/demo, /api/metrics, /api/healthz extensions #45

Closed
opened 2026-03-19 18:52:18 +00:00 by replit · 1 comment
Owner

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/demo at rate limit — returns 429 with Retry-After header
  • GET /api/healthz — returns 200 {status:"ok"}; after observability issue: also has uptime_s and jobs_total
  • GET /api/metrics — returns 200 JSON with jobs_total, jobs_by_state, conversion_rate, latency, sats_earned, uptime_s
  • GET /api/estimate?request=hello — returns 200 with {sats, model, free_tier}
  • All prior tests continue to pass

Out of scope

  • Nostr identity tests (separate issue)
  • Session-mode tests

Relevant files

  • artifacts/api-server/src/routes/demo.ts
  • artifacts/api-server/src/routes/health.ts
  • Existing testkit

Delegate

@hermes

## 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/demo` at rate limit — returns 429 with `Retry-After` header - [ ] `GET /api/healthz` — returns 200 `{status:"ok"}`; after observability issue: also has `uptime_s` and `jobs_total` - [ ] `GET /api/metrics` — returns 200 JSON with `jobs_total`, `jobs_by_state`, `conversion_rate`, `latency`, `sats_earned`, `uptime_s` - [ ] `GET /api/estimate?request=hello` — returns 200 with `{sats, model, free_tier}` - [ ] All prior tests continue to pass ## Out of scope - Nostr identity tests (separate issue) - Session-mode tests ## Relevant files - `artifacts/api-server/src/routes/demo.ts` - `artifacts/api-server/src/routes/health.ts` - Existing testkit ## Delegate `@hermes`
replit added the apihermesbackend labels 2026-03-19 18:52:18 +00:00
claude was assigned by Rockachopa 2026-03-22 23:38:10 +00:00
Collaborator

PR #59 created.

Added 4 new testkit tests (T37–T40) covering all acceptance criteria:

  • T37: healthz extended fields (uptime_s, jobs_total)
  • T38: metrics endpoint full verification
  • T39: estimate endpoint (estimatedSats, model, tokens)
  • T40: demo 429 Retry-After header

Also added Retry-After header to demo route 429 response for RFC 7231 compliance.

PR #59 created. Added 4 new testkit tests (T37–T40) covering all acceptance criteria: - T37: healthz extended fields (uptime_s, jobs_total) - T38: metrics endpoint full verification - T39: estimate endpoint (estimatedSats, model, tokens) - T40: demo 429 Retry-After header Also added `Retry-After` header to demo route 429 response for RFC 7231 compliance.
This repo is archived. You cannot comment on issues.