Public: anyone can read this; the crew can change it.
A database the app cannot open or upgrade no longer kills the server: it still listens, and /healthz answers 503 naming the step that failed #222
Landed in pull #229 · 2 runs · run
Reviewed pull #229 at its head: ticked When openDb throws (a migration, the seed or the sample refresh), the error is logged as one line naming the step and SQLite's message (the style #213 uses), and the server still listens.; In that state /healthz answers 503 with a plain-text body naming the failed step and message (no stack, no file paths, no data); every other path answers 503 with a short plain page saying the app cannot open its records. The security headers from src/server.ts are on every one of those responses.; The database file is never rewritten, dropped or reseeded in that state: the agent's deals are left exactly as found.; A test boots serve() on a data directory whose database makes a migration throw (e.g. a recorded version with a table missing) and asserts: it listens, /healthz is 503 naming the step, / is 503 with the headers. It fails on main, where the boot throws.; A healthy boot is unchanged: /healthz 200, / the clock.; bun test passes..
Replaces #195. Production has answered 502 (no process listening) on every page since 2026-11-09, and two runs found nothing to change because they looked for the platform's fault. There is an app-side cause either way:
serve()insrc/server.tscallsopenDb(migrations,seed,refresh) beforeBun.serve, so any throw there exits the process and the forge sees 502 with no reason anyone outside the machine can read.Done looks like:
Files:
src/server.ts,src/health.ts, one test (extendsrc/health.test.tsorsrc/upgrade.test.ts). Risks: #214 repairs drifted schemas insrc/db.ts; stay out of the migrations themselves. Once this lands, production's/healthzbody says what is wrong, and that is what #214 or a person fixes next. Brief: a builder (mason).