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

Each deal shows a Messages record: every reminder sent for it, newest first, with who, when and the exact words approved #26

Merged opened this

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

Merged

/deals/:id now has a Messages section below Parties. It lists every sent reminder for the deal, newest first, with the words that were approved. bun test passes (99 tests) and bun run lint:design is clean.

Notes

shipped production is serving it deploy d2eada7

opened this

/deals/:id now has a Messages section below Parties. It lists every sent reminder for the deal, newest first, with the words that were approved.

bun test passes (99 tests) and bun run lint:design is clean. bun x tsc --noEmit only printed its help text, because the repo has no tsconfig.json, so there was no type check. There is no scripts/gate.ts or scripts/fast.ts. I did not open the running page, so I haven't seen how the section looks.

What changed

  • Page: each entry shows the party's name and role, the date's label, its due day, "3 days before" or "Morning of", and the day it was sent. The subject is the visible line, and the approved body opens in a <details> with no JavaScript. The words come from the stored sent record, so an edited reminder reads back as edited. When nothing is sent, it shows one muted line: "Nothing sent yet". It reuses the existing .drafts and .draft styles, so there is no new component class.
  • Removed dates: the sent record already kept the date's label and the party's name, but not the party's role. I added a migration for a party_role column on reminder, filled in for existing rows where the party still exists. sendReminder now stores the role at send time. A reminder sent before this, whose party was already removed, shows without a role and says "The words were not kept for this one" if its subject was empty. A reminder for a removed date shows "(date removed)" after its label.
  • API and MCP: the deal view's sent list is now ordered newest first. GET /api/deals/:id and the MCP get_deal already returned sent, so both pick up the new order and party_role with no further change. The openapi description for sent is updated, with label, party_name and party_role added, and contract/openapi.json is regenerated.
  • Permissions: the page and API read through the existing deal read permission. contract.json is untouched, so no cell is loosened.
  • Sample data: 1418 Alder Lane now carries one sent reminder, in edited words, to the buyer about the inspection date. The README walk has a sentence pointing to it, and docs/TECHNICAL.md describes the section. The sample refresh now treats a reminder the sample itself sent as untouched and moves it along with its date. Any reminder a person sends still makes that sample deal "changed", as before.
  • Tests:

- src/server.test.ts: the page lists the edited words, escaped; a deal with nothing sent shows the empty line; the Alder Lane sample reads back; a guest gets 401; the API includes sent. - src/deals.test.ts: the role and label survive both being removed, with the newest entry first. - src/terminal.test.ts and src/db.test.ts: two assertions now ignore the sample's own sent reminder.

What I chose not to do

  • I did not add a "removed" label for a removed party. Their name and role stay as sent, which already says who it went to.
  • I placed the sample reminder on a done date (inspection) rather than an open one. An open date would have added a row to today's reminder list and shifted what the terminal tests step through.
  • I did not time the page. It does one extra indexed read on the deal view, which the sample data should not slow.

To try it: open 1418 Alder Lane from the clock, then open any entry under Messages to read the words.

🤖 Generated with Claude Code

Closes #23

1 earlier comment · 1 event
commented

/deals/:id now has a Messages section below Parties. It lists every sent reminder for the deal, newest first, with the words that were approved.

bun test passes (99 tests) and bun run lint:design is clean. bun x tsc --noEmit only printed its help text, because the repo has no tsconfig.json, so there was no type check. There is no scripts/gate.ts or scripts/fast.ts. I did not open the running page, so I haven't seen how the section looks.

What changed

  • Page: each entry shows the party's name and role, the date's label, its due day, "3 days before" or "Morning of", and the day it was sent. The subject is the visible line, and the approved body opens in a <details> with no JavaScript. The words come from the stored sent record, so an edited reminder reads back as edited. When nothing is sent, it shows one muted line: "Nothing sent yet". It reuses the existing .drafts and .draft styles, so there is no new component class.
  • Removed dates: the sent record already kept the date's label and the party's name, but not the party's role. I added a migration for a party_role column on reminder, filled in for existing rows where the party still exists. sendReminder now stores the role at send time. A reminder sent before this, whose party was already removed, shows without a role and says "The words were not kept for this one" if its subject was empty. A reminder for a removed date shows "(date removed)" after its label.
  • API and MCP: the deal view's sent list is now ordered newest first. GET /api/deals/:id and the MCP get_deal already returned sent, so both pick up the new order and party_role with no further change. The openapi description for sent is updated, with label, party_name and party_role added, and contract/openapi.json is regenerated.
  • Permissions: the page and API read through the existing deal read permission. contract.json is untouched, so no cell is loosened.
  • Sample data: 1418 Alder Lane now carries one sent reminder, in edited words, to the buyer about the inspection date. The README walk has a sentence pointing to it, and docs/TECHNICAL.md describes the section. The sample refresh now treats a reminder the sample itself sent as untouched and moves it along with its date. Any reminder a person sends still makes that sample deal "changed", as before.
  • Tests:

- src/server.test.ts: the page lists the edited words, escaped; a deal with nothing sent shows the empty line; the Alder Lane sample reads back; a guest gets 401; the API includes sent. - src/deals.test.ts: the role and label survive both being removed, with the newest entry first. - src/terminal.test.ts and src/db.test.ts: two assertions now ignore the sample's own sent reminder.

What I chose not to do

  • I did not add a "removed" label for a removed party. Their name and role stay as sent, which already says who it went to.
  • I placed the sample reminder on a done date (inspection) rather than an open one. An open date would have added a row to today's reminder list and shifted what the terminal tests step through.
  • I did not time the page. It does one extra indexed read on the deal view, which the sample data should not slow.

To try it: open 1418 Alder Lane from the clock, then open any entry under Messages to read the words.

🤖 Generated with Claude Code

Changes requested — before the latest push

The page, API and migration are sound, but one item on the list is missed: the terminal door. Fix first: add the Messages record to src/terminal.ts, with a test.

  1. Both doors. A person can read the Messages record on the page, but src/terminal.ts and src/tty.ts show no sent record for a deal: grep finds no sent-record view there. Add a view of a deal's sent reminders, newest first, with who, when and the exact words. It should read through the same permit deal-read gate as the page. Add a terminal test that fails without it. The README should then say how to reach it in the terminal.
  2. docs/TECHNICAL.md now says the record is shown 'in the terminal'. That is untrue until item 1 lands.
  3. src/sample.ts: the 'untouched' check treats any reminder with by_name = 'Sample data' as the sample's own. by_name comes from the signer's name, so a real user named 'Sample data' could send a reminder that never marks the deal as changed, and the refresh would then shift its dates. Mark the sample's reminder by something a user cannot set, for example a column, or compare against the exact seeded rows. The tests that filter on by_name <> 'Sample data' (db.test.ts, terminal.test.ts) should follow.
  4. Minor: src/deals.test.ts has a stray "Edited" , body format. Also run a type check; the pull says none ran.
commented

I've addressed all four points and pushed to the same branch. bun test passes (101 tests), bun run lint:design is clean, and a type check with strict settings reports no errors.

What changed

  • Terminal Messages (items 1 and 2): press s on an open deal (o opens it) to see its sent reminders, newest first.

- Each row shows the party and role, the date's label and due day, the moment, and the day it was sent. - Enter opens the exact approved words and b goes back to the deal. - It reads through getDeal, the same permit deal-read path as the page, so a guest sees nothing. - The README walk now says "In the terminal: open the deal with o, then press s", and docs/TECHNICAL.md says the same, so its "in the terminal" claim is now true. - The new test in src/terminal.test.ts sends two reminders, then checks the newest-first order, that the words open on enter, that b returns to the deal, and that a guest sees nothing.

  • Sample marker (item 3): I'm not comparing by_name anymore. A new migration adds reminder.sample, which only the seed sets. The migration also marks the existing sample rows in databases already seeded.

- The untouched check and the date shift now use sample. - The db.test.ts and terminal.test.ts filters use sample = 0. - A new db.test.ts test sends a reminder as "Sample data" on a sample deal. It fails with the old by-name check, because the refresh would shift that deal's dates, and passes now. - I added a new migration instead of editing the earlier one, since the earlier one has already run on previews.

  • Format and type check (item 4): the stray format in src/deals.test.ts is fixed. The repo has no tsconfig.json or @types/bun, so I installed typescript and @types/bun in $TMPDIR and ran tsc --strict --noUncheckedIndexedAccess over the app, src/terminal.test.ts, src/db.test.ts, src/server.test.ts, src/deals.test.ts and src/sample.ts. Nothing is added to the repo.

What I did not do

  • With exactOptionalPropertyTypes also on, tsc reports errors in src/deals.ts (the decline and undo helpers) and src/server.test.ts. That flag is stricter than the repo's own settings (there is no tsconfig.json), and those lines aren't part of this change, so I left them.
  • I did not add a separate terminal route for the record, such as its own top-level key. It lives under the open deal, matching where the page puts it.
Approved

Earlier asks are met. (1/2) The terminal now has the Messages record: s on an open deal, newest first, enter opens the words, b goes back, and it reads through getDeal so a guest sees nothing. It is tested and in the README. (3) The sample marker is a seed-only sample column, not a comparison on by_name, and a test covers the spoofed name. (4) The stray formatting is fixed. I found no new security, contract or cleanliness problems in the changed lines. contract.json is untouched, so no cell is loosened. Non-blocking: the terminal prints stored subject and body verbatim, so control characters in them reach the screen. Stripping them on render would be a cheap hardening step.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs