temporalio / temporalio/features
Uniformize `patched()` API in all SDKs
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 32
- Forks
- 28
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 7
Description
Describe the solution you'd like
In short
-
Support the
patched(patchId, memoized): booleananddeprecatePatch(patchId, memoized): booleanAPIs in all SDKs -
Keep backward compatibility on existing APIs in each SDK, but deprecate those APIs
- The objective is to encourage users to move to the uniformized, simpler and less confusing APIs.
- Documentation on deprecated APIs should clearly indicate how existing calls may safely get converted.
-
In Core-based SDKs, delegate handling of the
patchedlogic to Core
Some details
-
The
memoizedflag needs to be stored in the Marker command, as part of the Workflow history. -
Inconsistent usage of the
memoizedflag should result in a Non-Determinism Error. -
Core SDK will implement this first, using the TS SDK as reference for the non-memoized bahavior, and Python/.Net for the memoized behavior. Java and Go will then mirror Core's implementation.
Existing APIs
All SDKs already provide some form of Workflow command to record versioning markers into Workflow history, but those APIs are inconsistent across the board:
-
Go, Java and PHP have
GetVersion, which associates a textual identifier and a numeric value, leaving to the user the responsibility of using these appropriately.GetVersionchecks are memoized, meaning that callingGetVersionwith a same textual identifier multiple time in the lifetime of a single Workflow Execution will always return the same numeric value as was first returned. -
Python, .NET and Ruby have the
patched()anddeprecate_patch()functions, which only takes a textual identifier, and return boolean value indicating either the new code should be executed or not. The return value is memoized. -
TypeScript also have
patched()anddeprecatePatch()functions, but those are non-memoized.
Per-SDK Tickets
- Go - temporalio/sdk-go#1796
- Java - temporalio/sdk-java#2393
- Core - temporalio/sdk-core#869
- TypeScript - temporalio/sdk-typescript#1616
- Python - temporalio/sdk-python#754
- .NET - temporalio/sdk-dotnet#398
- Ruby - temporalio/sdk-ruby#209
- PHP - temporalio/sdk-php#558
- Temporal CLI - N/A
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the per-SDK tickets and the Core implementation plan, using the listed SDKs as the entry points. Done means every listed SDK supports the uniform APIs, preserves and deprecates its existing APIs with conversion guidance, stores memoization in marker history, and reports inconsistent usage as non-determinism.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, java, php, python, ruby, typescript
- Domain
- api, testing-qa
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 20/100