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

A sent reminder opens in the agent's own Mail or Messages app with the approved words filled in, so Send really reaches the party #65

opened this

Merged 32d 3h ago, live in production

After Send, the notice, the sheet and the deal page's Messages record each offer one link built from the approved words. The app sends nothing itself, and nothing opens the link by script.

Notes

opened this

After Send, the notice, the sheet and the deal page's Messages record each offer one link built from the approved words. The app sends nothing itself, and nothing opens the link by script.

Tests: bun test ends with one failure, "a moved date's Date changed notice is sent, declined and undone through the routes and MCP…". It fails identically on the base branch without my changes, so I left it alone. bun run lint:design is clean. The repo has no tsconfig, so tsc --noEmit only prints its help text, and I did not run a typecheck. scripts/gate.ts and scripts/fast.ts don't exist here.

What changed

  • Link builder: the new src/outbox.ts has one pure function, outbox(contact, subject, body). An email (validEmail) gives Open in Mail, a mailto: link with the subject and body percent-encoded. A phone (validPhone) gives Open in Messages, an sms: link with the body. Anything else gives null, and a contact containing " or javascript: fails both checks. Its test covers email, phone, missing contact, " and javascript:, and a body with &, #, newlines and non-ASCII that round-trips through decodeURIComponent.
  • Notice and Messages: after Send, the notice reads "Reminder sent." with the link. If the party has no email or phone, it says "No email or phone on file" instead. The sheet and the Messages record show the same link or text, with the href attribute-escaped. A reader who can't change the deal sees neither the link nor the text. The notice finds the sent reminder by its id, carried in the existing notice cookie, so no message body goes into a cookie.
  • API and MCP: each sent[] entry carries href (null when there is no link), and so does send_reminder's answer. The OpenAPI file is regenerated.
  • Terminal: Send now says "Recorded as sent to … Send it from your phone to <address>." and the terminal test is updated to match. I did not add a link line to the terminal's Messages view.
  • Wording: the footer, the clock's reminders note, the MCP tool description, README step 4 and docs/TECHNICAL.md now say Send records the approval and opens your own Mail or Messages. Nothing is sent by the app itself.

Choices

  • The link uses the party's contact as it stands now, not when the reminder was sent. If the party has been removed, the old Messages entry shows "No email or phone on file", because the app doesn't keep the contact on the sent row.
  • I changed no policy cell and added no dependency.
  • #57 and #58 also edit src/pages/sheet.ts; I did not rebase against them.

To try it: in a preview, give a party an email or phone, open a date's sheet, tap Send, then tap the link in the notice. The same link is on the sheet and in the deal's Messages record.

Closes #62

3 earlier comments
commented

After Send, the notice, the sheet and the deal page's Messages record each offer one link built from the approved words. The app sends nothing itself, and nothing opens the link by script.

Tests: bun test ends with one failure, "a moved date's Date changed notice is sent, declined and undone through the routes and MCP…". It fails identically on the base branch without my changes, so I left it alone. bun run lint:design is clean. The repo has no tsconfig, so tsc --noEmit only prints its help text, and I did not run a typecheck. scripts/gate.ts and scripts/fast.ts don't exist here.

What changed

  • Link builder: the new src/outbox.ts has one pure function, outbox(contact, subject, body). An email (validEmail) gives Open in Mail, a mailto: link with the subject and body percent-encoded. A phone (validPhone) gives Open in Messages, an sms: link with the body. Anything else gives null, and a contact containing " or javascript: fails both checks. Its test covers email, phone, missing contact, " and javascript:, and a body with &, #, newlines and non-ASCII that round-trips through decodeURIComponent.
  • Notice and Messages: after Send, the notice reads "Reminder sent." with the link. If the party has no email or phone, it says "No email or phone on file" instead. The sheet and the Messages record show the same link or text, with the href attribute-escaped. A reader who can't change the deal sees neither the link nor the text. The notice finds the sent reminder by its id, carried in the existing notice cookie, so no message body goes into a cookie.
  • API and MCP: each sent[] entry carries href (null when there is no link), and so does send_reminder's answer. The OpenAPI file is regenerated.
  • Terminal: Send now says "Recorded as sent to … Send it from your phone to <address>." and the terminal test is updated to match. I did not add a link line to the terminal's Messages view.
  • Wording: the footer, the clock's reminders note, the MCP tool description, README step 4 and docs/TECHNICAL.md now say Send records the approval and opens your own Mail or Messages. Nothing is sent by the app itself.

Choices

  • The link uses the party's contact as it stands now, not when the reminder was sent. If the party has been removed, the old Messages entry shows "No email or phone on file", because the app doesn't keep the contact on the sent row.
  • I changed no policy cell and added no dependency.
  • #57 and #58 also edit src/pages/sheet.ts; I did not rebase against them.

To try it: in a preview, give a party an email or phone, open a date's sheet, tap Send, then tap the link in the notice. The same link is on the sheet and in the deal's Messages record.

commented

The preview's failing test is fixed and pushed; the full suite now passes here (192 pass, 0 fail). I haven't seen the forge's check on the new push yet.

The failing test was "a moved date's Date changed notice is sent, declined and undone…". The pull didn't cause it. It was left stale by #59, which stopped putting date sheets on the clock page. The test still looked for "Date changed" on /, but the text now only appears on a deal's sheets. I changed the test to read /deals/:id/sheets instead; the code is untouched. I said last time that this failure was already there on the base branch and left it, but I should have fixed it then.

The pull is otherwise as described before: a sent reminder offers an Open in Mail or Open in Messages link on the notice, the sheet and the deal's Messages record. The API and MCP carry the same link as href.

commented

All three changes and the extra cookie test are in and pushed. The full suite passes here (198 pass, 0 fail); I haven't seen the forge's check on the new push yet.

  1. Access rule test: a stranger reading /api/deals/:id gets 401 with no href, and the deal page shows no party address, no link and no "No email or phone on file". Two limits:
    • With today's table every reader who can read a deal can also change it, so no signed-in user can be found who reads without changing. That branch is tested directly on shown, now exported: it blanks every contact and sets every href to null for a reader who can't change the deal. outboxLine is tested to give nothing in that case.
    • The page-level test therefore can't reach a signed-in reader without change rights. It covers the stranger only.
  2. Terminal Messages: opening a sent message with enter now shows "To <contact>: send it from your phone", or "No email or phone on file". Both are gated on canChange, as the page is. The subject and body were already there.
  3. Terminal test: I dropped the loose regex. A new test sets a contact on the next reminder to send and asserts the exact "Send it from your phone to [email protected]." line. It then does the same with an empty contact and asserts "No email or phone on file." with no phone line.
  4. Cookie test: src/notice.test.ts round-trips back and readNotice with an id and without one. A malformed cookie value is shown as text and opens nothing; the cases are a non-numeric id, an empty id, an id with 13 digits, a negative id and no ~ at all.
commented

I merged main into the branch and pushed it. The full suite passes here (207 pass, 0 fail) and bun run lint:design is clean.

There were four conflicts, and in each I kept both sides:

  • src/deals.ts, src/pages/sheet.ts: each now imports from both outbox.ts and main's order.ts.
  • src/pages/deal.ts: one import from ./sheet.ts now takes conflictLines from main and outboxLine from this pull.
  • src/server.test.ts: main and this branch had each reworded the same comment, in the test that already reads the date's sheet for the "Date changed" notice. I kept main's wording.
Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs