Repository navigation
Support eager state whitelist - #259
Closed
slinkydeveloper wants to merge 1 commit into
Closed
slinkydeveloper wants to merge 1 commit into
slinkydeveloper wants to merge 1 commit into
Conversation
Port of restatedev/sdk-typescript#798. Add the `state_preload` option on VirtualObject/Workflow constructors and handler decorators, accepting True (preload all), False (preload nothing) or a list of state keys to preload eagerly. The list form is advertised through the new `eagerStateKeysWhitelist` manifest field, which requires endpoint manifest v5 (restate-server >= 1.8). `enable_lazy_state` is kept but deprecated; setting both raises ValueError. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the full port of the eager state whitelist (state_preload) from sdk-typescript#798. The manifest mapping matches the TypeScript resolveStatePreload one for one. tests/discovery.py passes (10 tests), and ruff, pyright and mypy are clean on the changed files.
- New
state_preloadoption: added to theVirtualObject/Workflowconstructors and their handler decorators, threaded throughmake_handlerandHandler. The positionalmake_handlercall sites inobject.pyandservice.pywere updated in the right order. - Deprecation of
enable_lazy_state:check_state_preload_optionsraisesValueErrorwhen both options are set, both at service level and handler level. - Manifest resolution:
resolve_state_preloadmapsTrue/False/list toenableLazyState+eagerStateKeysWhitelist. The list is copied, an empty list means fully lazy, and stateless services advertise neither field. - Manifest v5 negotiation:
send_discoveryprefers v5.compute_discovery_jsonrejects any whitelist when the negotiated version is ≤ 4, andenableLazyStatealone keeps working on v3/v4. The stray$in two error messages is fixed. - README: added a Restate 1.8 compatibility row and a note scoping the list form to ≥ 1.8.
claude-opus-5-5 | 𝕏
slinkydeveloper
force-pushed
the
preload-state
branch
from
November 4, 2026 14:50
a12eac3 to
08791a0
Compare
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.

Port of restatedev/sdk-typescript#798 to the Python SDK.
Changes
state_preloadoption onVirtualObject/Workflowconstructors and on their handler decorators:True: preload all state (default server behavior)False: preload nothing (lazy state)["key1", "key2"]: preload only the listed keys eagerly (requires restate-server >= 1.8)enable_lazy_stateis kept but deprecated. Setting both options raises aValueError.eagerStateKeysWhitelistfield on services and handlers, resolved fromstate_preloadwith the same semantics as the TypeScript SDK (list is copied, empty list means fully lazy, stateless services never advertise state options).enableLazyStatealone keeps working on v3/v4.$in discovery error messages.Tests
New unit tests in
tests/discovery.pycovering all option mappings, the mutual-exclusion error, workflow and stateless-service cases, v4 rejection and v5 JSON output.🤖 Generated with Claude Code