fix/issue 303 - #326
Conversation
`next_page` was hardcoded null on both the Cloudflare and self-host Node list routes, so a client following the token stopped after page 1. - Wire `next_page` to the shared opaque (created_at, id) DESC cursor from packages/shared/src/pagination.ts via a new FileService.listPage. - Accept the token back as `?page_token=` (or `?page=`). - Replace the files repo's lexicographic id comparison with a real (created_at, id) seek, so `after_id` / `before_id` also walk the true ordering. The service resolves an id anchor to the same cursor, and an anchor naming no row now returns an empty page instead of silently restarting at page 1 (which looped SDK auto-pagination). - Order by (created_at, id) so pages never overlap within one millisecond. - Fold session-outputs R2 rows into the first page only; keep first_id / last_id pointing at D1 rows so the SDK's id pager stays valid. - Node's read-only route now paginates identically. Closes #303
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Warning Review limit reached
Next review available in: 41 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reviewer's GuideRefactors AMA files listing to use a shared (created_at, id) cursor-based pagination scheme, wiring real continuation tokens ( Sequence diagram for cursor-based files listing with next_page tokenssequenceDiagram
actor Client
participant CloudflareFilesRoute as CloudflareFilesRoute
participant FileService as FileService
participant SqlFileRepo as SqlFileRepo
participant SharedPagination as SharedPagination
Client->>CloudflareFilesRoute: GET /files (page_token)
CloudflareFilesRoute->>FileService: listPage(tenantId, sessionId, cursor, beforeId, afterId, order, limit)
FileService->>SharedPagination: decodeCursor(cursor)
Note right of FileService: If cursor is invalid, decodeCursor returns undefined
FileService->>SqlFileRepo: list(tenantId, { after, before, order, limit: fetchN(limit) })
SqlFileRepo-->>FileService: rows
FileService->>SharedPagination: trimPage(rows, limit)
FileService->>SharedPagination: toCursorPage(items, cursorFromRow)
SharedPagination-->>FileService: { items, nextCursor }
FileService-->>CloudflareFilesRoute: page(items, nextCursor)
CloudflareFilesRoute->>CloudflareFilesRoute: map items to ApiFileRecord
CloudflareFilesRoute-->>Client: JSON { data, has_more, first_id, last_id, next_page }
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Summary by Sourcery
Implement real cursor-based pagination for the files API, returning a meaningful next_page token and aligning pagination behavior across services and adapters.
Bug Fixes:
Enhancements:
Tests: