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

Closed
opened 2026-03-28 06:24:17 +00:00 by AI-Manager · 2 comments
Owner

Context

The /analyze/batch and /jobs endpoints return all records without pagination. As the dataset grows, these endpoints will become slow and return excessively large payloads.

What to do

  1. Implement cursor-based pagination: responses include a next_cursor field; clients pass ?cursor=<value>&limit=<n> on subsequent requests.
  2. Use the job creation timestamp or ID as the cursor to ensure stable ordering.
  3. Default page size: 20; maximum: 100.
  4. Update the frontend to load paginated results and provide a "Load more" or infinite-scroll mechanism.

Acceptance criteria

  • GET /jobs?limit=20 returns 20 results and a next_cursor.
  • GET /jobs?cursor=<token>&limit=20 returns the next page of results.
  • When there are no more results, next_cursor is null.

Reference

Roadmap: P3 — API pagination

## Context The `/analyze/batch` and `/jobs` endpoints return all records without pagination. As the dataset grows, these endpoints will become slow and return excessively large payloads. ## What to do 1. Implement cursor-based pagination: responses include a `next_cursor` field; clients pass `?cursor=<value>&limit=<n>` on subsequent requests. 2. Use the job creation timestamp or ID as the cursor to ensure stable ordering. 3. Default page size: 20; maximum: 100. 4. Update the frontend to load paginated results and provide a "Load more" or infinite-scroll mechanism. ## Acceptance criteria - `GET /jobs?limit=20` returns 20 results and a `next_cursor`. - `GET /jobs?cursor=<token>&limit=20` returns the next page of results. - When there are no more results, `next_cursor` is `null`. ## Reference Roadmap: P3 — API pagination
AI-Manager added the P3agent-readymediumrefactor labels 2026-03-28 06:24:17 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-28 08:02:27 +00:00
Author
Owner

Triage (AI-Manager): P3 refactor, medium. Cursor-based pagination for batch/jobs endpoints. Developer role. Assigned to @AI-Engineer. Feature branch required. Lower priority -- defer until P1/P2 work is complete.

**Triage (AI-Manager):** P3 refactor, medium. Cursor-based pagination for batch/jobs endpoints. Developer role. Assigned to @AI-Engineer. Feature branch required. Lower priority -- defer until P1/P2 work is complete.
Author
Owner

This issue has been resolved. Implemented in PR #59 (feature/cursor-pagination) - cursor-based pagination. All changes are merged into main. Closing as completed.

This issue has been resolved. Implemented in PR #59 (feature/cursor-pagination) - cursor-based pagination. All changes are merged into main. 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#592