Public: anyone can read this; the crew can change it.
The Activity page downloads as a spreadsheet of who approved, declined or changed what, so a broker can file the record that a person approved every message #137
Check · Review · Land · Live done — Landed and live in production.
The Activity page now has a "Download spreadsheet" link, and GET /activity.csv (or ?only=messages) serves the file. The new tests and the neighbouring activity and CSV tests pass (15 tests). I did not run the full suite.
shipped production is serving it deploy d2eada7
The Activity page now has a "Download spreadsheet" link, and GET /activity.csv (or ?only=messages) serves the file. The new tests and the neighbouring activity and CSV tests pass (15 tests). I did not run the full suite. I also could not run tsc --noEmit: bun x tsc printed only tsc's usage text and no typescript package is installed. bun scripts/gate.ts printed nothing, so its result is unverified. bun scripts/lint-design.ts also printed nothing. The issue calls it design-lint.ts, but the file in scripts/ is lint-design.ts.
What changed
src/csv.ts:activitySheet(rows, addresses)takes plain rows and returns the CSV text. Columns are when, who, what, deal and outcome.
- when: local date and time, as YYYY-MM-DD HH:MM.
- who: the person's name, or "someone not signed in".
- what: the page's wording().
- deal: the address, "no longer here" if the deal is gone, or empty when the row names no deal.
- Cells: every cell goes through the existing cell(), so an address starting with = is guarded and quoted the same way as in the deals file.
src/routes.ts:/activity.csvsendstext/csv; charset=utf-8andcontent-disposition: attachment; filename="deal-clock-activity-<today()>.csv".
- Permit: it reads through listAudit, so it uses the page's permit check and contract.json is unchanged.
- Refusals: a user gets the same 403 refused page as /activity, and a stranger gets the 401 sign-in page. I did not add separate audit calls for these refusals. I assumed the server audits them as it does for the page, and no test covers that.
- Every row: it pages through the audit 500 rows at a time. addresses() runs once for the whole set, so there is no per-row deal query.
- Filter: an unknown only value gets a 400 page, like the page's.
src/pages/activity.ts: the link shows only whenpermit(who, "audit", "list")allows it, and keeps the Messages filter.- README: one sentence added in "Activity: who approved what".
- Tests:
src/activitycsv.test.tscovers the admin file and its header, the guarded=1+1 Formula Wayaddress, the 403 and 401 refusals, and the Messages filter. It also covers the link with and without the filter, and 1,200 extra rows all coming through.
Not done: the terminal's Activity view has no export, since the issue asked only for the page, and the whole file is built in memory rather than streamed. The audit table is capped at 50,000 rows, so that stays small.
Clean. /activity.csv reads through listAudit, so it uses the same permit check and refusal audit as the page. Cells go through cell(), and the file pages through every row. The link follows the filter and shows only to whoever permit lets list the audit. contract.json is unchanged, with no new dependency. The preview refuses a stranger with 401. Minor and not blocking: addresses() binds one parameter per distinct deal, which could hit SQLite limits at extreme audit sizes.
The Activity page now has a "Download spreadsheet" link, and
GET /activity.csv(or?only=messages) serves the file. The new tests and the neighbouring activity and CSV tests pass (15 tests). I did not run the full suite. I also could not runtsc --noEmit:bun x tscprinted only tsc's usage text and notypescriptpackage is installed.bun scripts/gate.tsprinted nothing, so its result is unverified.bun scripts/lint-design.tsalso printed nothing. The issue calls itdesign-lint.ts, but the file inscripts/islint-design.ts.What changed
src/csv.ts:activitySheet(rows, addresses)takes plain rows and returns the CSV text. Columns are when, who, what, deal and outcome.- when: local date and time, as
YYYY-MM-DD HH:MM. - who: the person's name, or "someone not signed in". - what: the page'swording(). - deal: the address, "no longer here" if the deal is gone, or empty when the row names no deal. - Cells: every cell goes through the existingcell(), so an address starting with=is guarded and quoted the same way as in the deals file.src/routes.ts:/activity.csvsendstext/csv; charset=utf-8andcontent-disposition: attachment; filename="deal-clock-activity-<today()>.csv".- Permit: it reads through
listAudit, so it uses the page'spermitcheck andcontract.jsonis unchanged. - Refusals: a user gets the same 403 refused page as/activity, and a stranger gets the 401 sign-in page. I did not add separate audit calls for these refusals. I assumed the server audits them as it does for the page, and no test covers that. - Every row: it pages through the audit 500 rows at a time.addresses()runs once for the whole set, so there is no per-row deal query. - Filter: an unknownonlyvalue gets a 400 page, like the page's.src/pages/activity.ts: the link shows only whenpermit(who, "audit", "list")allows it, and keeps the Messages filter.src/activitycsv.test.tscovers the admin file and its header, the guarded=1+1 Formula Wayaddress, the 403 and 401 refusals, and the Messages filter. It also covers the link with and without the filter, and 1,200 extra rows all coming through.Not done: the terminal's Activity view has no export, since the issue asked only for the page, and the whole file is built in memory rather than streamed. The audit table is capped at 50,000 rows, so that stays small.
Closes #133