Skip to content

Add patch activation callback#1394

Draft
Sushisource wants to merge 1 commit into
mainfrom
patch-activation-callback
Draft

Add patch activation callback#1394
Sushisource wants to merge 1 commit into
mainfrom
patch-activation-callback

Conversation

@Sushisource

Copy link
Copy Markdown
Member

What was changed

Added an experimental WorkerOptions::patch_activation_callback for native Rust workflows that lets a worker decide whether the first newly encountered, non-replay patched call activates a patch.

The callback receives owned, immutable PatchActivationInput containing workflow information and the patch ID. Its boolean decision is memoized for the workflow run. Declined patches return false without recording a marker, while replay, existing history markers, and deprecated patches retain their existing behavior.

WASM component workflows are intentionally excluded because supporting the host callback there requires a WIT/generated-interface expansion.

This ports the behavior introduced by temporalio/sdk-ruby#481.

Why?

This allows workflow changes using patched to roll out gradually without every new-code worker immediately recording a marker that older workers cannot replay.

Testing

  • cargo test -p temporalio-sdk --lib
  • cargo test -p temporalio-workflow patch_activation
  • cargo lint
  • cargo test-lint
  • cargo integ-test workflow_tests::patches: 33 cases
  • Nightly formatting and diff cleanliness checks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant