Repository navigation
Conversation
A handle has calls, so decoded data must not turn into one. A Python resource is a plain class that the converter refuses, and Workflow calls decode a direct resource result as its identity DTO before they build the handle.
A resource with no methods has no calls, so it stays a dataclass that the payload converter encodes and decodes. Only a handle with calls is a plain class.
Owner
Author
|
Moved to temporalio#357. |
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.
What changed?
This PR makes generated Python resources with methods plain classes, so the payload converter refuses them.
Streamencodes as itsstreamandcreatedfields, and decodes as a WorkflowStreamwhosepublish,readandclosework.__init__and attributes, and__eq__and__repr__over its identity fields. The JSON converter refuses it in both directions. Code passes the identity fields, such as the stream sample'sStreamRef, and builds the handle with the factory.UserData, and then build the handle, as the client calls already do.WorkflowHandleorSignalResult, has no calls, so it stays a dataclass, as in Add independent Python client generation and explicit API targets temporalio/nexgen#344.Why?
A handle has calls, so decoded data shouldn't turn into one. In the Nov. 2 handles sync, we agreed that code converts a handle explicitly, as the SDK's
workflow.to_stream(handle)does.How did you test it?
Link to a test plan if any -
The round-trip test now checks that encoding a resource raises, that decoding into the Workflow
Streamraises, and that theStreamRefround-trips and gives an equal handle through the factory. The sample Workflows that returned a handle now return its identity record, and a new test checks that aSignalResultstill round-trips.cargo test --all-features,cargo validate pythonand a full sample regeneration pass.