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

A buyer touring several homes can have more than one showing booked: each is listed on their page and the desk, and each gets its own day-before confirmation and morning-after follow-up #107

Merged opened this

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

Merged

A lead can now hold several showings, each with its own day-before confirmation and morning-after follow-up. The suite passes except one test that also fails on the base branch: "a write from another process on the same file reaches the bus".

Notes

shipped production is serving it deploy aba151a

opened this

A lead can now hold several showings, each with its own day-before confirmation and morning-after follow-up. The suite passes except one test that also fails on the base branch: "a write from another process on the same file reaches the bus". I couldn't run bun x tsc --noEmit: the repo has no tsconfig or TypeScript dependency, so tsc only prints its help. scripts/gate.ts and scripts/fast.ts don't exist here. bun run lint:design is clean.

What changed

  • Data: a new migration rebuilds showing with its own id, one row per (lead, time), and adds message.showing_id. A lead's existing showing and its unsent drafts carry over.
  • Booking and cancelling: booking adds a showing instead of replacing the old one. The same time twice is refused with "This lead already has a showing at that time: pick another, or cancel that one first." A lead holds at most 20 showings.
  • Drafts: each showing owns its confirmation and its morning-after note, so cancelling one deletes only its unsent drafts. A confirmation is set aside once its own showing has begun.
  • Follow-ups: they wait until the day after the last showing, and cancelling the last releases them.
  • Pages: the lead page lists showings in time order, each with its own Cancel, plus a form to book another. The desk's upcoming list already had one row per showing. A desk row's badge shows the next showing and "(+N more)". The printable brief lists every showing.
  • Report and price changes: the week report already counts showing rows, so it counts every one. Price-change matching now looks at the addresses of all of a lead's showings.
  • Terminal: the lead screen lists every showing. b books another one, and u cancels the next one.
  • MCP: cancel_showing takes an optional showing_id.
  • API:

- Leads now carry a showings array in place of showing. - POST /leads/:id/showings books a showing. - DELETE /leads/:id/showings/:sid and the form POST …/showings/:sid/cancel cancel one. - The /showing routes are gone, not aliased. - contract/openapi.json is regenerated.

  • Cancelling without an id: the action accepts no id when the lead has exactly one showing. With several it asks which one.
  • Policy: no change to contract.json, permit or same-origin checks.

Tests: the new src/many-showings.test.ts covers:

  • two showings each producing their own reminders in the agent's zone;
  • cancelling one leaving the other and its drafts;
  • follow-ups waiting for the last showing and returning when it is cancelled;
  • the same-time refusal;
  • the page, desk, brief and report counting both showings;
  • the migration keeping an existing showing.

I rewrote the old "moving" tests in showings.test.ts, before-showing.test.ts and after-showing.test.ts, because booking again no longer moves a showing.

Not done:

  • There is no "move a showing"; to change a time, cancel and book again.
  • The desk list still shows at most 5 showings, then "and N more".
  • A cancelled showing still drops out of the week report's count, as before.

To try: book two showings on one lead from its page, cancel one, and check the other keeps its drafts on the plan.

🤖 Generated with Claude Code

Closes #106

commented

A lead can now hold several showings, each with its own day-before confirmation and morning-after follow-up. The suite passes except one test that also fails on the base branch: "a write from another process on the same file reaches the bus". I couldn't run bun x tsc --noEmit: the repo has no tsconfig or TypeScript dependency, so tsc only prints its help. scripts/gate.ts and scripts/fast.ts don't exist here. bun run lint:design is clean.

What changed

  • Data: a new migration rebuilds showing with its own id, one row per (lead, time), and adds message.showing_id. A lead's existing showing and its unsent drafts carry over.
  • Booking and cancelling: booking adds a showing instead of replacing the old one. The same time twice is refused with "This lead already has a showing at that time: pick another, or cancel that one first." A lead holds at most 20 showings.
  • Drafts: each showing owns its confirmation and its morning-after note, so cancelling one deletes only its unsent drafts. A confirmation is set aside once its own showing has begun.
  • Follow-ups: they wait until the day after the last showing, and cancelling the last releases them.
  • Pages: the lead page lists showings in time order, each with its own Cancel, plus a form to book another. The desk's upcoming list already had one row per showing. A desk row's badge shows the next showing and "(+N more)". The printable brief lists every showing.
  • Report and price changes: the week report already counts showing rows, so it counts every one. Price-change matching now looks at the addresses of all of a lead's showings.
  • Terminal: the lead screen lists every showing. b books another one, and u cancels the next one.
  • MCP: cancel_showing takes an optional showing_id.
  • API:

- Leads now carry a showings array in place of showing. - POST /leads/:id/showings books a showing. - DELETE /leads/:id/showings/:sid and the form POST …/showings/:sid/cancel cancel one. - The /showing routes are gone, not aliased. - contract/openapi.json is regenerated.

  • Cancelling without an id: the action accepts no id when the lead has exactly one showing. With several it asks which one.
  • Policy: no change to contract.json, permit or same-origin checks.

Tests: the new src/many-showings.test.ts covers:

  • two showings each producing their own reminders in the agent's zone;
  • cancelling one leaving the other and its drafts;
  • follow-ups waiting for the last showing and returning when it is cancelled;
  • the same-time refusal;
  • the page, desk, brief and report counting both showings;
  • the migration keeping an existing showing.

I rewrote the old "moving" tests in showings.test.ts, before-showing.test.ts and after-showing.test.ts, because booking again no longer moves a showing.

Not done:

  • There is no "move a showing"; to change a time, cancel and book again.
  • The desk list still shows at most 5 showings, then "and N more".
  • A cancelled showing still drops out of the week report's count, as before.

To try: book two showings on one lead from its page, cancel one, and check the other keeps its drafts on the plan.

🤖 Generated with Claude Code

Approved

Reads clean on the lines I could see: cancel looks the showing up through the lead's own list before deleting, so a showing id from another lead cannot be hit. Booking validates time, address length, a duplicate time and the 20-showing cap, and permit and same-origin are untouched. The migration keeps the existing showing and its unsent drafts, and the new test covers it. contract.json is unchanged. The diff I was given was cut off before routes.ts and terminal.ts, so I did not read those two files, and I took the terminal and route changes from the builder's description. Two small things to tidy later: src/contract.test.ts:176 still names the old POST|DELETE /leads/:id/showing routes, and showing ids are plain rowids, so after the newest showing is deleted a new one can reuse its id and pick up the old sent messages' showing_id (harmless today, since only unsent rows are read by it).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs