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
Check · Review · Land · Live done — Landed and live in production.
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.
shipped production is serving it deploy d2eada7
1 earlier comment · 1 event
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/csvwithContent-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/csvis the page route.GET /api/deals.csvis the same file, documented in openapi with its CSV media type. - Who can read it: both routes read through
listDeals, so the samedeallist 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.tsquotes 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.mddocuments the columns.contract/openapi.jsonis regenerated.
Choices to know about
doneis the day the date was marked done, not a timestamp.movedisyesorno; it doesn't say how many times the date moved.- Lines end CRLF, per RFC 4180.
- I added an optional
mimefield 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
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.
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.tshas a new test forGET /deals/csvandGET /api/deals.csv. For every identity the contract declares, it calls each route's real handler and checks the answer againstpermit(who, "deal", "list"). A 200 must betext/csv. Anon must get 401. This runs the routes themselves, whereas the People test callslistDealsdirectly. I think that is stronger here, since the door is the thing being checked. It is not the People test's exact style. closed=1assertion: the API?closed=1check insrc/server.test.tsnow uses the closed-deal scenario./api/deals.csvmust not contain "77 Closing Court", and/api/deals.csv?closed=1must. It would fail without the flag. I removed the old"address,"assertion.
I made no other changes.
🤖 Generated with Claude Code
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.
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.tsdoesn't exist in this repo, so I ranscripts/lint-design.tsinstead. I didn't run a type check.bun x tsc --noEmitonly 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
text/csvwithContent-Disposition: attachment; filename="deal-clock-YYYY-MM-DD.csv". The columns are:-
address,buyer,seller-date,due,done-owed_by,party,movedGET /deals/csvis the page route.GET /api/deals.csvis the same file, documented in openapi with its CSV media type.listDeals, so the samedeallist 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=1. The Closed list on the clock links to that version.src/csv.tsquotes 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.-
src/csv.test.tscovers the header, a known sample row, quoting and the formula guard. -src/server.test.tscovers anon refused, closed deals excluded by default and included with?closed=1, and the API file matching the page file.docs/TECHNICAL.mddocuments the columns.contract/openapi.jsonis regenerated.Choices to know about
doneis the day the date was marked done, not a timestamp.movedisyesorno; it doesn't say how many times the date moved.mimefield to the openapi route description so a non-JSON answer can be described.To try it: sign in, open the clock and tap "Download spreadsheet". Or fetch
/api/deals.csvwith your session.🤖 Generated with Claude Code
Closes #90