Add ContinueAsNewOptions with NewVersion support#682
Open
YunchuWang wants to merge 5 commits intomainfrom
Open
Add ContinueAsNewOptions with NewVersion support#682YunchuWang wants to merge 5 commits intomainfrom
YunchuWang wants to merge 5 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an SDK-level mechanism to specify a target orchestration version when calling ContinueAsNew, enabling version migration for long-running (eternal) orchestrations while keeping existing ContinueAsNew(object?, bool) implementations working.
Changes:
- Introduces
ContinueAsNewOptionswith aNewVersionproperty in the public abstractions layer. - Adds a new
TaskOrchestrationContext.ContinueAsNew(ContinueAsNewOptions, object?, bool)overload and wires it throughTaskOrchestrationContextWrapperto DurableTask.Core’s versionedContinueAsNew. - Adds unit + integration tests validating version propagation and fallback behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Abstractions/ContinueAsNewOptions.cs | Adds a new options type carrying NewVersion. |
| src/Abstractions/TaskOrchestrationContext.cs | Adds a virtual ContinueAsNew overload that accepts ContinueAsNewOptions. |
| src/Worker/Core/Shims/TaskOrchestrationContextWrapper.cs | Implements the versioned continue-as-new behavior when NewVersion is provided. |
| test/Worker/Core.Tests/Shims/TaskOrchestrationContextWrapperTests.cs | Unit tests validating wrapper behavior with/without version. |
| test/Grpc.IntegrationTests/OrchestrationPatterns.cs | End-to-end integration test validating version migration via ContinueAsNew. |
| src/Abstractions/TaskOrchestrator.cs | Updates XML doc cref to reference the intended ContinueAsNew overload explicitly. |
test/Worker/Core.Tests/Shims/TaskOrchestrationContextWrapperTests.cs
Outdated
Show resolved
Hide resolved
9256bad to
32efcc8
Compare
4708a53 to
c344e34
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ity with ContinueAsNew(null, false)
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.
Summary
This PR adds support for specifying a new orchestration version when calling
ContinueAsNew, enabling version migration scenarios for long-running orchestrations.Fixes #672
Changes
New:
ContinueAsNewOptionsclassContinueAsNewOptionswith aNewVersionproperty that allows callers to specify the version the next generation of the orchestration should run as.Updated:
TaskOrchestrationContextvirtualoverload:ContinueAsNew(ContinueAsNewOptions, object?, bool)that accepts the options class.abstract ContinueAsNew(object?, bool)method, preserving backward compatibility.Updated:
TaskOrchestrationContextWrapperContinueAsNew(string newVersion, object newInput)whenNewVersionis specified.newVersion; only the SDK layer was missing.Tests
TaskOrchestrationContextWrapperTests: verify version propagation, null-version fallback, and preserveUnprocessedEvents passthrough.ContinueAsNewWithNewVersion): end-to-end validation that an orchestrator can migrate from no version tov2and read backctx.Versioncorrectly.Motivation
See #672 \u2014 users need to evolve orchestration logic over time. The underlying infrastructure (proto field
CompleteOrchestrationAction.newVersion, Core dispatcher, gRPC sidecar, DTS) all already support version changes on ContinueAsNew, but the portable SDK abstraction layer (TaskOrchestrationContext) had no way to pass a new version through.