Tier-5

Merged
HU
4mo ago
+12430-5809

Summary by cubic

Tier 5 scale upgrades plus Tier 6/7 polish: adds a DO-backed rate limiter, KV-cached session lists, structured logs with trace IDs, deep health checks, and ships PWA offline read-only, i18n, scorecard export, and static API docs.

  • New Features

    • API scale: per‑IP RateLimiter Durable Object; CACHE KV for GET /sessions (KV 60s, HTTP max-age=15, X-Cache), structured JSON logs with X-Trace-Id and 500 bodies including traceId, deep readiness at GET /health?deep=1 (503 on DB down).
    • API docs: live GET /openapi.json and static Redoc at /docs from apps/web/public/openapi.json (exported via npm run export:openapi).
    • Web offline: PWA via vite-plugin-pwa with Workbox NetworkFirst for /sessions*; React Query persistence for sessions/session; OfflineBanner; queries offlineFirst, mutations online.
    • UX extras: print‑ready scorecard export on Session Detail; i18next with en strings; FileField uses hidden input + visible “Choose file” button; optional analytics via VITE_PLAUSIBLE_DOMAIN or VITE_CF_WEB_ANALYTICS_TOKEN.
    • Quality & DX: Vitest RTL component tests, OpenAPI contract tests, Playwright visual tests; npm run deploy:staging:full; upgraded wrangler to v4; improved README.
  • Migration

    • Create and bind KV namespaces for CACHE (run from apps/api: wrangler kv namespace create ...) and deploy DO migration for RateLimiter; IDs are configured in wrangler.toml.
    • Deploy with npm run deploy:staging:full (migrate → force‑rls → rls check → seed → deploy).
    • Optionally set VITE_PLAUSIBLE_DOMAIN or VITE_CF_WEB_ANALYTICS_TOKEN for analytics; no changes needed for local dev.