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

An inspection or walkthrough less than two hours from another of the agent's appointments or closings on the same day is flagged, so the agent never double-books the day #196

Parked opened this
Closed without merging

An inspection or walkthrough less than two hours from another of the agent's timed appointments or closings on the same day is now flagged. The line appears on /week beside both rows and on both deals' pages beside the date. I ran the full suite under src once (650 pass, 1 fail).

Notes

stopped parked by the crew deploy 4a4af02

opened this

An inspection or walkthrough less than two hours from another of the agent's timed appointments or closings on the same day is now flagged. The line appears on /week beside both rows and on both deals' pages beside the date. I ran the full suite under src once (650 pass, 1 fail). The failure was the contract/openapi.json check, which I fixed by running bun run contract:emit and committing the file. I then re-ran openapi.test.ts and the new tests, not the full suite. The speed suite was green, and scripts/lint-design.ts printed nothing I could act on. I did not run a type check: the repo has no tsconfig, so tsc only prints its help.

What changed

  • src/overlap.ts: new appointmentClashes(deals) compares open, timed Inspection and Walkthrough dates and timed closings across one agent's open deals, same day, less than APART (120) minutes apart. Done, waived, untimed, other-day, closed, fell-through and other-agent dates are never compared.
  • src/deals.ts: listDeals and the single-deal read fill a new clashes list on each deadline view ({dealId, address, label, time}). The single-deal read only loads the agent's other deals when the deal has a timed date, as before.
  • Pages: src/pages/week.ts, src/pages/clock.ts (the dashboard week card), src/pages/appointment.ts and src/pages/deal.ts render "Also at 10:00 am: Inspection, 12 Elm St" in the existing closing-clash amber style, with the address linked and escaped. There is no new layout or class.
  • API and docs: src/routes.ts documents the clashes field, and contract/openapi.json is re-emitted. docs/TECHNICAL.md and the README have a line on it.
  • Tests: the new src/clash.test.ts covers:

- 10:00 vs 11:30 flagged, 10:00 vs 12:00 not; - an inspection vs a closing, flagged both ways; - a done, waived, untimed, other-day, closed, fell-through or other-agent date not flagged; - an address containing <script> escaped on the week sheet, the dashboard week card and the deal page.

The existing closing-clash tests are untouched and pass.

Choices

  • Two closings still use closingConflicts, so a closing-vs-closing clash is not shown twice. appointmentClashes only reports pairs with at least one inspection or walkthrough.
  • The line names the kind (Inspection, Walkthrough, Closing) rather than the date's label, so it reads "Inspection, 12 Elm St" and not "Inspection period ends, 12 Elm St".
  • The time is written "10:00 am" to match the existing closing line, not "10:00 AM" as in the issue.
  • With several clashes, one line joins them as "Also at …; also at …".

Not done

  • The terminal's deal view does not show the new clashes; the issue named only /week and the deal pages.
  • No permission cells changed.

To try it: in a preview, set the same due day on two of your inspections, give them times 90 minutes apart, and look at /week and either deal page.

🤖 Generated with Claude Code

Closes #192

3 earlier comments
commented

An inspection or walkthrough less than two hours from another of the agent's timed appointments or closings on the same day is now flagged. The line appears on /week beside both rows and on both deals' pages beside the date. I ran the full suite under src once (650 pass, 1 fail). The failure was the contract/openapi.json check, which I fixed by running bun run contract:emit and committing the file. I then re-ran openapi.test.ts and the new tests, not the full suite. The speed suite was green, and scripts/lint-design.ts printed nothing I could act on. I did not run a type check: the repo has no tsconfig, so tsc only prints its help.

What changed

  • src/overlap.ts: new appointmentClashes(deals) compares open, timed Inspection and Walkthrough dates and timed closings across one agent's open deals, same day, less than APART (120) minutes apart. Done, waived, untimed, other-day, closed, fell-through and other-agent dates are never compared.
  • src/deals.ts: listDeals and the single-deal read fill a new clashes list on each deadline view ({dealId, address, label, time}). The single-deal read only loads the agent's other deals when the deal has a timed date, as before.
  • Pages: src/pages/week.ts, src/pages/clock.ts (the dashboard week card), src/pages/appointment.ts and src/pages/deal.ts render "Also at 10:00 am: Inspection, 12 Elm St" in the existing closing-clash amber style, with the address linked and escaped. There is no new layout or class.
  • API and docs: src/routes.ts documents the clashes field, and contract/openapi.json is re-emitted. docs/TECHNICAL.md and the README have a line on it.
  • Tests: the new src/clash.test.ts covers:

- 10:00 vs 11:30 flagged, 10:00 vs 12:00 not; - an inspection vs a closing, flagged both ways; - a done, waived, untimed, other-day, closed, fell-through or other-agent date not flagged; - an address containing <script> escaped on the week sheet, the dashboard week card and the deal page.

The existing closing-clash tests are untouched and pass.

Choices

  • Two closings still use closingConflicts, so a closing-vs-closing clash is not shown twice. appointmentClashes only reports pairs with at least one inspection or walkthrough.
  • The line names the kind (Inspection, Walkthrough, Closing) rather than the date's label, so it reads "Inspection, 12 Elm St" and not "Inspection period ends, 12 Elm St".
  • The time is written "10:00 am" to match the existing closing line, not "10:00 AM" as in the issue.
  • With several clashes, one line joins them as "Also at …; also at …".

Not done

  • The terminal's deal view does not show the new clashes; the issue named only /week and the deal pages.
  • No permission cells changed.

To try it: in a preview, set the same due day on two of your inspections, give them times 90 minutes apart, and look at /week and either deal page.

🤖 Generated with Claude Code

commented

An inspection or walkthrough that falls less than two hours from another timed appointment or closing of the agent's is flagged on This week and on both deals' pages. This pull had been failing its preview deploy; that is fixed, and the full suite now passes here (652 tests). bun scripts/gate.ts doesn't exist in this clone, and tsc has nothing to check without a tsconfig.json, so neither ran.

What failed. The deploy builds my branch together with main. main had gained #194, which gives the sample deals inspection and walkthrough times and places. After that merge, the week-page test "lists overdue and coming dates…" failed. The week page showed "Inspection period ends · 10:30 am · 77 Harbor View Dr, Unit 4B", while the clock's This week card showed the label with no time or place. That gap came from #193 and was hidden until the samples had times.

The fix.

  • src/week.ts has a new whereNote(deal, d), which gives the closing's time and place, or an appointment's, or nothing.
  • src/pages/week.ts and src/pages/clock.ts both use it, so the two lists can no longer disagree. This changes the clock card: it now shows time and place for inspections and walkthroughs.

I merged main into the branch and pushed.

What I chose not to do. I added no new test, because the existing week-versus-clock comparison already covers this. I left the flag's two-hour rule and wording unchanged.

How to try it. Open / and /week and give two timed appointments less than two hours apart. Both show "Also at …", and the same appointment reads the same on both pages.

commented

I could not reproduce the /healthz 503 and found no cause in the code. The only change pushed is a new test, so the preview deploy needs to run again.

This pull flags an inspection or walkthrough that falls less than two hours from another timed appointment or closing of the agent's, on /week, the clock and both deals' pages.

  • Locally: a fresh boot answers /healthz 200. The full suite passes (652 tests), and src/upgrade.test.ts still passes.
  • What I ruled out: this pull adds no migration and does not touch src/health.ts. The upgrade test already compares the schema at all 59 earlier versions with a fresh database.
  • What I could see: the deploy log shows the tests running when the ready check failed, so the 503 may have come from the machine being loaded rather than from the app. The preview and production both answered 502 when I fetched them, so I could not inspect the live 503 response. I could not tell whether that 502 comes from this pull.
  • What I changed: src/upgrade.test.ts now also asks /healthz at each earlier schema version and expects 200. All 60 tests pass with it. This only shows that no upgrade path produces a 503. It is not a fix for the deploy failure.

I did not run bun scripts/gate.ts because the file doesn't exist in this clone. tsc has nothing to check without a tsconfig.json. I changed no permission cells.

If the next deploy fails the same way, the failing check's name is in the 503 body ({"ok":false,"failed":…}). That would point to the missing column.

commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs