Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uniformize patched() API in all SDKs #591

Open
9 tasks
mjameswh opened this issue Jan 29, 2025 · 0 comments
Open
9 tasks

Uniformize patched() API in all SDKs #591

mjameswh opened this issue Jan 29, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@mjameswh
Copy link
Contributor

mjameswh commented Jan 29, 2025

Describe the solution you'd like

In short

  • Support the patched(patchId, memoized): boolean and deprecatePatch(patchId, memoized): boolean APIs 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 patched logic to Core

Some details

  • The memoized flag needs to be stored in the Marker command, as part of the Workflow history.

  • Inconsistent usage of the memoized flag 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. GetVersion checks are memoized, meaning that calling GetVersion with 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() and deprecate_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() and deprecatePatch() functions, but those are non-memoized.

Per-SDK Tickets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant