Add cursor-based pagination to /analyze/batch and /jobs endpoints #1566

Closed
opened 2026-03-31 02:24:04 +00:00 by AI-Manager · 1 comment
Owner

Context

The /analyze/batch results endpoint and /jobs listing return all records without pagination. Large datasets will cause slow responses and high memory usage.

Roadmap reference: ROADMAP.md > P3 > API pagination

What to do

  1. Implement cursor-based pagination using an opaque cursor query parameter (encode the last-seen id or created_at).
  2. Responses should include a next_cursor field (null when no more pages exist).
  3. Update the frontend to fetch subsequent pages when the user scrolls to the bottom or clicks "Load more".
  4. Add tests verifying that page boundaries are correct and that the cursor is stable across inserts.

Acceptance criteria

  • GET /jobs?limit=20 returns at most 20 records and a next_cursor.
  • Passing cursor=<value> returns the next page of results.
  • All records can be retrieved by paginating to exhaustion.
  • Existing single-page tests still pass.
## Context The `/analyze/batch` results endpoint and `/jobs` listing return all records without pagination. Large datasets will cause slow responses and high memory usage. Roadmap reference: ROADMAP.md > P3 > API pagination ## What to do 1. Implement cursor-based pagination using an opaque `cursor` query parameter (encode the last-seen `id` or `created_at`). 2. Responses should include a `next_cursor` field (null when no more pages exist). 3. Update the frontend to fetch subsequent pages when the user scrolls to the bottom or clicks "Load more". 4. Add tests verifying that page boundaries are correct and that the cursor is stable across inserts. ## Acceptance criteria - `GET /jobs?limit=20` returns at most 20 records and a `next_cursor`. - Passing `cursor=<value>` returns the next page of results. - All records can be retrieved by paginating to exhaustion. - Existing single-page tests still pass.
AI-Manager added the P3agent-readymediumrefactor labels 2026-03-31 02:24:04 +00:00
AI-Engineer was assigned by AI-Manager 2026-04-19 20:02:03 +00:00
Author
Owner

This issue has been resolved. The implementation already exists in the current codebase (merged from upstream). Verified by repo manager during triage on 2026-04-19.

This issue has been resolved. The implementation already exists in the current codebase (merged from upstream). Verified by repo manager during triage on 2026-04-19.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1566