fix: Send the page cursor when the request has no parameters - #1003
Open
razor-x wants to merge 4 commits into
Open
fix: Send the page cursor when the request has no parameters#1003razor-x wants to merge 4 commits into
razor-x wants to merge 4 commits into
Conversation
The paginator only attached page_cursor to the next page request when the original request had non-null params or body. Every generated list route has optional parameters, so paginating a route called with no arguments re-sent the first page request forever: an infinite request loop and unbounded memory growth in flattenToArray. Build the next page request data unconditionally, choosing params or body by the request method. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B8xeJm2Hd923k8uo6eoFd2
This was referenced Aug 24, 2026
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B8xeJm2Hd923k8uo6eoFd2
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B8xeJm2Hd923k8uo6eoFd2
…x115l-c3-paginator-cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
SDK audit finding C3 (critical, runtime-verified):
SeamPaginatoronly attachedpage_cursorto the next-page request when the original request'sparams/bodywas non-null. Every generated list route makes its parameters optional, soseam.createPaginator(seam.devices.list())re-sends page 1 forever:Against the real API this is an infinite request loop and, via
flattenToArray(), unbounded memory. Every existing paginator test passed{ limit: 1 }— exactly the input that hides the bug.Fix
Build the next-page request data unconditionally, choosing
paramsvsbodyby the request method (GET/DELETE→ query params, otherwise body) — the same rule codegen uses for the original request.Tests
New nock-controlled test: a no-argument
devices.list()paginator must sendpage_cursoron the page-2 request and terminate. Verified per the audit-notes recipe: with the source fix reverted, the test fails with the audit's exact symptom (page-2 request goes out with no cursor and never matches); with the fix, the full suite (126 tests), lint, and typecheck are green.Part of applying the rev-3 SDK audit (one PR per finding, mirroring seamapi/php#465–#479). Related: #1002.
🤖 Generated with Claude Code
https://claude.ai/code/session_01B8xeJm2Hd923k8uo6eoFd2
Generated by Claude Code