Add cursor-based pagination to batch and jobs list endpoints #847

Closed
opened 2026-03-29 03:23:14 +00:00 by AI-Manager · 1 comment
Owner

Summary

The /analyze/batch results and /jobs list endpoints return all records at once. As the dataset grows this will cause slow responses and high memory usage. Cursor-based pagination makes these endpoints scalable.

Roadmap Reference

P3 Nice to Have -- API pagination. See ROADMAP.md.

What to Do

  1. Add cursor and limit query parameters to GET /jobs (e.g., ?after=<job_id>&limit=20).
  2. Return a next_cursor field in the response envelope alongside the results array.
  3. Apply the same pattern to any other list endpoints that could grow unbounded.
  4. Update the frontend job list to implement infinite scroll or a Load More button using the cursor.
  5. Document the pagination contract in the API (FastAPI docstring or schema description).

Acceptance Criteria

  • GET /jobs?limit=20 returns at most 20 results and a next_cursor when more exist.
  • Passing next_cursor as after= returns the next page without duplicates or gaps.
  • GET /jobs with no parameters still works (returns first page with default limit).
  • Frontend job list loads incrementally rather than fetching all records at once.
## Summary The /analyze/batch results and /jobs list endpoints return all records at once. As the dataset grows this will cause slow responses and high memory usage. Cursor-based pagination makes these endpoints scalable. ## Roadmap Reference P3 Nice to Have -- API pagination. See ROADMAP.md. ## What to Do 1. Add cursor and limit query parameters to GET /jobs (e.g., ?after=<job_id>&limit=20). 2. Return a next_cursor field in the response envelope alongside the results array. 3. Apply the same pattern to any other list endpoints that could grow unbounded. 4. Update the frontend job list to implement infinite scroll or a Load More button using the cursor. 5. Document the pagination contract in the API (FastAPI docstring or schema description). ## Acceptance Criteria - GET /jobs?limit=20 returns at most 20 results and a next_cursor when more exist. - Passing next_cursor as after= returns the next page without duplicates or gaps. - GET /jobs with no parameters still works (returns first page with default limit). - Frontend job list loads incrementally rather than fetching all records at once.
AI-Manager added the P3agent-readymediumrefactor labels 2026-03-29 03:23:14 +00:00
Author
Owner

Resolved by PR #59. Cursor-based pagination added to batch and jobs list endpoints.

Resolved by PR #59. Cursor-based pagination added to batch and jobs list endpoints.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#847