feat(sdk): paginate list_applications - #1152
Draft
hanchchch wants to merge 1 commit into
Draft
Conversation
ListApplications is getting page_size/page_token/next_page_token so the server can stop hydrating and serialising an unbounded number of application revisions (VUL-1330 -- this OOM-killed the isolate-cloud grpc pods on 2026-08-21). list_applications now walks next_page_token until it is unset, so callers keep the previous "everything" semantics and `fal apps revisions` keeps working unchanged. page_size is optional and only tunes the request size; the server applies its own default and ceiling. Two subtleties the tests pin down: a short page is not the last page (only an absent token is), and a server that keeps returning the same cursor must not spin the client forever. Requires isolate_proto >= 0.34.3; the pin bump follows once that is released. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Why
ListApplicationsreturns one entry per application revision, and one production account currently has 547k of them. With no pagination andgrpc.max_send_message_length = -1on the server, a single call hydrates and serialises an unbounded result set — which OOM-killed the isolate-cloudgrpcpods on 2026-08-21 (VUL-1330 / INFRA-4247).#1151 adds the wire fields. This PR makes the SDK use them.
What
FalServerlessConnection.list_applicationsnow followsnext_page_tokenuntil it is unset.list[ApplicationInfo]containing every revision, sofal apps revisions(the only caller) is unchanged.page_sizeis optional and only tunes the request size — the server applies its own default and ceiling, so omitting it is safe.Two subtleties the tests pin down:
next_page_tokenends the walk; the server may return fewer rows thanpage_sizeand still have more.Testing
Validated against the new proto by installing #1151's
isolate_protofrom a worktree:pytest projects/fal/tests/unit/test_sdk.py— 28 passed (3 new)pre-commit run --files projects/fal/src/fal/sdk.py projects/fal/tests/unit/test_sdk.py— ruff-format, ruff and the rest pass. mypy failed locally only, on a hook-environment problem (typed_astnot installed), not a type error; CI runs it in a proper env.Sequence
isolate_proto_v0.34.3isolate_protopin, un-draftpage_size/page_tokenserver-side, with a default and ceiling that also bound old clients🤖 Generated with Claude Code