forked from 0xWheatyz/SPARC
Add cursor-based pagination to /analyze/batch and /jobs endpoints #1693
Open
AI-Manager
wants to merge 1 commits from
feature/1684-cursor-pagination into main
pull from: feature/1684-cursor-pagination
merge into: leeworks-agents:main
leeworks-agents:main
leeworks-agents:feature/multi-tenant-isolation
leeworks-agents:feature/historical-analysis-diff
leeworks-agents:feature/1686-rate-limit-dashboard
leeworks-agents:feature/patent-classification-tags
leeworks-agents:feature/webhook-task-queue
leeworks-agents:feature/1674-batch-export-zip
leeworks-agents:feature/1685-stricter-company-name-validation
leeworks-agents:feature/api-key-auth
leeworks-agents:feature/1675-rate-limit-admin
leeworks-agents:feature/1669-cursor-pagination
leeworks-agents:feature/1670-company-name-validation
leeworks-agents:feature/1678-update-roadmap
leeworks-agents:feature/1656-tracked-company-admin-tests
leeworks-agents:feature/1661-analyze-single-patent-tests
leeworks-agents:feature/1660-s3-storage-tests
leeworks-agents:feature/1659-update-roadmap
leeworks-agents:feature/1658-scheduler-pooled-db
leeworks-agents:feature/1657-webhook-integration-tests
leeworks-agents:feature/1655-export-endpoint-tests
leeworks-agents:feature/1605-dark-mode
leeworks-agents:feature/1624-jwt-auth-tests
leeworks-agents:feature/1559-1560-enable-ci-linting-and-tests
leeworks-agents:feature/docs-patent-volume-mount
leeworks-agents:feature/1324-dark-mode-variants
leeworks-agents:feature/1013-multi-model
leeworks-agents:feature/426-generate-ts-api-client
leeworks-agents:feature/351-frontend-model-picker
leeworks-agents:feature/343-batch-loading-states
leeworks-agents:feature/env-example-updates
leeworks-agents:feature/260-tsc-ci
leeworks-agents:feature/export-pdf
leeworks-agents:feature/multi-model
leeworks-agents:feature/openapi-client-gen
leeworks-agents:feature/trend-charts
leeworks-agents:feature/compare-view
leeworks-agents:feature/s3-storage
leeworks-agents:feature/webhooks
leeworks-agents:feature/scheduled-analysis
leeworks-agents:feature/export-csv
leeworks-agents:feature/cursor-pagination
leeworks-agents:feature/dark-mode
leeworks-agents:feature/loading-error-states
leeworks-agents:feature/fix-single-patent-download
leeworks-agents:feature/structured-logging
leeworks-agents:feature/ci-tsc-lint
leeworks-agents:feature/ci-testing-linting
leeworks-agents:feature/db-client-pooling
leeworks-agents:feature/p2-config-improvements
leeworks-agents:feature/jwt-auth-tests
leeworks-agents:feature/persist-job-state
leeworks-agents:feature/p2-docs-and-lockfile
leeworks-agents:feature/rate-limiting
leeworks-agents:feature/p1-security-hardening
leeworks-agents:chore/add-roadmap
No Reviewers
Labels
Clear labels
P1
P2
P3
agent-ready
bug
bug-fix
ci
config
deploy-ready
deploy-ready
docs
feature
frontend
infra
large
medium
refactor
security
small
test
testing
Critical priority
Medium priority
Low priority
Ready for agent to work on
Something is not working correctly
Documentation improvement
New feature or enhancement
CI/CD, build, config, infrastructure
Large complexity (2+ hours)
Medium complexity (1-2 hours)
Code quality and refactoring
Security-related issue
Small complexity (< 1 hour)
Test coverage issues
No Label
Milestone
No items
No Milestone
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: leeworks-agents/SPARC#1693
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "feature/1684-cursor-pagination"
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?
Summary
Fixes issue #1684. Adds cursor-based pagination to
GET /analyze/batchandGET /jobsendpoints, updates the TypeScript API client, and expands the test suite.Changes
GET /analyze/batchwas incorrectly shadowed byGET /analyze/{company_name}due to route registration order. MovedGET /analyze/batchto be registered first so requests are routed correctly.schema.d.ts: AddedAnalysisRecord,PaginatedAnalysisResponse,PaginatedJobsResponseschemas; addedGET /analyze/batchoperation withcursor,limit, andcompany_nameparams; updatedlist_jobs_jobs_getto includecursorparam and returnPaginatedJobsResponse.client.ts: AddedlistBatchAnalyses(companyName?, limit?, cursor?)method; updatedlistJobs()to acceptcursorand returnPaginatedJobsResponse; default limit updated from 10 to 50.types/index.ts: ExportedAnalysisRecord,PaginatedAnalysisResponse,PaginatedJobsResponse.tests/test_pagination.py: Fixed tests to use JWT auth headers; added 11 new/jobstests covering first page, last page, subsequent pages, empty results, status filter, limit boundaries, cursor forwarding, and paginated response shape.Acceptance Criteria Met
GET /jobs?limit=10returns at most 10 results with anext_cursorGET /jobs?cursor=<token>&limit=10returns the next pagenext_cursorCloses leeworks-agents/SPARC#1684
- Fix route ordering bug: GET /analyze/batch was shadowed by GET /analyze/{company_name} causing all GET requests to /analyze/batch to be erroneously handled as single-company analysis (503). Move /analyze/batch GET registration to before the {company_name} route. - Update TypeScript schema.d.ts: add AnalysisRecord, PaginatedAnalysisResponse, PaginatedJobsResponse schemas; add GET /analyze/batch operation with cursor+limit+company_name params; update list_jobs_jobs_get to include cursor param and return PaginatedJobsResponse. - Update frontend/src/api/client.ts: add listBatchAnalyses() method with cursor/limit support; update listJobs() to accept cursor and return PaginatedJobsResponse; default limit changed from 10 to 50. - Update frontend/src/types/index.ts: export AnalysisRecord, PaginatedAnalysisResponse, PaginatedJobsResponse. - Expand tests/test_pagination.py: add auth fixture so tests pass JWT validation; add 11 new /jobs tests covering first page, last page, subsequent pages, empty results, status filter, limit boundaries, cursor forwarding, and paginated response shape. Closes leeworks-agents/SPARC#1684 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.