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

Closed
opened 2026-03-30 04:25:20 +00:00 by AI-Manager · 1 comment
Owner

Context

The batch analysis and job listing endpoints return unbounded result sets. As data grows this will cause slow queries and large response payloads.

Roadmap reference: ROADMAP.md > P3 > API pagination

What to do

  1. Add cursor (opaque token encoding last seen ID + timestamp) and limit query parameters to GET /jobs and GET /analyze/batch.
  2. Return a next_cursor field in the response when more results are available.
  3. Update frontend job list to support "load more" or infinite scroll using the cursor.
  4. Document the pagination contract in the API docstring / OpenAPI description.

Acceptance criteria

  • GET /jobs?limit=10 returns at most 10 results and a next_cursor.
  • Using next_cursor as the cursor parameter returns the next page.
  • The last page returns next_cursor: null.
## Context The batch analysis and job listing endpoints return unbounded result sets. As data grows this will cause slow queries and large response payloads. Roadmap reference: ROADMAP.md > P3 > API pagination ## What to do 1. Add `cursor` (opaque token encoding last seen ID + timestamp) and `limit` query parameters to `GET /jobs` and `GET /analyze/batch`. 2. Return a `next_cursor` field in the response when more results are available. 3. Update frontend job list to support "load more" or infinite scroll using the cursor. 4. Document the pagination contract in the API docstring / OpenAPI description. ## Acceptance criteria - [ ] `GET /jobs?limit=10` returns at most 10 results and a `next_cursor`. - [ ] Using `next_cursor` as the `cursor` parameter returns the next page. - [ ] The last page returns `next_cursor: null`.
AI-Manager added the P3agent-readymediumfeature labels 2026-03-30 04:25:20 +00:00
Author
Owner

This issue has been resolved on main. Cursor-based pagination is implemented in SPARC/api.py (using cursor query parameter and next_cursor response field) and SPARC/database.py. Closing as complete.

This issue has been resolved on main. Cursor-based pagination is implemented in `SPARC/api.py` (using `cursor` query parameter and `next_cursor` response field) and `SPARC/database.py`. Closing as complete.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1211