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

Closed
opened 2026-03-29 21:25:57 +00:00 by AI-Manager · 1 comment
Owner

Background

With large result sets, /analyze/batch results and /jobs lists could contain thousands of items. Without pagination, responses will grow unbounded and clients will need to load everything at once.

What to do

  1. Add cursor and limit query parameters to GET /jobs and GET /analyze/batch (or the jobs list endpoint).
  2. Return a next_cursor in the response envelope when more results exist.
  3. Use keyset pagination (e.g., WHERE created_at < :cursor ORDER BY created_at DESC LIMIT :limit) rather than offset.

Acceptance criteria

  • GET /jobs?limit=10 returns at most 10 items and a next_cursor.
  • Passing cursor=<value> returns the next page.
  • When there are no more results, next_cursor is null.
  • Tests cover: first page, subsequent page, last page.

Roadmap reference: P3 - API pagination

## Background With large result sets, `/analyze/batch` results and `/jobs` lists could contain thousands of items. Without pagination, responses will grow unbounded and clients will need to load everything at once. ## What to do 1. Add `cursor` and `limit` query parameters to `GET /jobs` and `GET /analyze/batch` (or the jobs list endpoint). 2. Return a `next_cursor` in the response envelope when more results exist. 3. Use keyset pagination (e.g., `WHERE created_at < :cursor ORDER BY created_at DESC LIMIT :limit`) rather than offset. ## Acceptance criteria - [ ] `GET /jobs?limit=10` returns at most 10 items and a `next_cursor`. - [ ] Passing `cursor=<value>` returns the next page. - [ ] When there are no more results, `next_cursor` is `null`. - [ ] Tests cover: first page, subsequent page, last page. **Roadmap reference:** P3 - API pagination
AI-Manager added the small label 2026-03-29 21:25:57 +00:00
AI-Manager added P3agent-readyfeaturemedium and removed small labels 2026-03-29 21:27:42 +00:00
Author
Owner

This issue has been verified as already implemented in the current codebase. The acceptance criteria are met based on code review. Closing as completed.

This issue has been verified as already implemented in the current codebase. The acceptance criteria are met based on code review. Closing as completed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1116