Public: anyone can read this; the crew can change it.
The deal's page shows when Owed by was changed on a date: from whom, to whom, by whom and on what day #112
Check · Review · Land · Live done — Landed and live in production.
A date whose Owed by was changed now shows one line on the deal page and in the date's sheet: "Owed by changed from Buyer to Seller by on ". The full bun test run passes (365 tests) and bun scripts/lint-design.ts is clean. I did not run the type check, because the repo has no tsconfig.json.
shipped production is serving it deploy d2eada7
A date whose Owed by was changed now shows one line on the deal page and in the date's sheet: "Owed by changed from Buyer to Seller by <name> on <day>". The full bun test run passes (365 tests) and bun scripts/lint-design.ts is clean. I did not run the type check, because the repo has no tsconfig.json. There is also no scripts/gate.ts or scripts/fast.ts here, so I ran the whole suite.
- Storage: a migration in
src/db.tsaddsowes_from,owes_byandowes_ontodeadline, the same waywaived_byandwaived_atare kept.setOwesinsrc/deals.tsfills them in the same UPDATE that changes the owner. Nothing is read from the audit table, and nocontract.jsoncell changes. - Latest only: each change overwrites the three columns, so after several changes only the latest shows. The name is escaped and the day is written in words.
- API and MCP: the deal JSON now has
owes_changed: {from, by, on}or null on each date. The raw columns are stripped, so they don't appear in the output. The MCPget_dealreturns the same field. It is documented insrc/routes.ts, which is where the OpenAPI schema lives, not insrc/openapi.ts. I regeneratedcontract/openapi.json, because the test that checks it was failing without that. - Sample deals: "Restore the sample deals" already deletes and recreates them, so their rows start with no change. A date added with its owner set from the start has no line.
- Tests: a new test in
src/owes.test.tscovers the deal page and the sheet, the one change then the latest of three, escaping of the name (Bob <b>), and the API field. It also checks the raw columns don't leak. - Not done: the terminal (
src/tty.ts) doesn't show the line, since the issue didn't ask for it.
To try it, change a date's Owed by from its sheet, then reopen the deal page and the sheet.
Clean and in scope. Owner change is stored on the date through a migration and written in the same UPDATE as the owner, and nothing reads the audit table. The name is escaped, only the latest change shows, and the raw columns are stripped from the JSON. No contract.json cell is loosened, and setOwes was already behind permit. The test covers the page, the sheet, escaping, a second change and the API field. Not verified: the preview and the MCP read. I read the diff only. The MCP read should carry the field through the shared DealView, which I assumed rather than checked. Optional follow-up: show the line in the terminal.
A date whose Owed by was changed now shows one line on the deal page and in the date's sheet: "Owed by changed from Buyer to Seller by <name> on <day>". The full
bun testrun passes (365 tests) andbun scripts/lint-design.tsis clean. I did not run the type check, because the repo has notsconfig.json. There is also noscripts/gate.tsorscripts/fast.tshere, so I ran the whole suite.src/db.tsaddsowes_from,owes_byandowes_ontodeadline, the same waywaived_byandwaived_atare kept.setOwesinsrc/deals.tsfills them in the same UPDATE that changes the owner. Nothing is read from the audit table, and nocontract.jsoncell changes.owes_changed: {from, by, on}or null on each date. The raw columns are stripped, so they don't appear in the output. The MCPget_dealreturns the same field. It is documented insrc/routes.ts, which is where the OpenAPI schema lives, not insrc/openapi.ts. I regeneratedcontract/openapi.json, because the test that checks it was failing without that.src/owes.test.tscovers the deal page and the sheet, the one change then the latest of three, escaping of the name (Bob <b>), and the API field. It also checks the raw columns don't leak.src/tty.ts) doesn't show the line, since the issue didn't ask for it.To try it, change a date's Owed by from its sheet, then reopen the deal page and the sheet.
Closes #108