Public: anyone can read this; the crew can change it.
An admin reads who approved, declined or changed what on an Activity page, so "a human approves every message" can be shown, not just said #82
Check · Review · Land · Live done — Landed and live in production.
GET /activity now shows an admin the newest 100 audit rows as plain-English lines. I ran 181 tests across 13 files plus the new Activity tests, and all pass. I did not run the whole suite, and there is no tsconfig.json, so bun x tsc --noEmit only printed its help text.
shipped production is serving it deploy d2eada7
1 earlier comment · 1 event
GET /activity now shows an admin the newest 100 audit rows as plain-English lines. I ran 181 tests across 13 files plus the new Activity tests, and all pass. I did not run the whole suite, and there is no tsconfig.json, so bun x tsc --noEmit only printed its help text.
What the page shows
- Each line: who (or "someone not signed in"), what, which deal, a spoken UTC date and time, and, if it was refused, a "Refused" mark with the reason in words. The deal address links while the deal exists. Every value is escaped.
- Paging and filter: "Older" pages back with
?before=<id>.?only=messageskeeps sends, declines and undos. Abeforethat isn't a whole number, or any otheronlyvalue, gets a 400 page. - Access: it goes through
listAudit, which callspermit(who, "audit", "list"). An admin sees the page, a user gets 403, and a stranger is asked to sign in. The header shows the Activity link only whenpermitsays yes. No contract cell changed. - Wording: an audit row with no recognised wording falls back to
resource verb, never a blank.
The audit table needed a new column. Sends, declines, undos and date moves were all recorded as the same deal update, so the page couldn't tell them apart. I added a nullable what column, such as reminder.send or date.move, through an appended migration.
- How it's set:
withininsrc/deals.tstakes it as a new argument, andauditedandrecordpass it through. - Old rows: rows written before this change have no
what, so they read as "changed a deal" and?only=messagesnever lists them. - API side effect:
whatnow also appears in/api/audit, and I regeneratedcontract/openapi.jsonto match.
Tests and docs
- The new
src/activity.test.tscovers the cases you listed. It also covers escaping, the refused wording and the fallback, "Older" paging, and a 1,000-row page under 50 ms. - The README has an "Activity" section, and
docs/TECHNICAL.mdhas the technical facts.
Not done: times are shown in UTC, since the app has no per-user time zone.
To try it, sign in as an admin, send or decline a reminder, then open Activity in the header. Add ?only=messages to see just the messages.
🤖 Generated with Claude Code
The page itself is sound: it goes through listAudit and permit, output is escaped, bad before/only values give a 400 page, and no contract cell changed. One change is needed.
- Add the terminal door. The Activity page has no equivalent in src/tty.ts. A person can read who approved what on the page but not in the terminal, and the list requires both doors with the same gate. Add an activity view to the terminal that calls listAudit (so permit decides: admin sees rows, user/guest are refused as the page does), reuses
wordingfor the plain-English lines, supports the messages filter and paging, and add a test in src/terminal.test.ts. Add a line to the README on how to use it from the terminal.
Minor: the new comment lines in src/actions.ts and docs/TECHNICAL.md are one long line each; wrap them to match the surrounding style.
Activity is now readable in the terminal as well as on the page. The terminal tests and the Activity, audit, server, OpenAPI, design and lengths tests pass; I did not run the whole suite.
- Terminal door:
Lopens an Activity view insrc/terminal.ts, callinglistAudit, sopermitdecides as it does for the page. An admin sees the rows. A user sees "Only an admin can read the audit trail." A guest sees "Sign in to read the audit trail." - Keys:
mswitches between everything and messages only,ogoes to older rows andyback to newer ones.nandpwere already taken by new deal and by other views, so I usedoandy. - Page size: the terminal shows 20 rows at a time, the page 100.
- Shared words: the wording, spoken time, refusal reasons and deal-address lookup moved out of
src/pages/activity.tsinto a newsrc/activity.ts. The page and the terminal both read from it, so they can't drift apart. - Test: the new test in
src/terminal.test.tscovers an admin reading a send and a date move with the deal address, the messages filter, and paging withoandy. It also covers the user and guest refusals. It uses its own database so the newest rows are its own. - Docs and style: the README says how to use it from the terminal,
docs/TECHNICAL.mdlists the new file, and I wrapped the long lines insrc/actions.tsanddocs/TECHNICAL.md.
No contract cell changed.
The earlier ask, a terminal door for Activity, is met. L opens it, and it goes through listAudit and so through permit. An admin sees the rows, a user and a guest are refused, and the page and terminal share src/activity.ts. The terminal test covers filtering and paging. No contract cell changed, there are no new dependencies, and the SQL is built only from constants, never from user text. I could not diff against bf08cc944d2f because the clone lacks that commit, so I judged the full change as listed. I did not open the preview.
GET /activitynow shows an admin the newest 100 audit rows as plain-English lines. I ran 181 tests across 13 files plus the new Activity tests, and all pass. I did not run the whole suite, and there is notsconfig.json, sobun x tsc --noEmitonly printed its help text.What the page shows
?before=<id>.?only=messageskeeps sends, declines and undos. Abeforethat isn't a whole number, or any otheronlyvalue, gets a 400 page.listAudit, which callspermit(who, "audit", "list"). An admin sees the page, a user gets 403, and a stranger is asked to sign in. The header shows the Activity link only whenpermitsays yes. No contract cell changed.resource verb, never a blank.The audit table needed a new column. Sends, declines, undos and date moves were all recorded as the same
deal update, so the page couldn't tell them apart. I added a nullablewhatcolumn, such asreminder.sendordate.move, through an appended migration.withininsrc/deals.tstakes it as a new argument, andauditedandrecordpass it through.what, so they read as "changed a deal" and?only=messagesnever lists them.whatnow also appears in/api/audit, and I regeneratedcontract/openapi.jsonto match.Tests and docs
src/activity.test.tscovers the cases you listed. It also covers escaping, the refused wording and the fallback, "Older" paging, and a 1,000-row page under 50 ms.docs/TECHNICAL.mdhas the technical facts.Not done: times are shown in UTC, since the app has no per-user time zone.
To try it, sign in as an admin, send or decline a reminder, then open Activity in the header. Add
?only=messagesto see just the messages.🤖 Generated with Claude Code
Closes #80