feat(admin): Activity log and Failed jobs pages #144
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/kws!144
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/admin-system-logs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds two read-only admin portal pages from the system logs, backup and restore design (
docs/superpowers/specs/2026-11-02-system-logs-backup-restore-design.md). This is PR 1 of 3. Backups (PR 2) and restore (PR 3) wait for the production server setup (#57).What it adds
/system/activity, fromGET /v1/admin/audit-log. It lists every recorded change to the audited config, catalogue and access tables, newest first: the time, who made it ("System" when no person did), the table, the record key, the operation, and the changed columns with old and new values. Filters are from/to (Nairobi days), table, actor id and record id. A record id needs a table, and it matches any key column, so link tables work./system/failed-jobs, fromGET /v1/admin/dead-jobs. It lists dead-lettered jobs with the time, kind, attempts, the subject id (sale, payment, log, invitation or attempt id) and the job id.last_errorand the payload are never returned, because they can hold personal data or tokens.admin_portal.administration.manageat platform scope (rbac.PlatformOnly) and use thedefaultrate class. Reads run inreadTx(REPEATABLE READ READ ONLY, 3 s) with keyset paging (next_before, 1..200 per page). Date filters use uuidv7 id bounds, so the id index is used, and boundary tests cover 20:59:59Z and 21:00Z.listAuditLogandlistDeadJobs, and the live contract test covers them, including a check that no token or error text leaks. CLAUDE.md gains a "System logs" section.Checks
make lint: 0 issuesmake cover: 91.6% (minimum 80%).reportsis at 99.0% andreports/pgstoreat 82.5%.make contract: OKmake clients: OKpnpm -r typecheckandpnpm -r test: all pass (admin 292, ticket 304, ui 47, auth 45)scripts/web-e2e.sh): passed beforemainwas merged in. On macOS it needsCOPYFILE_DISABLE=1.Owner question ([verify])
The Activity log shows recorded values to
administration.manageholders, includingorganizationscontact details andorganization_invitations.email.staff_invitationsalready excludes its email from the audit. Should these be hidden? This is open question 3 in the design.Rulings (with their cost if wrong)
LogPagecomponent, and the date and error helpers moved toreports/filters.ts. Cost: one extra layer to read.audit_logrows with 2020 ids, and the contract test covers the trigger's real output. Cost: none.Deferred minors
pageLimitandnormalizeLimitduplicate the inline limit code in the other reports (about -16 lines to merge).as nevercast infetchAuditPage..UTC()is applied twice, in the handler and the stores.occurred_at).🤖 Generated with Claude Code