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

The agent downloads every open deal's dates as one spreadsheet file, for the brokerage's compliance sheet or their own records #101

Merged opened this

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

Merged

The clock now has a "Download spreadsheet" link beside "Add all to calendar". It returns one CSV row per date of every open deal the person may read. Checks.

Notes

shipped production is serving it deploy d2eada7

opened this

The clock now has a "Download spreadsheet" link beside "Add all to calendar". It returns one CSV row per date of every open deal the person may read.

Checks. I ran the csv, server, openapi, speed, contract and design tests, and scripts/lint-design.ts; all pass. scripts/design-lint.ts doesn't exist in this repo, so I ran scripts/lint-design.ts instead. I didn't run a type check. bun x tsc --noEmit only prints its help text because the repo has no tsconfig, so the type check is unverified. I didn't run the whole suite.

What changed

  • Download: the file is served as text/csv with Content-Disposition: attachment; filename="deal-clock-YYYY-MM-DD.csv". The columns are:

- address, buyer, seller - date, due, done - owed_by, party, moved

  • Routes: GET /deals/csv is the page route. GET /api/deals.csv is the same file, documented in openapi with its CSV media type.
  • Who can read it: both routes read through listDeals, so the same deal list cell as the clock decides. A signed-out visitor gets the sign-in page (401) from /deals/csv, and a JSON 401 from the API. No contract cell was loosened.
  • Closed deals: they are left out unless the URL has ?closed=1. The Closed list on the clock links to that version.
  • CSV rules: src/csv.ts quotes any cell with a comma, quote or line break. A cell starting with =, +, -, @, tab or carriage return gets a ' prefix, so a party name can't become a formula.
  • Tests:

- src/csv.test.ts covers the header, a known sample row, quoting and the formula guard. - src/server.test.ts covers anon refused, closed deals excluded by default and included with ?closed=1, and the API file matching the page file.

  • Docs: one sentence in the README. docs/TECHNICAL.md documents the columns. contract/openapi.json is regenerated.

Choices to know about

  • done is the day the date was marked done, not a timestamp.
  • moved is yes or no; it doesn't say how many times the date moved.
  • Lines end CRLF, per RFC 4180.
  • I added an optional mime field to the openapi route description so a non-JSON answer can be described.
  • I didn't add a dependency.

To try it: sign in, open the clock and tap "Download spreadsheet". Or fetch /api/deals.csv with your session.

🤖 Generated with Claude Code

Closes #90

1 earlier comment · 1 event
commented

The clock now has a "Download spreadsheet" link beside "Add all to calendar". It returns one CSV row per date of every open deal the person may read.

Checks. I ran the csv, server, openapi, speed, contract and design tests, and scripts/lint-design.ts; all pass. scripts/design-lint.ts doesn't exist in this repo, so I ran scripts/lint-design.ts instead. I didn't run a type check. bun x tsc --noEmit only prints its help text because the repo has no tsconfig, so the type check is unverified. I didn't run the whole suite.

What changed

  • Download: the file is served as text/csv with Content-Disposition: attachment; filename="deal-clock-YYYY-MM-DD.csv". The columns are:

- address, buyer, seller - date, due, done - owed_by, party, moved

  • Routes: GET /deals/csv is the page route. GET /api/deals.csv is the same file, documented in openapi with its CSV media type.
  • Who can read it: both routes read through listDeals, so the same deal list cell as the clock decides. A signed-out visitor gets the sign-in page (401) from /deals/csv, and a JSON 401 from the API. No contract cell was loosened.
  • Closed deals: they are left out unless the URL has ?closed=1. The Closed list on the clock links to that version.
  • CSV rules: src/csv.ts quotes any cell with a comma, quote or line break. A cell starting with =, +, -, @, tab or carriage return gets a ' prefix, so a party name can't become a formula.
  • Tests:

- src/csv.test.ts covers the header, a known sample row, quoting and the formula guard. - src/server.test.ts covers anon refused, closed deals excluded by default and included with ?closed=1, and the API file matching the page file.

  • Docs: one sentence in the README. docs/TECHNICAL.md documents the columns. contract/openapi.json is regenerated.

Choices to know about

  • done is the day the date was marked done, not a timestamp.
  • moved is yes or no; it doesn't say how many times the date moved.
  • Lines end CRLF, per RFC 4180.
  • I added an optional mime field to the openapi route description so a non-JSON answer can be described.
  • I didn't add a dependency.

To try it: sign in, open the clock and tap "Download spreadsheet". Or fetch /api/deals.csv with your session.

🤖 Generated with Claude Code

Changes requested — before the latest push

Security reads clean: the file goes through listDeals, so the deal list cell decides who reads it, and anon gets 401. The formula guard and quoting are correct, and no cell is loosened. One miss against the list: a new door needs its row in src/contract.test.ts. Every other door has one (see the People test at line 154 and the status update test at line 163, each "answers as deal list says, as every identity"). GET /deals/csv and GET /api/deals.csv have none. Fix: add a test in src/contract.test.ts that checks both routes against permit for deal list, for anon, user and admin, in the same style as the People test. Smaller: the server test asserts the closed=1 API response only contains "address,", which would pass without the flag. Assert it contains a closed deal address, as the page test does.

commented

Both review points are addressed and pushed to the same branch. src/contract.test.ts and src/server.test.ts pass (54 tests); I did not run the rest of the suite.

  • Contract row: src/contract.test.ts has a new test for GET /deals/csv and GET /api/deals.csv. For every identity the contract declares, it calls each route's real handler and checks the answer against permit(who, "deal", "list"). A 200 must be text/csv. Anon must get 401. This runs the routes themselves, whereas the People test calls listDeals directly. I think that is stronger here, since the door is the thing being checked. It is not the People test's exact style.
  • closed=1 assertion: the API ?closed=1 check in src/server.test.ts now uses the closed-deal scenario. /api/deals.csv must not contain "77 Closing Court", and /api/deals.csv?closed=1 must. It would fail without the flag. I removed the old "address," assertion.

I made no other changes.

🤖 Generated with Claude Code

Approved

Both earlier asks are met. The contract row now runs both real handlers for every identity against permit(deal, list), with anon at 401. The API closed=1 assertion uses the closed-deal scenario and would fail without the flag. I found nothing new in the later diff: the formula guard and quoting are correct, no contract cell is loosened, and there is no new dependency. I read the diff only and did not fetch the preview.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs