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

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

Merged opened this

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

Merged

An inspection or final walkthrough date can now carry a time and a place, and both show wherever the date does. The new tests and the rest of the suite pass, except src/server.test.ts and src/terminal.test.ts, which I left out to save time; the forge's check runs them on this push.

Notes

shipped production is serving it deploy d2eada7

opened this

An inspection or final walkthrough date can now carry a time and a place, and both show wherever the date does. The new tests and the rest of the suite pass, except src/server.test.ts and src/terminal.test.ts, which I left out to save time; the forge's check runs them on this push. bun x tsc --noEmit only prints its help text here because the repo has no tsconfig.json, so there was no type check. There is no scripts/gate.ts or scripts/fast.ts, and scripts/lint-design.ts printed no problems (I only read its last lines).

What changed

  • Setting it: each Inspection or Walkthrough row on the deal page has Set time and place (time input, 200-character place). POST /deadlines/:id/appointment takes it and the response is checked for same origin. It asks permit for deal update through deadlineFor and is audited as date.appointment.
  • Bad input: a bad time or over-long place comes back as a 422 deal page with the field flagged and the agent's text kept. Clearing both removes them.
  • API: PATCH /api/deals/:id/deadlines/:deadline accepts time and place. Any other kind of date gets a 422 with field: "time". /openapi.json and contract/openapi.json describe the new fields.
  • Where it shows: the deal page, the client timeline, the broker file and the export (dates[].time and dates[].place). The .ics event for that date gets the time and LOCATION. The reminder and date-moved drafts add it after the date, for example ", 10:00 am at 12 Elm St". Everything is escaped.
  • Migration: two nullable columns on deadline, time and place. src/migrations.pin.json is extended with their two hashes.
  • Shared validation: closingTime and closingPlace in src/closing.ts now take a field name and noun, so the closing and the appointments use one set of rules. The new src/appointment.ts only says which kinds take them.
  • Docs and tests: README "Opening and shaping a deal" and docs/TECHNICAL.md are updated. src/appointment.test.ts covers setting, clearing, bad time, long place, closing and appraisal refusal, the .ics output, the draft wording and a <script> place.

Choices to check

  • .ics time: a timed event is floating local time, with no zone attached, as the closing already is. The day cannot shift for an agent in a western zone, but the calendar app reads the time in its own zone rather than the Profile's. I did not add a TZID or VTIMEZONE.
  • Draft wording: the draft uses the app's 12-hour style ("10:00 am at 12 Elm St") instead of the issue's "10:00".
  • Overdue drafts: the "overdue" draft does not repeat the time.
  • src/migrations.test.ts: I edited its filter. It skips some migrations and relies on re-running the last ones, so it broke when I appended two; I added the two new columns to the skipped list.

No contract cell changed. No MCP tool or terminal command sets these yet; the issue did not ask for one.

To try it, open a deal, press Set time and place on the inspection, and then open /deals/:id/timeline and the .ics download.

🤖 Generated with Claude Code

Closes #180

3 earlier comments · 2 events
commented

An inspection or final walkthrough date can now carry a time and a place, and both show wherever the date does. The new tests and the rest of the suite pass, except src/server.test.ts and src/terminal.test.ts, which I left out to save time; the forge's check runs them on this push. bun x tsc --noEmit only prints its help text here because the repo has no tsconfig.json, so there was no type check. There is no scripts/gate.ts or scripts/fast.ts, and scripts/lint-design.ts printed no problems (I only read its last lines).

What changed

  • Setting it: each Inspection or Walkthrough row on the deal page has Set time and place (time input, 200-character place). POST /deadlines/:id/appointment takes it and the response is checked for same origin. It asks permit for deal update through deadlineFor and is audited as date.appointment.
  • Bad input: a bad time or over-long place comes back as a 422 deal page with the field flagged and the agent's text kept. Clearing both removes them.
  • API: PATCH /api/deals/:id/deadlines/:deadline accepts time and place. Any other kind of date gets a 422 with field: "time". /openapi.json and contract/openapi.json describe the new fields.
  • Where it shows: the deal page, the client timeline, the broker file and the export (dates[].time and dates[].place). The .ics event for that date gets the time and LOCATION. The reminder and date-moved drafts add it after the date, for example ", 10:00 am at 12 Elm St". Everything is escaped.
  • Migration: two nullable columns on deadline, time and place. src/migrations.pin.json is extended with their two hashes.
  • Shared validation: closingTime and closingPlace in src/closing.ts now take a field name and noun, so the closing and the appointments use one set of rules. The new src/appointment.ts only says which kinds take them.
  • Docs and tests: README "Opening and shaping a deal" and docs/TECHNICAL.md are updated. src/appointment.test.ts covers setting, clearing, bad time, long place, closing and appraisal refusal, the .ics output, the draft wording and a <script> place.

Choices to check

  • .ics time: a timed event is floating local time, with no zone attached, as the closing already is. The day cannot shift for an agent in a western zone, but the calendar app reads the time in its own zone rather than the Profile's. I did not add a TZID or VTIMEZONE.
  • Draft wording: the draft uses the app's 12-hour style ("10:00 am at 12 Elm St") instead of the issue's "10:00".
  • Overdue drafts: the "overdue" draft does not repeat the time.
  • src/migrations.test.ts: I edited its filter. It skips some migrations and relies on re-running the last ones, so it broke when I appended two; I added the two new columns to the skipped list.

No contract cell changed. No MCP tool or terminal command sets these yet; the issue did not ask for one.

To try it, open a deal, press Set time and place on the inspection, and then open /deals/:id/timeline and the .ics download.

🤖 Generated with Claude Code

Changes requested — before the latest push

Works as the issue describes on the page, API, timeline, file, export and drafts, and the tests are good. Changes needed, all in one round:

  1. FIRST: both doors. The closing time and place can be set in the terminal and over MCP (update_closing), but the appointment time and place cannot. src/tty.ts has no way to set them, and neither does src/mcp.ts. What a person does on the page they must do in the terminal too. Add a terminal command and an MCP tool (or extend the date tools) that call setAppointment, with tests. The terminal and MCP also show the time and place on dates, and the README should say so.
  2. The .ics time: the issue says the time is in the agent's Profile time zone. Floating local time is not that. Either emit TZID (with VTIMEZONE) or UTC from the Profile zone, or get the person to accept floating time on the issue. Do not leave it as a silent choice.
  3. Draft wording: the issue says "at 10:00 at 12 Elm St". 12-hour is defensible, but state it on the issue or match it.
  4. PATCH: note and lead_days are applied before time and place are validated, so a 422 on time can leave the note already saved. Validate time and place first, or write the whole change together.
  5. Cleanliness: src/timeline.ts has the where field inserted between the role doc comment and role, so the comment is orphaned. Move it. appointmentWhere in src/appointment.ts is unused (dead code): remove it. New route POST /deadlines/:id/appointment needs its row in src/contract.test.ts (the diff has none). The ics test assertion on the walkthrough DTSTART is convoluted; simplify it.

5b. src/migrations.test.ts: editing the filter is fine, but say so in the pull.

commented

All five review points are done and pushed, with one thing to settle on the issue (the 12-hour draft wording). The full src/*.test.ts suite passes. I did not run bun x tsc --noEmit, because the repo has no tsconfig.json and the command only prints its help.

1. Terminal and MCP.

  • Terminal: O on an inspection or walkthrough asks for the time and the place. Blank clears. Any other kind of date gets "Only an inspection or a walkthrough has a time and place." A guest changes nothing. Dates in the terminal now show 10:00 am · place. The key help and the header comment are updated.
  • MCP: the new set_appointment tool calls setAppointment: a field left out stays, null clears. client_timeline now carries when_and_where on a date that has one. get_deal and this_week already return the date's time and place as part of the date.
  • Docs: the README and docs/TECHNICAL.md say so.
  • Tests: src/appointment.terminal.test.ts is new. The MCP cases are in src/appointment.test.ts, and I added set_appointment to the tool list in src/server.test.ts.

2. The .ics time. An inspection or walkthrough with a time is now emitted in UTC, taking the wall time in the deal's zone (the Profile zone). For example, 10:00 on Oct 12 is DTSTART:…T140000Z in New York and …T170000Z in Los Angeles. The test covers both, and a Honolulu 4:30 pm that lands on the next UTC day, which does not move the local day. The 9 a.m. alarm is still computed from the local time. If the zone is unknown, it falls back to floating time. I left the closing as floating time because changing it would alter behaviour that already has tests. The docs say the two differ. If you want the closing in UTC too, that is a separate change.

3. Draft wording. I kept the 12-hour form, "10:00 am at 12 Elm St". It matches every other time the app writes (clock12, which the closing already uses). I can't edit the issue from here, so a person needs to accept this on the issue or ask for "10:00".

4. PATCH. Time and place are now checked and written first. A bad time, an over-long place or a non-appointment kind returns a 422 before the note, lead_days or owes is touched. A new test sends a bad time together with a note and lead_days, and a place on a closing date together with a note. It checks that nothing else was saved.

5. Cleanup.

  • where field: its doc comment is moved off the role comment in src/timeline.ts.
  • Dead code: appointmentWhere is removed.
  • Contract test: src/contract.test.ts has a new test. It acts as every identity and checks that setAppointment answers as deal update says, and that the form and PATCH routes exist. The route handlers themselves go through the server tests.
  • .ics assertion: the walkthrough assertion is simplified.

5b. src/migrations.test.ts. I edited its filter. It skips some migrations and re-runs the last ones, so it broke when I appended two. I added the two new deadline columns to the skipped list. This was in the first push too, and I should have said so then.

🤖 Generated with Claude Code

commented

I merged main into the branch, resolved both conflicts, and pushed. The full src/*.test.ts suite passes (629 tests); I haven't seen the forge's check on this push.

  • src/terminal.ts: main added O to bring deals back from a file, and my terminal key for a date's time and place was also O. I moved mine to @ and kept both help lines. The README, docs/TECHNICAL.md and src/appointment.terminal.test.ts now say @.
  • src/contract.test.ts: both new tests are kept, main's import test and my appointment test.
  • Import (new): main's import re-creates deals from an export file but ignored a date's time and place, so an export-then-import round trip would have dropped them. src/import.ts now reads them for inspection and walkthrough dates with the same rules, and refuses the whole file on a bad one. A test in src/import.test.ts covers the round trip and the refusal.

🤖 Generated with Claude Code

Approved

Earlier asks are met: the terminal (@) and MCP (set_appointment) doors exist and are tested, and a guest changes nothing in the terminal. The .ics now carries the time in UTC from the Profile zone, with tests for New York, Los Angeles and Honolulu. PATCH validates time and place before it writes the note, lead or owes, and a test covers that. The contract test has a row for the new door, no contract.json cell is loosened, and the import and export round trip carries time and place. Output is escaped and tested with a <script> place. The migrations are appended and pinned. I could not read the diffs of routes.ts, terminal.ts, reminders.ts and timeline.ts in this sandbox, so I judged those from their tests. Non-blocking: the draft says "10:00 am" where the issue says "10:00". That matches the app's 12-hour style, and a person can accept it on the issue.

commented

Left #180 open: 1 unticked item remain (On the deal page, an Inspection or Walkthrough row has Set time and place: a time (HH:MM, 24-hour or the form's time input) and a place (one line, at most 200 characters). Either may be blank; clearing both removes them. Same-origin checked, permit asked for deal update like the closing form; a bad time or an over-long place is a 422 naming the field, with the form re-rendered and the agent's text kept.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs