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

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

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.

Notes

shipped production is serving it deploy d2eada7

opened this

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 closing_time and closing_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 in src/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, after restore, and after refresh three 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.ts passes (11 tests), and so do src/appointment and src/server.test.ts (59 tests).
  • Not run: bun x tsc --noEmit and bun scripts/gate.ts. The repo has no tsconfig.json and no scripts/gate.ts, so there was nothing for either to run. I also didn't run scripts/lint-design.ts, since nothing under src/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

Closes #190

3 earlier comments · 1 event
commented

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 closing_time and closing_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 in src/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, after restore, and after refresh three 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.ts passes (11 tests), and so do src/appointment and src/server.test.ts (59 tests).
  • Not run: bun x tsc --noEmit and bun scripts/gate.ts. The repo has no tsconfig.json and no scripts/gate.ts, so there was nothing for either to run. I also didn't run scripts/lint-design.ts, since nothing under src/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

commented

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.ts answers /healthz with 200 and / with 200. Locally, src/upgrade.test.ts and src/health.test.ts pass (63 tests), and so do the earlier src/sample.test.ts, src/appointment and src/server.test.ts runs.
  • 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 /healthz to 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.
commented

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: migrate now ends with restoreColumns. For every migration of the form ALTER TABLE t ADD COLUMN c, it adds column c to t if 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 drops deadline.time and deadline.place from a database that still records every migration. failedCheck reports dates. 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

Changes requested — before the latest push

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.

commented

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.ts and src/health.test.ts are back to how they were on main, so restoreColumns and 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.ts asserting that sample's inspection time is 10:30. The README can't drift from it unnoticed.
  • Tests: src/sample.test.ts and src/health.test.ts pass (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

Approved

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.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs