[Ops] Add pagination to list endpoints #99
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Context
No list endpoint in the backend paginates: sessions, members, votes, lore/wiki entry lists, milestones, analytics, and
/api/bot/sessions/upcoming(webapp/backend/app/routers/bot.py:76) all return full result sets in one response.Motivation
Fine today at friendly-group scale; unbounded as campaigns accumulate years of sessions and hundreds of wiki entries. Response sizes and query times grow without limit, and the failure mode arrives gradually rather than as an obvious error.
Fix / Spec
limit/offsetquery params (defaultlimit=200, max500;offsetdefault 0) to the campaign-scoped list endpoints (sessions, members, lore/wiki lists, milestones, analytics lists) and/api/bot/sessions/upcoming.X-Total-Countresponse header or an{"items": [...], "total": n}envelope — apply it uniformly to every paginated endpoint, and document it indocs/API.md. (Envelope is a response-shape change; header is fully backward compatible — weigh that in the choice.)ORDER BY(e.g. created_at + id tiebreaker) so pages don't shuffle.limit/offsetthrough where a page could realistically exceed the default — wiki entry lists and session lists. A simple "load more" button is sufficient; no full pager UI.Acceptance criteria
limit/offsetwith stable ordering (test: two pages, no overlap/gap).limitabove the max is clamped to 500; invalid values → 422.docs/API.mddocuments the params and the chosen total-count convention.References
webapp/backend/app/routers/bot.py:76(/bot/sessions/upcoming)webapp/backend/app/routers/sessions.py,webapp/backend/app/routers/campaigns.py(list endpoints)docs/API.mdFiled from the July 2026 full-project review.