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 #207
Parked 27d 0h ago
A boot on a database the first paint can't read now logs which health check fails and the database's own error. Tests in src/health.test.ts pass (4 of 4). I did not run the full suite.
-
Reviews
No review yet.
-
Checks
stopped parked by the crew deploy 2169276
-
History
- Repair every one-line column a database could have skipped, not only the closing's, so a mid-list insertion never fails the first paint again (#205) 2169276
- Repair databases that skipped the closing time and place columns, which the boot log now shows failing the deals check (#205) 43adc28
- A boot on a database the first paint can't read now logs which health check fails and the database's own error. Tests in `src/health.test.ts` pass (4 of 4). I did not run the full suite. There is no ` 0b167d7
- The clock's marker for a listing agreement that expires before closing says so in its own words, not "falls on or after closing" (#204) 3bd16dd
- An inspection or walkthrough less than two hours from another of the agent's appointments or closings on the same day is flagged, so the agent never double-books the day (#199) 46c08b5
- The sample deals carry inspection and walkthrough times and places, so the sales-meeting tour shows where the buyer has to be (#194) 6140d93
- This week shows each inspection and walkthrough's time and place, and orders a day's dates by time, so the agent sees where to be hour by hour (#193) a0b9465
- A listing deal carries the date the listing agreement expires, and the clock and the deal page flag a closing that would fall after it (#188) 06ec35c
- /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 (#186) 8d3ee4f
- Two closings set less than two hours apart on the same day are flagged on This week and on both deals' pages, so the agent never books themselves into two title offices at once (#187) 5f71285
- An inspection or final walkthrough carries a time and a place, shown on the deal page, the client timeline, the calendar file and its reminder draft, so the buyer knows where to be and when (#185) 802dfbb
- The agent brings their deals back from a downloaded deal-clock file on the Profile page, so the download is a real way to move or recover their book (#181) ebad1ba
- A year after a deal closes, the agent gets a drafted "Happy home anniversary" note to their clients, approved like any reminder, so past clients hear from them when referrals come from (#177) aa80ca6
- A deal's page lists the reminders still to come, by day, party and date, so in the meeting the agent shows what the app will draft next and that nothing goes out unapproved (#176) 1f1c97f
- A deal opened as a cash offer has no appraisal or financing dates and asks for no lender, and says "Cash" on the clock and its page (#175) 17ae8be
- "Today" is the agent's day in their own time zone, set on the Profile, so at 6 pm Eastern the clock does not already show tomorrow (#171) 40db2b2
- The agent downloads all their deals as one file (dates, parties, notes, moves and every approved message) from the Profile page, so leaving the app never means losing a deal (#172) 27899a4
- The People page says when each person last got a message from the agent and about what, so "did I tell the lender?" is answered in one look (#129) 76e3313
- The README reads like a five-minute tour a realtor can follow, and the terminal, MCP and API details live in docs/TECHNICAL.md (#168) 82bf5b8
- The API adds a date to a deal, like the page and MCP do, and /openapi.json lists the common labels (HOA documents review, survey, repair request deadline…) on its body (#167) 1b8c4f9
2 earlier comments
This pull now logs which health check fails at boot, and it also repairs the database that was failing it.
What the new log line showed. The preview's database was missing deal.closing_time, so the deals check failed. This is the cause of the 503s on #198 and production (#195). Migrations apply by position. The closing time and place columns were inserted mid-list, so a database already past that position never got them. The same thing happened earlier with profile.line.
Fix. I appended two repair migrations to src/db.ts that re-add closing_time and closing_place. migrate already tolerates "duplicate column name", so healthy databases are unaffected. src/migrations.pin.json gains two hashes and no existing pin changed.
Tests.
src/migrations.test.tshas a new test: a database with those columns dropped and its version rewound fails thedealscheck, then passes aftermigrate.- The "before the Profile line" test in
src/migrations.test.tsand the profile test insrc/health.test.tsnow skip the two repair migrations when they build an old database. - Local runs:
src/health,src/migrations,src/db,src/upgrade,src/hold,src/dealsandsrc/servertests, all passing. - There is no
scripts/gate.tsortsconfig.jsonin this clone, so I ran neither the gate nor the type check.
Unchanged from the first push.
failedCheckDetailinsrc/health.ts, withfailedCheckkeeping its signature.- The single boot line on stderr, from a read-only connection.
/healthzstill answers with only the check's name.- No contract cell changes.
To try it. Once this deploys, the preview's /healthz should answer 200. Production recovers the same way once this is merged.
🤖 Generated with Claude Code
The boot log now names the failing health check, and this pull also repairs the databases that were failing it. I ran no deploy and no type check here. The 503 came from migrations inserted mid-list. Databases whose version counter had already passed that position never got those columns. The preview then failed first on deal.closing_time, and next on deadline.lead_days.
What the pull does
- Boot log:
failedCheckDetail(db)insrc/health.tsreturns{name, message} | null, andfailedCheckkeeps its signature. At boot,src/server.tsruns the checks once on a read-only connection. On a failure it writesdeal-clock: health check "<name>" fails at boot: <db message>to stderr. The server still listens, and a healthy boot adds no line. /healthz: it still answers 503 with the check's name only. The error text and SQL never reach the HTTP answer.- Repair migrations in
src/db.ts: the first fix covered onlyclosing_timeandclosing_place. That leftlead_daysfailing, so I appended a repair for every one-lineADD COLUMN(29 in all).migratealready tolerates "duplicate column name", so healthy databases are unaffected.src/migrations.pin.jsononly gains hashes. - Tests:
src/health.test.tscovers the detail on a droppeddeadline.place(namesdatesandno such column: place) and null on a fresh database.src/migrations.test.tschecks that a database missingclosing_*and one missinglead_daysfail the check, then pass aftermigrate.- The two tests that build an old schema skip the repairs (
slice(0, -29)). A later append tomigrationswould break that count, so those slices need adjusting when it changes. - I ran the health, migrations, db, upgrade, hold, deals and server test files; all pass.
Not done
- The two multi-statement
remindermigrations (party_role,sample) have no repair. Repeating one statement of a script would stop at the first duplicate. - Mid-list
CREATE TABLEandCREATE INDEXstatements have no repair either. I can't see the preview or production database, so if the preview still fails on a missing table, the boot line will name it. - No contract cell changes.
To try it
Boot against a database missing a column the first paint reads and check stderr. After merge, production's /healthz should answer 200.
🤖 Generated with Claude Code
A boot on a database the first paint can't read now logs which health check fails and the database's own error. Tests in
src/health.test.tspass (4 of 4). I did not run the full suite. There is noscripts/gate.tsortsconfig.jsonin this clone, so I skipped the gate script and the type check.bun x tscfetched an unrelated package instead.What changed
src/health.tshas a newfailedCheckDetail(db)that returns{name, message} | null.failedCheckkeeps its signature and now just returns the name from it, so/healthzstill answers 503 with the check's name and nothing more.src/server.ts: after the "listening on" line, theimport.meta.mainblock runs the checks once. If one fails it writes a single line to stderr,deal-clock: health check "<name>" fails at boot: <db message>. The server still listens.src/health.test.tshas a new test. A fresh database givesnull. A database withdeadline.placedropped gives namedatesand a message matchingno such column: place. It fails on main becausefailedCheckDetaildoesn't exist there.Choices
app.db, so it never writes.serve()doesn't expose its database handle, and I left its signature alone.health check could not run at boot: <message>. You didn't ask for this line.To try it
FORGE_APP_DATApointing at a database that lacks a column the first paint reads, and look at stderr./healthzstill returns 503 with only the check's name.I did not run the failing-boot case end to end; the test covers it at the
failedCheckDetaillevel.🤖 Generated with Claude Code
Closes #205