feat: scale fixes — max-instances, asset caching, shared rate limits, global cap #65

Merged
will.anderson merged 1 commits from fix/checkout-auth-reveal into dev 2026-05-11 03:12:32 +00:00
Owner

Implements four scale fixes for 1M user readiness:

  1. max-instances: soul-demo-stage 10→50, marketing-stage explicitly set to 200
  2. Asset caching: /assets/, /brand/, /js/* now return Cache-Control: public, max-age=31536000, immutable — Cloudflare caches at the edge, eliminating Cloud Run hits
  3. Shared rate limiting: Demo per-uid 10/day cap moved from in-process memory to Supabase demo_rate_limits table (upsert via supabase_insert); enforced across all instances. Falls back to in-process for local dev.
  4. Global circuit breaker: Per-instance cap of 2000 demo requests/UTC day; returns busy error when tripped
Implements four scale fixes for 1M user readiness: 1. **max-instances**: soul-demo-stage 10→50, marketing-stage explicitly set to 200 2. **Asset caching**: /assets/*, /brand/*, /js/* now return Cache-Control: public, max-age=31536000, immutable — Cloudflare caches at the edge, eliminating Cloud Run hits 3. **Shared rate limiting**: Demo per-uid 10/day cap moved from in-process memory to Supabase demo_rate_limits table (upsert via supabase_insert); enforced across all instances. Falls back to in-process for local dev. 4. **Global circuit breaker**: Per-instance cap of 2000 demo requests/UTC day; returns busy error when tripped
will.anderson added 1 commit 2026-05-11 03:12:24 +00:00
feat: scale fixes — max-instances, asset caching, shared rate limits, global cap
Dev — Build & local smoke test / build-smoke (pull_request) Successful in 2m0s
bdb6ddc581
- soul-demo-stage: raise max-instances 10 → 50
- marketing-stage: explicitly set max-instances 200
- /assets/* and /brand/*: return Cache-Control: public, max-age=31536000, immutable
  so Cloudflare caches static assets at the edge (eliminates Cloud Run hit per request)
- /js/*: bump from max-age=3600 to max-age=31536000, immutable (same policy)
- Per-uid demo rate limit: replace in-process state with Supabase demo_rate_limits table
  so the 10-chats/day cap is enforced across all Cloud Run instances; falls back to
  in-process for local dev when SUPABASE_SERVICE_KEY is absent
- Global circuit breaker: trip if any single instance handles ≥2000 demo requests/UTC day
will.anderson merged commit 7536c216e6 into dev 2026-05-11 03:12:32 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: neuron-technologies/neuron-web#65