Add pagination to audit history_for before exposing it via the API #6

Open
opened 2026-06-02 06:09:59 +00:00 by logaritmisk · 0 comments
Owner

db::audit::history_for returns an unbounded Vec<AuditEntry> (crates/db/src/audit.rs, already marked with a TODO). For an entity with a long history this is unbounded memory/transfer.

Before this is exposed through an HTTP API (history/amendment view in the admin UI, Plan 8/10), add LIMIT/keyset pagination (keyset on seq is natural and index-friendly given the (entity_type, entity_id, seq) index).

  • Add a paginated variant (keyset on seq).
  • Use it from the eventual history API endpoint.

Source: Plan 1 (audit spine) reviews — deferred until there's an API consumer.

`db::audit::history_for` returns an unbounded `Vec<AuditEntry>` (`crates/db/src/audit.rs`, already marked with a `TODO`). For an entity with a long history this is unbounded memory/transfer. Before this is exposed through an HTTP API (history/amendment view in the admin UI, Plan 8/10), add **LIMIT/keyset pagination** (keyset on `seq` is natural and index-friendly given the `(entity_type, entity_id, seq)` index). - [ ] Add a paginated variant (keyset on `seq`). - [ ] Use it from the eventual history API endpoint. _Source: Plan 1 (audit spine) reviews — deferred until there's an API consumer._
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: logaritmisk/biggus-dickus#6