Skip to content

GL-334: Fix startup gate bypass + make /readiness probe real DB and Redis #41

Description

@discodone

Review source

Round 14 (Opus 4.8 + Gemini) — P0/P1. Startup gate is bypassable, readiness probe lies.

Problem

  1. startup_errors() runs only in backend/main.py. Running uvicorn backend.src.api.app:app (the standard ASGI invocation that DEPLOYMENT docs reference for workers) skips ALL production config validation. You can boot in production mode with placeholder secrets and demo endpoints on.
  2. /readiness (health.py:87) only validates runtime config, not DB or Redis. A pod with a dead database reports ready and takes traffic. The DB check lives in /health (liveness), which is backwards — liveness failure restarts the pod instead of draining it.

Fix

  • Call startup_errors() inside the app lifespan (app.py) so it fails fast regardless of entrypoint
  • Move DB + Redis connectivity check from /health into /readiness; /readiness returns 503 when either is down
  • /health (liveness) should only check the process is alive, not dependencies

Acceptance Criteria

  • Booting via uvicorn ...app:app with placeholder secrets in production mode fails at startup
  • /readiness returns 503 when DB is down
  • /readiness returns 503 when Redis is down
  • /health stays 200 even when DB is down (liveness vs readiness)
  • mypy clean, ruff clean, tests >= baseline

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions