feature: add workspace history of actions (History page + audit_events) - #271
feature: add workspace history of actions (History page + audit_events)#271jmooves wants to merge 1 commit into
Conversation
Adds an append-only audit trail of user actions with a top-level History page (sidebar entry): User, Created, Title (linked), Status, Type, Application and Model columns, with search, type filter, date range, CSV export and pagination. Backend: audit_events table (schema.sql + dated migration), a fire-and-forget recorder (lib/audit.ts) that can never throw or block a user-facing path, and call sites for chat turns (model, cancelled status, plus per-artifact rows for generated/edited documents and applied workflows mined from the persisted stream events), document uploads, tabular review creation/generation and data exports. GET /audit lists events (visibility: own actions plus activity in projects owned by or shared with the caller); GET /audit/export streams the same view as CSV. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Thanks for taking this on — an audit trail is a real gap in Mike, and you got the hard parts right: the fire-and-forget recorder genuinely can't reject (which matters, since a floating rejection would take down the process), and visibility failing closed on a project-lookup error is exactly the right default. A few things I'd consider blocking, all with small fixes:
Also worth picking up: I've opened jmooves#1 against your branch with all of this fixed, plus tests — merge it and this PR updates, or cherry-pick what you agree with. It sits directly on your branch: five focused commits, nothing unrelated, with rebasing onto current |
User Experience
Currently no audit history exists within Mike. This feature enhancement adds an audit trail of user actions with a top-level History page and adds a sidebar entry below Workflows.
What it does
/history): User · Created · Title (linked to the chat/review) · Status · Type · Application · Model, with search, a type filter, a date range, CSV export and pagination.cancelledstatus when a stream is aborted) with per-artifact rows mined from the persisted stream events (generated documents, edits, applied workflows), document uploads, tabular review creation and generation runs, and data exports.shared_withmodel, no new permission concept.Design notes
audit_eventsis append-only, added toschema.sql(fresh installs) and as a dated migration (existing deployments). Accessed only via the service-role backend.lib/audit.ts) is fire-and-forget: it can never throw or block a user-facing path - failures log and are swallowed.Testing
npx vitest rungreen on this branch;tscclean on both apps;next buildincludes/history./auditwith correct fields; the type filter and CSV export verified.🤖 Generated with Claude Code and human reviewed. :)