Repository navigation
feat(audit): retention and export semantics for the audit event store (#519) - #885
Merged
Merged
Conversation
Closed
The dispatcher retires audit rows and SETTLED webhook deliveries past ER_AUDIT_RETENTION_DAYS hourly, in convergent batches; the floor is clamped to 400 days in code so the infra D-RETENTION decision cannot be undercut by a values file (both the clamp and the pending-rows-stay rule were observed failing under mutation). Both audit feeds gain actor and half-open [since, until) filters and a format=csv arm whose cells are formula-guarded server-side; the projection regains the dataset column page.sql always selected. The org audit screen gets an Export CSV anchor through the BFF's injection-safe csv helpers, asserted in the functional tier.
athvin
marked this pull request as ready for review
November 8, 2026 19:01
athvin
force-pushed
the
issue/519-audit-store
branch
from
November 8, 2026 19:01
f48a869 to
33587c3
Compare
This was referenced Nov 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #519
What
E4's honest residue: retention and export semantics for the audit ledger, plus
the missing feed filters. A dispatcher retention sweep purges
audit_logandsettled
webhook_deliveriesrows pastER_AUDIT_RETENTION_DAYS(default 400,floor-clamped to 400 — the infra D-RETENTION compliance decision, enforced
rather than documented); both audit feeds gain
actor/since/untilfiltersand a
format=csvexport arm (the merge-plans pattern); the org audit screengains an Export CSV button through the BFF's injection-safe csv helper.
Why
E4's epic body names the residue precisely: "the specific DataGroomr audit
units, and retention and export semantics" (spec 5.21–5.24, 2.33; the log
browser and merge-audit fidelity are substantially built). 5.24's DoD is
"purge job documented and tested"; 5.23's export half is the CSV arm.
Proof
make checkgreen (exit 0) andmake frontendgreen (exit 0 — lint, types,authz, unit with the coverage floor, and the mock-backed Playwright functional
tier including the new export assertions).
pg_auditran for real underER_TEST_PG_DSN(dedicated Postgres on 5478): filters, the half-open window,both CSV arms, the purge, the pending-rows-stay rule and the convergent second
sweep. Two mutations observed failing: removing the CSV formula guard, and
removing the
state <> 'pending'conjunct from the delivery purge. The clampis unit-tested as a pure function (
retention_days_from).Risk & rollback
Post-merge ledger
Closed by: agent · session
93a44611-348c-4819-b503-ac48b5acd076onMac· 2026-11-08T19:40:00Zmainis green with this change on it — merge SHAb12514c0;rust,frontend,infra,devcontainer,imagesanddeployallcompleted success on that SHA itself.
imagesbuilt — completed success onb12514c0(rust andfrontend both changed).
deployconverged — run 42514196035: the new colour answereder-api-preview /readyz -> 200(its boot replayed the baseline, whichis what applies the new
audit_log_atindex) beforeCut overandRetire the old colourboth succeeded. The retention sweep is live butsilent in dev — the store is younger than 400 days, so a no-op sweep is
the correct observation.
deploysuccess (above);
driftandkindlatest runs success.Donethrough the automation (read backfrom the board) and E4 — Audit event store #519 closed
COMPLETEDby the merge — epic E4 done.(erweb.audit retention sweep, the app-tier store this PR could not
reach) and feat(ui): audit log-browser polish — filters, paging, live rows (spec 5.21/5.22) #898 (audit log-browser UI polish: filters, paging, detail).
and recurring-jobs list, and the infra D-RETENTION decision (now noting
the mechanical floor and the erweb.audit gap), all updated in this PR.
Specific to this change
Context — plan, discoveries, measurements, files
Plan
entities/audit_log:delete/purge_expired(batched subselect DELETE;description engages the append-only wording the way
entity_event/delete/by_rundoes), an[at]index (lands on live storesvia the boot's idempotent baseline replay — the reconciler does not diff
indexes),
actor/since/untilparams onread/page, and thedatasetcolumn restored to the API projection.
entities/webhook_delivery:delete/purge_expiredfor settled rows only (pending rows are never agedout — an undelivered webhook is work, not history).
pg.rs:audit_retention_days()(ER_AUDIT_RETENTION_DAYS, default400, CLAMPED to ≥400 with a loud warn — D-RETENTION made mechanical) +
purge_expired();dispatcher.rs: an hourly retention sweep tick (loudnon-fatal failure, the s3-tick discipline).
lib.rs:audit_feedparses the three new filters; both feeds gain aformat=csvarm (text/csv, bounded by the existing 500 limit, cellsformula-guarded — one better than
merge_plans_csv, which leaves that tothe BFF).
actor/since/until;format=csvre-rendered through
lib/bff/csv.tswith Content-Disposition (themerge-plans precedent —
forward()parses JSON).tenant-audit.tsx:an Export CSV anchor, asserted in the functional spec.
infra
D-RETENTIONgains the mechanical-purge note; regen entities-index.pg_audit.rs(one test, phases): filters, csv arm +formula-guard, purge (old gone / new stays / pending webhook row stays),
clamp observed (env 30 → 400 applied).
make check+make frontend.audit UI filters/paging/live updates (log-browser polish).
Discoveries
Measurements
Files