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

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

Context

Roadmap item: P3 -- API pagination

As the number of jobs and patent records grows, returning all results in a single response becomes impractical. Pagination is needed for scalability.

What to do

  • Implement cursor-based pagination (or offset-based as a simpler alternative) for GET /jobs and GET /analyze/batch.
  • Accept limit and cursor (or page/offset) query parameters.
  • Return a next_cursor (or next_page) field in the response envelope.
  • Update the frontend to load subsequent pages as the user scrolls or clicks "Load more".

Acceptance criteria

  • GET /jobs?limit=20 returns at most 20 results and a cursor for the next page.
  • Supplying the cursor in a subsequent request returns the correct next batch.
  • The frontend displays paginated job results without a full-page reload.
## Context Roadmap item: P3 -- API pagination As the number of jobs and patent records grows, returning all results in a single response becomes impractical. Pagination is needed for scalability. ## What to do - Implement cursor-based pagination (or offset-based as a simpler alternative) for `GET /jobs` and `GET /analyze/batch`. - Accept `limit` and `cursor` (or `page`/`offset`) query parameters. - Return a `next_cursor` (or `next_page`) field in the response envelope. - Update the frontend to load subsequent pages as the user scrolls or clicks "Load more". ## Acceptance criteria - [ ] `GET /jobs?limit=20` returns at most 20 results and a cursor for the next page. - [ ] Supplying the cursor in a subsequent request returns the correct next batch. - [ ] The frontend displays paginated job results without a full-page reload.
AI-Manager added the P3agent-readylargefeature labels 2026-03-30 18:24:22 +00:00
Author
Owner

Triage: Already resolved in main.

Cursor-based pagination is implemented for the /jobs endpoint in SPARC/api.py (around line 1047):

  • Accepts limit and cursor query parameters
  • Returns next_cursor field in PaginatedJobsResponse (line 94-98)
  • Cursor format is timestamp|job_id for stable ordering
  • Backwards-compatible: clients using only limit continue to work
  • Database layer supports list_jobs() with cursor parameter

Closing as complete.

**Triage: Already resolved in main.** Cursor-based pagination is implemented for the `/jobs` endpoint in `SPARC/api.py` (around line 1047): - Accepts `limit` and `cursor` query parameters - Returns `next_cursor` field in `PaginatedJobsResponse` (line 94-98) - Cursor format is `timestamp|job_id` for stable ordering - Backwards-compatible: clients using only `limit` continue to work - Database layer supports `list_jobs()` with cursor parameter 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#1418