Audit Log Frontend per Organization #651

Merged
tobru merged 12 commits from audit-log-frontend into main 2026-09-04 14:40:03 +00:00
Owner

Maybe add Staff view? With good filtering and search

Maybe add Staff view? With good filtering and search
tobru force-pushed audit-log-frontend from 323d1693e3
All checks were successful
Tests / test (push) Successful in 1m20s
to 390701a571
All checks were successful
Tests / test (push) Successful in 1m27s
2026-09-04 14:08:34 +00:00
Compare
tobru changed title from WIP: Audit Log Frontend per Organization to Audit Log Frontend per Organization 2026-09-04 14:08:40 +00:00
fix: make the audit log swallows and its ordering hold up
All checks were successful
Tests / test (push) Successful in 1m19s
d12e24d6d2
Four review findings, none of which changed what the log says on the
normal path, but each of which undermines a guarantee it makes.

Savepoints in both audit swallows. on_log_entry_saved promises that a
failed stamp cannot roll back the user's save, and _log_spec_changes
promises the audit row is the recoverable loss. On PostgreSQL neither
promise held: a failed statement aborts the enclosing transaction and
every statement after it raises, so catching the exception just moves
the failure one statement later. ServiceInstance.delete() is
@transaction.atomic and its cascade is what writes these entries, so
this was reachable today.

Datetime change rows now go through localtime_tag like every other time
in the portal. auditlog.diff.get_field_value stores DateTimeField values
as naive UTC text, so "Terms accepted at" and "Accepted at" printed an
unmarked UTC time directly beneath the row's own browser-local
timestamp - the same instant shown twice, two hours apart, for a CEST
reader. The renderer parses those back to aware datetimes and a new
audit_change_value filter dispatches on the type, because the column
also carries "10Gi" and "not set", which must not be read as ISO
timestamps. local-time.js already re-runs on htmx:afterSwap, so the
fragment swap is covered.

Pagination orders by -pk as well. timestamp is copied verbatim from the
log entry and carries no uniqueness, so LIMIT/OFFSET was free to order
tied rows differently per request, showing one entry twice across a page
boundary and hiding another. Meta.ordering matches; the ordering lives
in this branch's own unreleased 0064, so it is fixed there rather than
in a state-only 0068.

Two of the four tests are structural, and say so: the transaction and
ordering failures are PostgreSQL-dependent, and the suite runs on
SQLite, where a behavioural test passes just as well without the fix.
All four were confirmed to fail against the unfixed code.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
tobru merged commit 32c7a7afe6 into main 2026-09-04 14:40:03 +00:00
tobru deleted branch audit-log-frontend 2026-09-04 14:40:03 +00:00
Sign in to join this conversation.
No description provided.