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

Every deal carries an Earnest money deposit date, due a few days after the contract, with reminders to the buyer like the other standard dates #98

Merged opened this

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

Merged

Every new deal now gets an Earnest money deposit date, owed by the buyer, 3 days after the contract date. It follows Count business days and defaults to a 1-day reminder lead. bun test passes in full (315 tests).

Notes

shipped production is serving it deploy d2eada7

opened this

Every new deal now gets an Earnest money deposit date, owed by the buyer, 3 days after the contract date. It follows Count business days and defaults to a 1-day reminder lead. bun test passes in full (315 tests). I couldn't run tsc --noEmit because the repo has no tsconfig, and there's no scripts/gate.ts or scripts/fast.ts. I didn't run scripts/lint-design.ts (the repo only has scripts/lint-design.ts). The one src/pages/deal.ts change adds an input to the existing .lengths row, so no new component class.

What changed

  • Date and length: the new earnest kind and its leadOf of 1 are in src/deadlines.ts. DEAL_CLOCK_EARNEST_DAYS is read the same way as the other lengths: 0 to 180, anything else falls back to 3 with a log line.
  • Where it's taken: the New deal form, Check the dates preview, POST /api/deals (so contract/openapi.json was re-emitted) and the MCP open_deal tool take earnest. An out-of-range value is refused by the same check as the other lengths, with a message naming earnest.
  • Welcome page: the made-up deal now includes the deposit, so the "N of M dates done" count includes it. The progress count itself needed no code change.
  • No migration: existing deals are untouched on boot. A test deletes the deposit from a deal, reopens the database, and checks it doesn't come back.
  • Samples:

- Alder Lane, Harbor View and Orchard Row: the deposit is already done. - Juniper Court: the deposit is due in 2 days (a 5-day length for that sample), so it is still ahead. - Harbor View: I marked it done so its overdue marker stays the inspection one, as the README describes.

  • Docs: README step 10 and the lengths list name it; docs/TECHNICAL.md has a paragraph on it.

Tests

  • New: src/earnest.test.ts covers the API 4xx, the MCP error, an old deal gaining no date, and the restored samples. Calendar and business-day dates, the 1-day lead and the plan-level refusal are in src/deals.test.ts. The env fallback is in src/lengths.test.ts.
  • Updated to the new truth, none deleted:

- Counts of 6 dates became 7. - Expected date maps and length objects gained earnest. - The lead test excludes earnest. - The sample doneAts gained one done date. - In the terminal restore test, Harbor View's deposit is allowed to stay done. - Two reminder tests in src/deals.test.ts now pick the inspection reminder explicitly, because the buyer now also has an earnest one.

Left alone

  • The README's "14 to send" is illustrative and was already out of step: the fresh seed gives 18 reminders waiting, before and after this change.
  • This touches dates near #84, so whichever lands second rebases.

To try it: open New deal and the Earnest money deposit field is first. Set DEAL_CLOCK_EARNEST_DAYS=5 to change the default.

Closes #94

commented

Every new deal now gets an Earnest money deposit date, owed by the buyer, 3 days after the contract date. It follows Count business days and defaults to a 1-day reminder lead. bun test passes in full (315 tests). I couldn't run tsc --noEmit because the repo has no tsconfig, and there's no scripts/gate.ts or scripts/fast.ts. I didn't run scripts/lint-design.ts (the repo only has scripts/lint-design.ts). The one src/pages/deal.ts change adds an input to the existing .lengths row, so no new component class.

What changed

  • Date and length: the new earnest kind and its leadOf of 1 are in src/deadlines.ts. DEAL_CLOCK_EARNEST_DAYS is read the same way as the other lengths: 0 to 180, anything else falls back to 3 with a log line.
  • Where it's taken: the New deal form, Check the dates preview, POST /api/deals (so contract/openapi.json was re-emitted) and the MCP open_deal tool take earnest. An out-of-range value is refused by the same check as the other lengths, with a message naming earnest.
  • Welcome page: the made-up deal now includes the deposit, so the "N of M dates done" count includes it. The progress count itself needed no code change.
  • No migration: existing deals are untouched on boot. A test deletes the deposit from a deal, reopens the database, and checks it doesn't come back.
  • Samples:

- Alder Lane, Harbor View and Orchard Row: the deposit is already done. - Juniper Court: the deposit is due in 2 days (a 5-day length for that sample), so it is still ahead. - Harbor View: I marked it done so its overdue marker stays the inspection one, as the README describes.

  • Docs: README step 10 and the lengths list name it; docs/TECHNICAL.md has a paragraph on it.

Tests

  • New: src/earnest.test.ts covers the API 4xx, the MCP error, an old deal gaining no date, and the restored samples. Calendar and business-day dates, the 1-day lead and the plan-level refusal are in src/deals.test.ts. The env fallback is in src/lengths.test.ts.
  • Updated to the new truth, none deleted:

- Counts of 6 dates became 7. - Expected date maps and length objects gained earnest. - The lead test excludes earnest. - The sample doneAts gained one done date. - In the terminal restore test, Harbor View's deposit is allowed to stay done. - Two reminder tests in src/deals.test.ts now pick the inspection reminder explicitly, because the buyer now also has an earnest one.

Left alone

  • The README's "14 to send" is illustrative and was already out of step: the fresh seed gives 18 reminders waiting, before and after this change.
  • This touches dates near #84, so whichever lands second rebases.

To try it: open New deal and the Earnest money deposit field is first. Set DEAL_CLOCK_EARNEST_DAYS=5 to change the default.

Approved

Clean. The earnest money deposit is a new kind owed by the buyer, with a lead of 1. It is validated at the form, API and MCP boundary like the other lengths, left off existing deals on boot, and carried by the samples and the welcome deal. No contract cell is touched and no dependency is added. Tests cover each behaviour and the README names it. Minor and not blocking: the new README lines run long.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs