Public: anyone can read this; the crew can change it.
The sample deals carry inspection and walkthrough times and places, so the sales-meeting tour shows where the buyer has to be #194
Check · Review · Land · Live done — Landed and live in production.
The sample deals now carry inspection and walkthrough times and places, so the sales-meeting tour shows where the buyer has to be. What changed (src/sample.ts): writeSamples sets a time and a place on every sample inspection or walkthrough that is still open, in the same step that writes closingtime and closingplace.
shipped production is serving it deploy d2eada7
3 earlier comments · 1 event
The sample deals now carry inspection and walkthrough times and places, so the sales-meeting tour shows where the buyer has to be.
- What changed (
src/sample.ts):writeSamplessets a time and a place on every sample inspection or walkthrough that is still open, in the same step that writesclosing_timeandclosing_place. The place is the property address. The time is a quarter hour from 08:00 to 16:45, worked out from the address and kind so it is the same on every seeding. That sits inside the 07:00–20:00 quarter-hour rule insrc/appointment.ts. - Which samples: Done or waived dates keep none, so Alder Lane's finished inspection has no time. The four open deals each get a walkthrough time and place, and Harbor View and Juniper Court also get an inspection time and place.
- Restore and re-dating: Restore of the samples goes through
writeSamples, so it keeps them. Re-dating only moves due dates and never touches the time or place columns. The seeding only touches deals authored by the sample identity, so a real agent's deals are unaffected. - Renderers: The deal page, client timeline and .ics are untouched. They already read these columns.
- README: Step 3 of the tour has one sentence saying the Harbor View inspection carries a time and place, shown on its page.
- Test (
src/sample.test.ts): One new test checks the following after seeding, afterrestore, and afterrefreshthree days on:
- each open sample inspection or walkthrough has an HH:MM on a quarter hour and a place equal to its address;
- no other sample date has a time or a place.
- What I ran:
src/sample.test.tspasses (11 tests), and so dosrc/appointmentandsrc/server.test.ts(59 tests). - Not run:
bun x tsc --noEmitandbun scripts/gate.ts. The repo has notsconfig.jsonand noscripts/gate.ts, so there was nothing for either to run. I also didn't runscripts/lint-design.ts, since nothing undersrc/web/changed. - Not done: I did not give a time to the done inspection on Alder Lane. The issue allows done dates to have none.
To try it, open the preview, sign in, and open 77 Harbor View Dr, Unit 4B. Its inspection shows a time and the address. Then tap Restore the samples and check they are still there.
🤖 Generated with Claude Code
I couldn't find a fault in the code, so I pushed an empty commit to trigger a fresh preview deploy. I haven't seen whether it came up.
- Reproduction: A fresh boot of
bun run src/server.tsanswers/healthzwith 200 and/with 200. Locally,src/upgrade.test.tsandsrc/health.test.tspass (63 tests), and so do the earliersrc/sample.test.ts,src/appointmentandsrc/server.test.tsruns. - My diff: It touches only
src/sample.ts, its test and the README. It adds no migration, so nothing in it can leave a column missing for/healthzto find. - The preview now: The #194 preview answers 502, which means it is not running. The #193 preview is healthy.
- What I can't see: The deploy log you sent stops mid-test, at migration 34 of 59. I can't read the preview's own boot log or its data directory from here. If the retry also fails, that log is what's needed. One guess is that the preview starts from an existing database with a schema problem. I haven't confirmed that.
The sample-times change is unchanged. This push adds a repair to src/db.ts for a likely cause of the preview's 503. I can't confirm that cause, because the 503 happens only on the forge's preview and I can't read its database or logs.
What I found: /healthz returns 503 only when failedCheck in src/health.ts finds a column the first paint reads missing. Boot and tests pass here on a fresh database. Production also answers 502 right now. The preview most likely starts from an existing database whose schema_version says it is current while a column is missing. migrate trusts that version number, so it never re-adds the column. The earlier Profile-column failure (#148) came from the same kind of mismatch. I'm assuming it is the time and place columns the health check reads, since those migrations came in most recently. That is an inference, not something I saw.
What changed:
src/db.ts:migratenow ends withrestoreColumns. For every migration of the formALTER TABLE t ADD COLUMN c, it adds columnctotif it is absent. A whole database changes nothing, and no migration was added or reordered, so the pin and upgrade tests are untouched.src/health.test.ts: A new test dropsdeadline.timeanddeadline.placefrom a database that still records every migration.failedCheckreportsdates. After reopening, it reports nothing.
Tests run: src/health.test.ts, src/upgrade.test.ts and src/sample.test.ts pass (75 tests). src/db, src/server.test.ts and src/profile pass (63 tests).
If the preview still fails: The log would need to show which check /healthz names. If the cause turns out to be something other than a missing added column, this repair won't help.
Not done: The check would not catch a column that went missing some way other than an ADD COLUMN migration, such as a rebuilt table.
🤖 Generated with Claude Code
The sample change itself (src/sample.ts, its test) is right and the preview is up. Two things to fix: (1) Remove the restoreColumns repair in src/db.ts and its test in src/health.test.ts. The issue did not ask for it, the cause of the earlier 503 was never confirmed, and it re-runs migrations on every open, which is a change to the upgrade path outside this issue. If a real upgrade bug exists, open a separate issue. (2) README step 3: the new sentence is spliced mid-paragraph and makes the line run long. Put it in its own sentence at a natural break, and say what the reader will see (for example the inspection time and the address) instead of just that it carries one. Ticks: boxes 1, 2, 3, 5 are met, but I am requesting changes so they are not final until the pull is clean.
Both points from the review are done. The pull is now only the sample times, their test and a README sentence.
- Repair removed:
src/db.tsandsrc/health.test.tsare back to how they were on main, sorestoreColumnsand its test are gone. I did not confirm the earlier 503, and I have not opened a separate issue for a possible upgrade bug. If the 503 comes back, someone should open one with the preview's boot log. - README step 3: The sentence now has its own place after the deal-page sentence and says what the reader sees. It reads: The inspection there reads "10:30 am · 77 Harbor View Dr, Unit 4B", the time and place the buyer has to be at.
- Pinned in the test: The 10:30 comes from the seeding formula, so I added a line to
src/sample.test.tsasserting that sample's inspection time is10:30. The README can't drift from it unnoticed. - Tests:
src/sample.test.tsandsrc/health.test.tspass (14 tests). - Try it: Open the preview, sign in, and open 77 Harbor View Dr, Unit 4B. Its inspection shows 10:30 am and the address. Restore the samples keeps both.
🤖 Generated with Claude Code
Both earlier asks are met: the db.ts/health repair is gone and the README sentence stands on its own, with the 10:30 pinned by a test. The diff is small: sample times are written in writeSamples for open inspections and walkthroughs only, derived deterministically, no renderer or contract change. The test covers seed, restore and refresh. The preview answers /healthz 200.
The sample deals now carry inspection and walkthrough times and places, so the sales-meeting tour shows where the buyer has to be.
src/sample.ts):writeSamplessets a time and a place on every sample inspection or walkthrough that is still open, in the same step that writesclosing_timeandclosing_place. The place is the property address. The time is a quarter hour from 08:00 to 16:45, worked out from the address and kind so it is the same on every seeding. That sits inside the 07:00–20:00 quarter-hour rule insrc/appointment.ts.writeSamples, so it keeps them. Re-dating only moves due dates and never touches the time or place columns. The seeding only touches deals authored by the sample identity, so a real agent's deals are unaffected.src/sample.test.ts): One new test checks the following after seeding, afterrestore, and afterrefreshthree days on:- each open sample inspection or walkthrough has an
HH:MMon a quarter hour and a place equal to its address; - no other sample date has a time or a place.src/sample.test.tspasses (11 tests), and so dosrc/appointmentandsrc/server.test.ts(59 tests).bun x tsc --noEmitandbun scripts/gate.ts. The repo has notsconfig.jsonand noscripts/gate.ts, so there was nothing for either to run. I also didn't runscripts/lint-design.ts, since nothing undersrc/web/changed.To try it, open the preview, sign in, and open 77 Harbor View Dr, Unit 4B. Its inspection shows a time and the address. Then tap Restore the samples and check they are still there.
🤖 Generated with Claude Code
Closes #190