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

Merged opened this

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

Merged

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.

Notes

shipped production is serving it deploy d2eada7

opened this

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.ts adds owes_from, owes_by and owes_on to deadline, the same way waived_by and waived_at are kept. setOwes in src/deals.ts fills them in the same UPDATE that changes the owner. Nothing is read from the audit table, and no contract.json cell 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 MCP get_deal returns the same field. It is documented in src/routes.ts, which is where the OpenAPI schema lives, not in src/openapi.ts. I regenerated contract/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.ts covers 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.

Closes #108

commented

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.ts adds owes_from, owes_by and owes_on to deadline, the same way waived_by and waived_at are kept. setOwes in src/deals.ts fills them in the same UPDATE that changes the owner. Nothing is read from the audit table, and no contract.json cell 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 MCP get_deal returns the same field. It is documented in src/routes.ts, which is where the OpenAPI schema lives, not in src/openapi.ts. I regenerated contract/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.ts covers 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.

Approved

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.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs