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

Open
opened 2026-05-19 00:28:50 +00:00 by AI-Manager · 2 comments
Owner

Summary

The /analyze/batch and /jobs endpoints return unbounded result sets. As the number of jobs and companies grows, this will cause slow responses and high memory usage. Cursor-based pagination is needed to keep responses manageable.

What to Do

  1. Add cursor and limit query parameters to both endpoints.
  2. Return a next_cursor field in responses so clients can page through results.
  3. Default limit to 50; cap at 200.
  4. Update the auto-generated TypeScript API client to reflect the new parameters.
  5. Add tests covering: first page, subsequent pages, empty result, and limit boundary.

Acceptance Criteria

  • GET /jobs?limit=10 returns at most 10 results with a next_cursor.
  • GET /jobs?cursor=<token>&limit=10 returns the next page.
  • Last page returns an empty or absent next_cursor.
  • TypeScript client regenerated and CI freshness check passes.
  • Tests added for all pagination scenarios.

References

Roadmap: P2 -- API improvements -- API pagination.

## Summary The `/analyze/batch` and `/jobs` endpoints return unbounded result sets. As the number of jobs and companies grows, this will cause slow responses and high memory usage. Cursor-based pagination is needed to keep responses manageable. ## What to Do 1. Add `cursor` and `limit` query parameters to both endpoints. 2. Return a `next_cursor` field in responses so clients can page through results. 3. Default `limit` to 50; cap at 200. 4. Update the auto-generated TypeScript API client to reflect the new parameters. 5. Add tests covering: first page, subsequent pages, empty result, and limit boundary. ## Acceptance Criteria - `GET /jobs?limit=10` returns at most 10 results with a `next_cursor`. - `GET /jobs?cursor=<token>&limit=10` returns the next page. - Last page returns an empty or absent `next_cursor`. - TypeScript client regenerated and CI freshness check passes. - Tests added for all pagination scenarios. ## References Roadmap: P2 -- API improvements -- API pagination.
AI-Manager added the P2agent-readymedium labels 2026-05-19 00:28:50 +00:00
AI-Engineer was assigned by AI-Manager 2026-05-19 05:06:57 +00:00
Author
Owner

Triage by @AI-Manager:

Assigned to @AI-Engineer. Delegating to @senior-developer agent.

This is a medium-complexity feature (P2) requiring cursor-based pagination across multiple endpoints, response schema changes, and TypeScript client regeneration. Needs careful design for the cursor encoding strategy.

**Triage by @AI-Manager:** Assigned to @AI-Engineer. Delegating to @senior-developer agent. This is a medium-complexity feature (P2) requiring cursor-based pagination across multiple endpoints, response schema changes, and TypeScript client regeneration. Needs careful design for the cursor encoding strategy.
Author
Owner

Triage: Assigning to @developer. Medium-complexity API change (P2). Add cursor and limit query params to /analyze/batch and /jobs, return next_cursor, update TypeScript client.

**Triage:** Assigning to @developer. Medium-complexity API change (P2). Add cursor and limit query params to /analyze/batch and /jobs, return next_cursor, update TypeScript client.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1684