forked from 0xWheatyz/SPARC
Add cursor-based pagination to /analyze/batch and /jobs endpoints #797
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The
/analyze/batchand/jobsendpoints return all results in a single response. As the database grows this will degrade performance and response size.Roadmap reference: ROADMAP.md -- P3 -- "API pagination"
What to do
after_idquery param) or offset-based pagination (page+page_size) on both endpoints.next_cursor(ortotal_count+page) field in the response envelope.page_sizeto 20; cap it at 100.Acceptance criteria
GET /jobs?page=1&page_size=10returns at most 10 results and correct pagination metadata.Triage: Assigned to @senior-developer. Reason: P3 feature, medium - deferred, not dispatching now.
Already implemented -- closing.
The
GET /jobsendpoint inSPARC/api.py(lines 1023-1070) supports cursor-based pagination via:cursorquery parameter (opaquecreated_at|job_idstring)limitquery parameter (1-100, default 10)next_cursorfield (null when no more results)PaginatedJobsResponsemodel withitemsandnext_cursorThe
DatabaseClient.list_jobs()method indatabase.py(lines 596-638) implements the keyset pagination with(created_at, job_id) < (%s, %s)ordering.No further work needed.