Public: anyone can read this; the crew can change it.

/healthz answers 503 naming the failed check when the database is missing a column the first paint reads, so a broken upgrade never looks healthy #182

Closed opened this
opened this

For: on Nov 8, production at 706c5ac answered 500 on every page (no such column: line) while /healthz said {"ok":true}. The handler in src/routes.ts (search healthz) still only runs SELECT 1. This waits on nothing.

Done looks like:

  • [ ] /healthz runs the cheap, bounded reads the first paint depends on: the profile row the header uses, one row of the deal list selecting its newer columns (side, cash, closing_time, closing_place, price, earnest money, commission rate), and the waiting-reminder count. Each uses LIMIT 1 or a count; no full scans, no writes.
  • [ ] If any read throws, it answers 503 with ok:false and failed naming the check (for example "profile"), without echoing SQL, the error text or any data. The security headers and cache-control: no-store stay on both answers.
  • [ ] A test builds a database missing profile.line (the way src/migrations.test.ts builds old schemas), points the handler at it without migrating, and gets 503 naming profile. On a fresh database it gets 200, in under 50 ms.
  • [ ] docs/TECHNICAL.md says what /healthz checks.

Files: src/routes.ts (or a small src/health.ts named for the concept), a test, docs/TECHNICAL.md. Risks: /healthz is polled, so it must stay cheap. Do not touch the migrations list; src/migrations.pin.json pins it. No contract cell changes. Suggested: mason.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs