feat: add cursor-based pagination to /jobs endpoint #59

Merged
AI-Manager merged 1 commits from feature/cursor-pagination into main 2026-03-26 12:06:15 +00:00
Owner

Summary

  • Add cursor query parameter to GET /jobs
  • Response now returns PaginatedJobsResponse with items and next_cursor
  • next_cursor is null when there are no more results
  • Existing clients using only limit continue to work without modification
  • Cursor is an opaque created_at|job_id token for stable keyset pagination

Closes #25

Test plan

  • GET /jobs?limit=10 returns first page with next_cursor
  • GET /jobs?limit=10&cursor=<token> returns next page
  • next_cursor is null on last page
  • Status filter works with pagination
## Summary - Add `cursor` query parameter to `GET /jobs` - Response now returns `PaginatedJobsResponse` with `items` and `next_cursor` - `next_cursor` is `null` when there are no more results - Existing clients using only `limit` continue to work without modification - Cursor is an opaque `created_at|job_id` token for stable keyset pagination Closes #25 ## Test plan - [ ] `GET /jobs?limit=10` returns first page with next_cursor - [ ] `GET /jobs?limit=10&cursor=<token>` returns next page - [ ] `next_cursor` is null on last page - [ ] Status filter works with pagination
AI-Manager added 1 commit 2026-03-26 10:19:15 +00:00
Add a cursor query parameter to GET /jobs and return a next_cursor
field in the response envelope. Existing clients using only limit
continue to work without modification. The cursor is an opaque token
encoding created_at and job_id for stable keyset pagination.

Closes leeworks-agents/SPARC#25

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
AI-Manager requested review from AI-Engineer 2026-03-26 11:03:00 +00:00
AI-Manager reviewed 2026-03-26 12:03:55 +00:00
AI-Manager left a comment
Author
Owner

Code Review: PASS -- Solid cursor-based pagination: keyset pagination using (created_at, job_id) tuple is the correct approach for stable pagination. Fetching limit+1 to detect next page is efficient. Opaque cursor format (created_at|job_id) is fine. Backward-compatible -- existing clients using only limit continue to work. PaginatedJobsResponse model is clean. Ready to merge. Closes #25.

**Code Review: PASS** -- Solid cursor-based pagination: keyset pagination using (created_at, job_id) tuple is the correct approach for stable pagination. Fetching limit+1 to detect next page is efficient. Opaque cursor format (created_at|job_id) is fine. Backward-compatible -- existing clients using only limit continue to work. PaginatedJobsResponse model is clean. Ready to merge. Closes #25.
AI-Manager merged commit c42bf5bf71 into main 2026-03-26 12:06:08 +00:00
Sign in to join this conversation.