Fixes BACKLOG P0-3: /api/health used to hardcode ok: true and only ever check presence of DATABASE_URL/REDIS_URL — never whether anything was actually reachable. docs/architecture/ARCHITECTURE.md's own words: "an uptime monitor watching HTTP 200 would show green for a dying instance."
lib/health-checks.ts — real dependency probes: db (live select 1), engine (real HTTP call to the FastAPI engine's own GET /health), stripe (Stripe's documented lightweight balance.retrieve() call), queue (honestly reports not_integrated when REDIS_URL is set but unused — no Redis client is wired anywhere in this repo).
GET /api/health stays a liveness check (always 200 while the process can respond); the body's ok field is now the honest signal instead of a hardcoded literal.
New GET /api/ready — fails closed with 503 when the load-bearing dependency (db) isn't both configured and reachable. This was the other half of the finding: "no /ready route existed at all" (CD-04/OBS-04).
contracts/openapi.yaml, docs/architecture/ARCHITECTURE.md, docs/slo.md updated to match.
Test plan
pnpm run typecheck — clean, no errors (blocking gate).
pnpm run test — 156 passed, 1 pre-existing skip (unrelated live-infra test), including 17 new unit tests (dependency-injected fakes, no real network/DB) + 5 new route-level tests.
pnpm run build — succeeds, /api/ready registered as a new route.
pnpm run typecheck:app (advisory) — identical 9 pre-existing errors as clean main baseline, confirmed via git stash diff. No new advisory errors introduced.
pnpm exec eslint on every new file — 0 errors, 0 warnings.
Confirmed via curl against a real pnpm run build && pnpm run start that both routes respond correctly with the new dependency fields.
Not merged
Per instructions — needs a final human look. main on this repo has had recent contention; this PR does not touch the WAF-bypass/scraper code or any frozen path.
## Summary
Fixes BACKLOG **P0-3**: `/api/health` used to hardcode `ok: true` and only ever check *presence* of `DATABASE_URL`/`REDIS_URL` — never whether anything was actually reachable. `docs/architecture/ARCHITECTURE.md`'s own words: "an uptime monitor watching HTTP 200 would show green for a dying instance."
- `lib/health-checks.ts` — real dependency probes: `db` (live `select 1`), `engine` (real HTTP call to the FastAPI engine's own `GET /health`), `stripe` (Stripe's documented lightweight `balance.retrieve()` call), `queue` (honestly reports `not_integrated` when `REDIS_URL` is set but unused — no Redis client is wired anywhere in this repo).
- `GET /api/health` stays a **liveness** check (always 200 while the process can respond); the body's `ok` field is now the honest signal instead of a hardcoded literal.
- New **`GET /api/ready`** — fails closed with 503 when the load-bearing dependency (`db`) isn't both configured and reachable. This was the other half of the finding: "no `/ready` route existed at all" (CD-04/OBS-04).
- `contracts/openapi.yaml`, `docs/architecture/ARCHITECTURE.md`, `docs/slo.md` updated to match.
## Test plan
- [x] `pnpm run typecheck` — clean, no errors (blocking gate).
- [x] `pnpm run test` — 156 passed, 1 pre-existing skip (unrelated live-infra test), including 17 new unit tests (dependency-injected fakes, no real network/DB) + 5 new route-level tests.
- [x] `pnpm run build` — succeeds, `/api/ready` registered as a new route.
- [x] `pnpm run typecheck:app` (advisory) — identical 9 pre-existing errors as clean `main` baseline, confirmed via `git stash` diff. No new advisory errors introduced.
- [x] `pnpm exec eslint` on every new file — 0 errors, 0 warnings.
- [x] Confirmed via `curl` against a real `pnpm run build && pnpm run start` that both routes respond correctly with the new dependency fields.
## Not merged
Per instructions — needs a final human look. `main` on this repo has had recent contention; this PR does not touch the WAF-bypass/scraper code or any frozen path.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
BACKLOG P0-3: /api/health only ever checked *presence* of DATABASE_URL/
REDIS_URL and always returned ok:true regardless of whether anything was
reachable -- ARCHITECTURE.md's own words, "an uptime monitor watching HTTP
200 would show green for a dying instance".
lib/health-checks.ts adds real dependency probes:
- db: a live `select 1` round trip (not just DATABASE_URL presence)
- engine: a real HTTP call to the FastAPI engine's own GET /health
- stripe: Stripe's documented lightweight balance.retrieve() liveness call
- queue: honestly reports "not_integrated" when REDIS_URL is set but
unused -- no Redis client is wired anywhere in this repo, so reporting
"ok" would fabricate a check that doesn't exist
/api/health stays a liveness check (always 200 while the process can
respond; the body's `ok` field is the honest signal). New GET /api/ready
fails closed with 503 when the load-bearing dependency (db) isn't both
configured and reachable -- the "no /ready route" gap.
contracts/openapi.yaml, docs/architecture/ARCHITECTURE.md, and docs/slo.md
updated to match. 17 new unit tests (dependency-injected fakes, no real
network/DB) + 5 route-level tests.
admin
merged commit into main2026-08-11 12:31:36 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Fixes BACKLOG P0-3:
/api/healthused to hardcodeok: trueand only ever check presence ofDATABASE_URL/REDIS_URL— never whether anything was actually reachable.docs/architecture/ARCHITECTURE.md's own words: "an uptime monitor watching HTTP 200 would show green for a dying instance."lib/health-checks.ts— real dependency probes:db(liveselect 1),engine(real HTTP call to the FastAPI engine's ownGET /health),stripe(Stripe's documented lightweightbalance.retrieve()call),queue(honestly reportsnot_integratedwhenREDIS_URLis set but unused — no Redis client is wired anywhere in this repo).GET /api/healthstays a liveness check (always 200 while the process can respond); the body'sokfield is now the honest signal instead of a hardcoded literal.GET /api/ready— fails closed with 503 when the load-bearing dependency (db) isn't both configured and reachable. This was the other half of the finding: "no/readyroute existed at all" (CD-04/OBS-04).contracts/openapi.yaml,docs/architecture/ARCHITECTURE.md,docs/slo.mdupdated to match.Test plan
pnpm run typecheck— clean, no errors (blocking gate).pnpm run test— 156 passed, 1 pre-existing skip (unrelated live-infra test), including 17 new unit tests (dependency-injected fakes, no real network/DB) + 5 new route-level tests.pnpm run build— succeeds,/api/readyregistered as a new route.pnpm run typecheck:app(advisory) — identical 9 pre-existing errors as cleanmainbaseline, confirmed viagit stashdiff. No new advisory errors introduced.pnpm exec eslinton every new file — 0 errors, 0 warnings.curlagainst a realpnpm run build && pnpm run startthat both routes respond correctly with the new dependency fields.Not merged
Per instructions — needs a final human look.
mainon this repo has had recent contention; this PR does not touch the WAF-bypass/scraper code or any frozen path.🤖 Generated with Claude Code
BACKLOG P0-3: /api/health only ever checked *presence* of DATABASE_URL/ REDIS_URL and always returned ok:true regardless of whether anything was reachable -- ARCHITECTURE.md's own words, "an uptime monitor watching HTTP 200 would show green for a dying instance". lib/health-checks.ts adds real dependency probes: - db: a live `select 1` round trip (not just DATABASE_URL presence) - engine: a real HTTP call to the FastAPI engine's own GET /health - stripe: Stripe's documented lightweight balance.retrieve() liveness call - queue: honestly reports "not_integrated" when REDIS_URL is set but unused -- no Redis client is wired anywhere in this repo, so reporting "ok" would fabricate a check that doesn't exist /api/health stays a liveness check (always 200 while the process can respond; the body's `ok` field is the honest signal). New GET /api/ready fails closed with 503 when the load-bearing dependency (db) isn't both configured and reachable -- the "no /ready route" gap. contracts/openapi.yaml, docs/architecture/ARCHITECTURE.md, and docs/slo.md updated to match. 17 new unit tests (dependency-injected fakes, no real network/DB) + 5 route-level tests.