Public: anyone can read this; the crew can change it.
The agent changes who owes a date after it is added, and its reminders from then on go to the new party #104
Check · Review · Land · Live done — Landed and live in production.
The agent can now change Owed by on any open date, and its reminders from then on go to the new party. The full suite passes, including the new src/owes.test.ts. Two checks did not run here: bun x tsc --noEmit only prints its help text, because the repo has no tsconfig.json.
shipped production is serving it deploy d2eada7
1 earlier comment · 1 event
The agent can now change Owed by on any open date, and its reminders from then on go to the new party. The full suite passes, including the new src/owes.test.ts. Two checks did not run here: bun x tsc --noEmit only prints its help text, because the repo has no tsconfig.json. There is no scripts/gate.ts or scripts/design-lint.ts, but scripts/lint-design.ts is there and it reports nothing.
What changed
src/deals.ts: newsetOwes.
- A role outside PARTY_ROLES, or the party who already owes it, is refused with 422 (invalid, field owes).
- A done or waived date is refused with 409 (conflict) and a message saying to reopen it first.
- Only deadline.owes is rewritten. Sent and declined reminders are keyed by party, so the new party starts clean and Messages is untouched.
- A hold that no longer applies is dropped. That means a hold on a party the date no longer tells, or a "late" hold on anyone other than the new owner.
- Every output reads deadline.owes, so the deal page, clock, This week, People, timeline, sheets, calendar and spreadsheet follow the change.
src/routes.ts: newPOST /deadlines/:id/owes, which goes through the same-origin check andpermiton thedealupdate cell. A refusal re-renders the deal page with the message and a 422 or 409.PATCH /api/deals/:id/deadlines/:deadlinenow takesowes, alone or withlead_days, and its documentation is updated.contract/openapi.jsonis regenerated.src/mcp.ts: newset_owestool.src/pages/sheet.ts: an Owed by select on every open date. That sheet is the one used by both the deal page and the clock's marker panel.src/activity.ts: the audit row recordsdate.owes:buyer>seller. The admin Activity page shows it as "<name> changed Owed by from Buyer to Seller".- README: one sentence added to the walk.
- Tests:
src/owes.test.tscovers each case the issue lists. It also covers the hold being dropped, the API and MCP paths, and a mismatched origin.src/server.test.tsnow listsset_owesin the expected MCP tools.
Left out
- No contract cell changed.
- The deal page has no separate Activity section, so "the deal's Activity record" is only the admin Activity page.
- "The form keeps what was typed" is trivial for a select: the refused page just shows the date's current owner.
- The terminal has no key for this; the issue didn't ask for one.
To try it, open any open date on a deal, change Owed by and tap Change who owes it. Today's draft moves to the new party, and /activity (admin) shows the change.
🤖 Generated with Claude Code
Clean: setOwes goes through the same-origin check and permit on the deal update cell, validates the role, refuses settled dates with 409, drops stale holds, and no contract cell changes. Tests cover each case. Minor, not blocking: PATCH with both owes and lead_days commits owes before lead_days is validated; the deal page has no Activity section, so only the admin Activity page shows the change.
Left #102 open: 1 unticked item remain (The deal's Activity record and the admin Activity page show "owed by changed from Buyer to Seller by <name>".).
The agent can now change Owed by on any open date, and its reminders from then on go to the new party. The full suite passes, including the new
src/owes.test.ts. Two checks did not run here:bun x tsc --noEmitonly prints its help text, because the repo has notsconfig.json. There is noscripts/gate.tsorscripts/design-lint.ts, butscripts/lint-design.tsis there and it reports nothing.What changed
src/deals.ts: newsetOwes.- A role outside
PARTY_ROLES, or the party who already owes it, is refused with 422 (invalid, fieldowes). - A done or waived date is refused with 409 (conflict) and a message saying to reopen it first. - Onlydeadline.owesis rewritten. Sent and declined reminders are keyed by party, so the new party starts clean and Messages is untouched. - A hold that no longer applies is dropped. That means a hold on a party the date no longer tells, or a "late" hold on anyone other than the new owner. - Every output readsdeadline.owes, so the deal page, clock, This week, People, timeline, sheets, calendar and spreadsheet follow the change.src/routes.ts: newPOST /deadlines/:id/owes, which goes through the same-origin check andpermiton thedealupdate cell. A refusal re-renders the deal page with the message and a 422 or 409.PATCH /api/deals/:id/deadlines/:deadlinenow takesowes, alone or withlead_days, and its documentation is updated.contract/openapi.jsonis regenerated.src/mcp.ts: newset_owestool.src/pages/sheet.ts: an Owed by select on every open date. That sheet is the one used by both the deal page and the clock's marker panel.src/activity.ts: the audit row recordsdate.owes:buyer>seller. The admin Activity page shows it as "<name> changed Owed by from Buyer to Seller".src/owes.test.tscovers each case the issue lists. It also covers the hold being dropped, the API and MCP paths, and a mismatched origin.src/server.test.tsnow listsset_owesin the expected MCP tools.Left out
To try it, open any open date on a deal, change Owed by and tap Change who owes it. Today's draft moves to the new party, and
/activity(admin) shows the change.🤖 Generated with Claude Code
Closes #102