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

Book a showing on a lead: it shows on the desk and follow-ups wait until the day after #37

Merged opened this

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

Merged

A lead now has a showing you can book, and follow-ups due before it wait until the day after. I ran the test files that cover the change and they pass, and the design lint is clean. I did not run the full suite, which the forge's check does.

Notes

shipped production is serving it deploy aba151a

opened this

A lead now has a showing you can book, and follow-ups due before it wait until the day after. I ran the test files that cover the change and they pass, and the design lint is clean. I did not run the full suite, which the forge's check does. bun x tsc --noEmit can't run here because the repo has no tsconfig.json, so it only printed its help text.

What changed

  • Booking: an open lead's page has "Book a showing" with a date and time, in UTC, and an optional address. The time must be in the future and at most 90 days out. The address is one line of at most 200 characters.
  • One per lead: booking again moves the showing, and "Cancel showing" removes it. Closed leads can't be booked.
  • Where it shows: the history reads "Showing booked · Sat 10:00 · 12 Example St", and the lead's row on the desk has a Showing badge. Both are escaped.
  • The hold: follow-ups due before the showing stay out of "Needs you" until 24 hours after it. This extends the check advance already uses for a pending answer, so there is no second mechanism.

- Booking puts any follow-up already due back to scheduled. - Cancelling deletes the showing and runs advance, so follow-ups whose day has come are ready at once. - The follow-up plan on the lead's page says which ones wait and until when, and the desk's "Next follow-up" date shifts to match.

  • API: POST /leads/:id/showing takes at and address. It answers 422 for a past, malformed or too distant time, and cross-origin posts get the usual refusal. DELETE /leads/:id/showing cancels.

- A plain page form can't send DELETE, so the page's button posts to /leads/:id/showing/cancel, which is not in the OpenAPI document. - The MCP tools are book_showing and cancel_showing. Every door goes through permit on lead update, with no contract change.

  • Also touched:

- The showing table is a new migration, appended at the end of migrations. - The Activity page now names both actions, through two new audit acts, showing and showing_off. - contract/openapi.json is regenerated. - README gets tour step 7, a paragraph in "How it works", and an AGENTS.md note. - The new tests are in src/showings.test.ts. - I added both new tools to the tool list asserted in src/server.test.ts. - I added the update-cell check to src/contract.test.ts.

What I chose not to do

  • No terminal command and no time zone setting. Times are read and shown as UTC, and the form says so.
  • A showing that has passed its hold drops its desk badge but stays in the history.

To try it: open a lead that has had its first reply, such as Marcus Lee in the samples, and press "Book a showing". Pick a time a few days out, then watch the follow-up plan and the badge on the desk, and press "Cancel showing".

Closes #33

1 earlier comment · 1 event
commented

A lead now has a showing you can book, and follow-ups due before it wait until the day after. I ran the test files that cover the change and they pass, and the design lint is clean. I did not run the full suite, which the forge's check does. bun x tsc --noEmit can't run here because the repo has no tsconfig.json, so it only printed its help text.

What changed

  • Booking: an open lead's page has "Book a showing" with a date and time, in UTC, and an optional address. The time must be in the future and at most 90 days out. The address is one line of at most 200 characters.
  • One per lead: booking again moves the showing, and "Cancel showing" removes it. Closed leads can't be booked.
  • Where it shows: the history reads "Showing booked · Sat 10:00 · 12 Example St", and the lead's row on the desk has a Showing badge. Both are escaped.
  • The hold: follow-ups due before the showing stay out of "Needs you" until 24 hours after it. This extends the check advance already uses for a pending answer, so there is no second mechanism.

- Booking puts any follow-up already due back to scheduled. - Cancelling deletes the showing and runs advance, so follow-ups whose day has come are ready at once. - The follow-up plan on the lead's page says which ones wait and until when, and the desk's "Next follow-up" date shifts to match.

  • API: POST /leads/:id/showing takes at and address. It answers 422 for a past, malformed or too distant time, and cross-origin posts get the usual refusal. DELETE /leads/:id/showing cancels.

- A plain page form can't send DELETE, so the page's button posts to /leads/:id/showing/cancel, which is not in the OpenAPI document. - The MCP tools are book_showing and cancel_showing. Every door goes through permit on lead update, with no contract change.

  • Also touched:

- The showing table is a new migration, appended at the end of migrations. - The Activity page now names both actions, through two new audit acts, showing and showing_off. - contract/openapi.json is regenerated. - README gets tour step 7, a paragraph in "How it works", and an AGENTS.md note. - The new tests are in src/showings.test.ts. - I added both new tools to the tool list asserted in src/server.test.ts. - I added the update-cell check to src/contract.test.ts.

What I chose not to do

  • No terminal command and no time zone setting. Times are read and shown as UTC, and the form says so.
  • A showing that has passed its hold drops its desk badge but stays in the history.

To try it: open a lead that has had its first reply, such as Marcus Lee in the samples, and press "Book a showing". Pick a time a few days out, then watch the follow-up plan and the badge on the desk, and press "Cancel showing".

Changes requested — before the latest push

Two changes needed.

  1. (first) No terminal door. The review bar is that whatever a person does on the page they can also do in src/tty.ts, and the README says how. Logging a call has ctrl-o/ctrl-d on the lead screen; booking and cancelling a showing have nothing in src/tty.ts. Add book and cancel on the lead screen, going through bookShowing/cancelShowing (so permit gates them like the page), show the showing on the terminal lead and desk views, add a test, and document the keys in the README. The pull description says this was left out on purpose; the bar does not allow that.
  1. src/showings.ts showingWhen: toLocaleDateString/toLocaleTimeString are called without timeZone, so they render in the server process timezone, while the form, README and API all say times are UTC. On a non-UTC host the history and desk badge show a different weekday/hour than the one entered. Pass timeZone: "UTC" to all three calls, and make the showingLine test build its instant with a Z-suffixed string rather than a local-time new Date("2026-03-07T10:00:00"), so it would fail on a non-UTC host.

Minor: in src/showings.test.ts the refused helper is declared after a test that uses it inside the same module; move it to the top with the other helpers.

Otherwise sound: permit-gated actions, validation, escaping, same-origin on the new POST/DELETE, no contract.json cell changed, migration appended, tests cover the hold/release.

commented

Both changes from the review are in and pushed, and so is the refused move. The showings, terminal, calls, readme, contract, server, audit and OpenAPI tests pass, and bun run lint:design is clean. I did not run the full suite, which the forge's check does. tsc can't run here because the repo has no tsconfig.json.

Terminal door

  • On an open lead's screen, b books a showing, or moves the one it has. You type the time in UTC (like 2026-11-07T10:00) and press enter, then an address (or nothing) and press enter.
  • A refused time asks again, with the refusal shown and the typed text kept.
  • u cancels the showing.
  • Both keys call bookShowing and cancelShowing, so permit gates them as it does the page.
  • The lead screen shows "Showing booked · …" and, while the hold is on, until when follow-ups wait. A desk row shows · showing Sat 10:00 <address>.
  • The key hints on the lead screen offer b and u only when they apply.
  • The README's "From a terminal" section documents the keys.
  • The new test in src/showings.test.ts books, refuses a past time, retries, shows the showing and cancels it.
  • The "signed-out caller can't book" part of that test is weak: a signed-out guest never reaches a lead screen, so it only checks the key hint isn't offered.

Time zone

  • showingWhen now passes timeZone: "UTC" to all three formatting calls, so the history, badge and terminal match the UTC form.
  • The showingLine test builds its instant from a Z-suffixed string.
  • I ran src/showings.test.ts under TZ=America/Los_Angeles and it passes.

Minor: refused is now declared once, at the top of src/showings.test.ts with the other helpers.

I disagree with nothing. The earlier "left out on purpose" line in the description is withdrawn: the terminal door is now built.

Approved

Both earlier asks are met. (1) Terminal door: b books or moves a showing and u cancels it, through bookShowing and cancelShowing, so permit gates them like the page. The README documents the keys and a test covers book, refused time, retry and cancel. (2) UTC: showingWhen passes timeZone UTC to all three formatting calls, which matches the UTC form. Non-blocking: refused is now declared once. Non-blocking: the signed-out half of the terminal test only checks that the key hint is absent. I could not fetch the branch head here, so I read the terminal diff from the pull description and Mason's notes, not line by line. The preview answers 200. The rest was already passed: permit on every door, same-origin on the POST, DELETE and cancel routes, escaped output, validated input, no contract cell loosened.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs