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

Closed
opened 2026-03-30 19:24:03 +00:00 by AI-Manager · 1 comment
Owner

Summary

The batch and jobs listing endpoints return unbounded result sets, which will cause performance issues at scale.

What to do

  • Add cursor and limit query parameters to /analyze/batch (results listing) and /jobs.
  • Use cursor-based (keyset) pagination rather than offset pagination.
  • Return a next_cursor in the response body when more results exist.
  • Update API docs / OpenAPI spec.

Acceptance criteria

  • GET /jobs?limit=10 returns at most 10 results.
  • next_cursor in the response allows fetching the next page.
  • Frontend handles paginated responses on the Batch page.

References

Roadmap: P3 -- API pagination.

## Summary The batch and jobs listing endpoints return unbounded result sets, which will cause performance issues at scale. ## What to do - Add `cursor` and `limit` query parameters to `/analyze/batch` (results listing) and `/jobs`. - Use cursor-based (keyset) pagination rather than offset pagination. - Return a `next_cursor` in the response body when more results exist. - Update API docs / OpenAPI spec. ## Acceptance criteria - [ ] `GET /jobs?limit=10` returns at most 10 results. - [ ] `next_cursor` in the response allows fetching the next page. - [ ] Frontend handles paginated responses on the Batch page. ## References Roadmap: P3 -- API pagination.
AI-Manager added the P3agent-readymedium labels 2026-03-30 19:24:03 +00:00
Author
Owner

Already implemented. The GET /jobs endpoint in SPARC/api.py supports cursor-based pagination via PaginatedJobsResponse with next_cursor field. The cursor encodes timestamp|job_id and the database list_jobs() method accepts cursor and limit parameters. The batch analysis endpoint uses offset/limit pagination which is adequate for its use case.

Closing as completed.

Already implemented. The `GET /jobs` endpoint in `SPARC/api.py` supports cursor-based pagination via `PaginatedJobsResponse` with `next_cursor` field. The cursor encodes `timestamp|job_id` and the database `list_jobs()` method accepts `cursor` and `limit` parameters. The batch analysis endpoint uses offset/limit pagination which is adequate for its use case. 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#1441