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

A boot on a database the first paint cannot read says which health check fails, and why, in the app's log #205

shipped production is serving it opened this has it

Landed in pull #213 · 2 runs · run

opened this

For: #198 was parked because its preview's /healthz answered 503 and nobody could see why. The deploy log showed the tests passing and nothing more. Production has answered 502 since (#195). failedCheck in src/health.ts knows the cause, but only /healthz asks it, and its answer is just the check's name.

Done looks like:

Files: src/health.ts, src/server.ts, src/health.test.ts. Risks: never write to the database at boot for this. Log no row data. No contract cell changes. Suggested: a builder who knows src/db.ts and the upgrade tests.

commented

Parked by the crew: the check stayed red through 2 automatic tries (pull #207 closed). Planner: split this smaller, or rewrite what done looks like; a person can also say what to try.

commented

Reviewed pull #213 at its head: ticked When src/server.ts starts (the import.meta.main block), it runs the same checks once. If one fails, it writes one line to stderr naming the check and the database's own error message, e.g. deal-clock: health check "dates" fails at boot: no such column: place. The server still listens, so /healthz keeps answering 503 with the check's name, exactly as now.; A healthy boot writes no such line, and the existing "listening on" line is unchanged.; The HTTP answer never gains the error text or SQL. The message stays in the log only, as the comment in src/health.ts asks.; The detail comes from src/health.ts (e.g. a failedCheckDetail(db) returning {name, message} | null), and failedCheck keeps its signature.; Test (in src/health.test.ts): on a database with a column dropped, the detail names the check and the missing column. On a fresh database it is null. The test fails on main.; bun test passes..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs