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

A year after a deal closes, the agent gets a drafted "Happy home anniversary" note to their clients, approved like any reminder, so past clients hear from them when referrals come from #177

Merged opened this

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

Merged

A year after a closing was marked done, each past client now gets a drafted "Happy home anniversary" note. It waits in Review and is approved, edited, held or declined like the check-in. The full bun test passes (601 tests).

Notes

shipped production is serving it deploy d2eada7

opened this

A year after a closing was marked done, each past client now gets a drafted "Happy home anniversary" note. It waits in Review and is approved, edited, held or declined like the check-in. The full bun test passes (601 tests). bun x tsc --noEmit could not run because the repo has no tsconfig.json, and there is no scripts/gate.ts here, so the gate step was skipped.

What changed

  • Words and day (src/checkin.ts): anniversaryOn gives the day. A closing marked done on Feb 29 has its anniversary on Feb 28 in years without one. anniversaryWords greets by first name, names the address, never mentions the price, and asks for referrals once. It ends with the agent's sign-off and Profile line.
  • Drafting (src/reminders.ts): anniversaryDrafts covers the same clients as the check-in (checkinRoles), and fell-through or reopened deals get none. Ten years are drafted ahead. Each year is keyed by the closing, the day it was marked done and the year number (stored in move_id). A year's note that was sent, held or declined is therefore never made again. A missed note waits 30 days.
  • Which year an action means: Send, hold and decline act on the latest year already due, so a repeated send is the same send and never sends next year's early.
  • Migration: anniversary is a new moment, so the three reminder tables are rebuilt as the check-in migration did, and the new hash is appended to src/migrations.pin.json. I regenerated the contract/openapi.json enums. No contract cell changed.
  • Where it shows: the deal page has a "Home anniversary" card, and the clock links to it.
  • Sample: "58 Larkspur Way" is the eighth sample, closed a year ago today. Its check-in is recorded as long since sent, so only the anniversary waits. Refresh does not pull it into this year.
  • README and docs: one sentence in the README tour next to the check-in, and a paragraph in docs/TECHNICAL.md.
  • Tests: new src/anniversary.test.ts covers the right day, recipients per side, no duplicates across ticks, fell-through, Feb 29, no price in the words, and the sample.

Behaviour change to check

  • Review order: the Review page and the terminal now list open deals first and closed deals newest first, which is the clock's own order. Before this, Review followed list order, which put the year-old sample first and made it disagree with the clock. The new inClockOrder is in src/reminders.ts.

Existing tests I edited

  • The sample count went from 7 to 8 in the db, deals, figures, earnest, restore and server tests.
  • Terminal "Closed (3)" became "Closed (4)", and the later one "(5)".
  • The sample tests that count "closed this year" now exclude Larkspur.
  • review.test.ts now reads anniversary rows from the clock, since they link to the deal card instead of a date's sheet.
  • The pre-Profile-line migration test also skips the new migration.

Not done

  • Nothing is drafted past ten years.
  • A client with no contact gets no note, same as the check-in.

Try it: open the demo. Review shows one anniversary note for Nadia & Sam Desai, and /deals/<id>#anniversary shows the card.

🤖 Generated with Claude Code

Closes #173

1 earlier comment · 1 event
commented

A year after a closing was marked done, each past client now gets a drafted "Happy home anniversary" note. It waits in Review and is approved, edited, held or declined like the check-in. The full bun test passes (601 tests). bun x tsc --noEmit could not run because the repo has no tsconfig.json, and there is no scripts/gate.ts here, so the gate step was skipped.

What changed

  • Words and day (src/checkin.ts): anniversaryOn gives the day. A closing marked done on Feb 29 has its anniversary on Feb 28 in years without one. anniversaryWords greets by first name, names the address, never mentions the price, and asks for referrals once. It ends with the agent's sign-off and Profile line.
  • Drafting (src/reminders.ts): anniversaryDrafts covers the same clients as the check-in (checkinRoles), and fell-through or reopened deals get none. Ten years are drafted ahead. Each year is keyed by the closing, the day it was marked done and the year number (stored in move_id). A year's note that was sent, held or declined is therefore never made again. A missed note waits 30 days.
  • Which year an action means: Send, hold and decline act on the latest year already due, so a repeated send is the same send and never sends next year's early.
  • Migration: anniversary is a new moment, so the three reminder tables are rebuilt as the check-in migration did, and the new hash is appended to src/migrations.pin.json. I regenerated the contract/openapi.json enums. No contract cell changed.
  • Where it shows: the deal page has a "Home anniversary" card, and the clock links to it.
  • Sample: "58 Larkspur Way" is the eighth sample, closed a year ago today. Its check-in is recorded as long since sent, so only the anniversary waits. Refresh does not pull it into this year.
  • README and docs: one sentence in the README tour next to the check-in, and a paragraph in docs/TECHNICAL.md.
  • Tests: new src/anniversary.test.ts covers the right day, recipients per side, no duplicates across ticks, fell-through, Feb 29, no price in the words, and the sample.

Behaviour change to check

  • Review order: the Review page and the terminal now list open deals first and closed deals newest first, which is the clock's own order. Before this, Review followed list order, which put the year-old sample first and made it disagree with the clock. The new inClockOrder is in src/reminders.ts.

Existing tests I edited

  • The sample count went from 7 to 8 in the db, deals, figures, earnest, restore and server tests.
  • Terminal "Closed (3)" became "Closed (4)", and the later one "(5)".
  • The sample tests that count "closed this year" now exclude Larkspur.
  • review.test.ts now reads anniversary rows from the clock, since they link to the deal card instead of a date's sheet.
  • The pre-Profile-line migration test also skips the new migration.

Not done

  • Nothing is drafted past ten years.
  • A client with no contact gets no note, same as the check-in.

Try it: open the demo. Review shows one anniversary note for Nadia & Sam Desai, and /deals/<id>#anniversary shows the card.

🤖 Generated with Claude Code

Approved — before the latest push

Clean on security: the new moment is validated by the existing enums at every door (routes, MCP, schema CHECKs), no contract cell changed, no roles compared by hand, output goes through the existing escaped draft rendering, and the migration is appended and pinned. Each year is keyed by closing, done-day and year number, so a sent, held or declined year is never remade; fell-through and reopened deals get none; the Feb 29 rule and the no-price words are tested. Two notes, not blockers: the Review/terminal reorder (inClockOrder) goes slightly beyond the issue but is explained and keeps Review in step with the clock; and the preview as seen with my token showed no private deals, so I judged the sample by its test rather than on the page.

commented

I merged main into this branch and pushed it. The only conflict was in src/terminal.ts.

Conflict: both sides had changed the ./reminders.ts import line. main had added coming/comingLine, and this branch had added inClockOrder. I kept both.

Tests: I ran the whole suite in the clone, and 606 tests passed with 0 failures.

Checks I couldn't run: bun x tsc --noEmit printed its help text, so there was no type check. The clone has no scripts/gate.ts or scripts/fast.ts, so I ran neither.

Approved

Clean. The clone no longer has bd9d7855ae5c, so I read the whole diff: the merge of main only touched the terminal.ts import line. Nothing is left open from my earlier round. No contract cell is loosened, and the terminal reads the same drafts() as the page, so both doors get the note. Send, hold and decline are the existing permit-gated paths. The migration is appended and pinned, and the new tests cover each behaviour the issue lists. The preview answered 401 to my token on /reminders/today, so I could not see the page there and judged from the tests and the diff. Non-blocking: tsc was not run by the builder because the repo has no tsconfig.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs