Paginate repository list endpoints before exposing them via the API #10

Open
opened 2026-06-02 07:44:58 +00:00 by logaritmisk · 1 comment
Owner

Several repository list functions return an unbounded Vec:

  • catalog::list_objects (crates/db/src/catalog.rs) — already carries a TODO.
  • vocab::list_terms (crates/db/src/vocab.rs).
  • authority::list_by_kind (crates/db/src/authority.rs).

(Audit's history_for is tracked separately in #6.)

Before any of these is exposed through the HTTP API (admin UI in Plan 10, public API in Plan 7), add LIMIT / keyset pagination — keyset on the existing ORDER BY column is natural and index-friendly (object_number for objects; id/seq elsewhere). Unbounded lists are fine at the repository layer with no API consumer, but must be bounded before the API lands.

Source: Plan 3 (catalogue core) final review — deferred until there's an API consumer.

Several repository list functions return an unbounded `Vec`: - `catalog::list_objects` (`crates/db/src/catalog.rs`) — already carries a `TODO`. - `vocab::list_terms` (`crates/db/src/vocab.rs`). - `authority::list_by_kind` (`crates/db/src/authority.rs`). (Audit's `history_for` is tracked separately in #6.) Before any of these is exposed through the HTTP API (admin UI in Plan 10, public API in Plan 7), add **LIMIT / keyset pagination** — keyset on the existing `ORDER BY` column is natural and index-friendly (`object_number` for objects; `id`/`seq` elsewhere). Unbounded lists are fine at the repository layer with no API consumer, but must be bounded before the API lands. _Source: Plan 3 (catalogue core) final review — deferred until there's an API consumer._
Author
Owner

Scope note from the admin-CRUD work (merged main @ c4e0c4c): the object list endpoint is paginated (db::catalog::list_objects_paged + count_objects, exposed as GET /api/admin/objects with limit/offset/total). However three new admin list endpoints return all rows unpaginated:

  • GET /api/admin/field-definitions (db::fields::list_field_definitions)
  • GET /api/admin/vocabularies/{id}/terms (db::vocab::list_terms)
  • GET /api/admin/authorities?kind= (db::authority::list_by_kind)

These are small, bounded sets today (and list_vocabularies likewise), so leaving them unpaginated is acceptable for now — but they fall under this issue and should be paginated if/when they can grow large.

Scope note from the admin-CRUD work (merged `main` @ `c4e0c4c`): the object list endpoint **is** paginated (`db::catalog::list_objects_paged` + `count_objects`, exposed as `GET /api/admin/objects` with limit/offset/total). However three new admin **list** endpoints return all rows unpaginated: - `GET /api/admin/field-definitions` (`db::fields::list_field_definitions`) - `GET /api/admin/vocabularies/{id}/terms` (`db::vocab::list_terms`) - `GET /api/admin/authorities?kind=` (`db::authority::list_by_kind`) These are small, bounded sets today (and `list_vocabularies` likewise), so leaving them unpaginated is acceptable for now — but they fall under this issue and should be paginated if/when they can grow large.
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#10