-
Notifications
You must be signed in to change notification settings - Fork 53
[Durable] Add Version property to $Context #1108
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
Conversation
…ization for improved performance
I want to add an E2E test for this, but this will require an extension bundle with Microsoft.Azure.WebJobs.Extensions.DurableTask 3.1.0+, so we'll have to do it later. For now, I tested E2E manually. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a Version property to the orchestration context, enabling PowerShell Functions users to access version information for backward compatibility.
- Introduces a lazy-loaded Version property in OrchestrationContext.
- Implements version extraction logic in OrchestrationVersionExtractor and extends HistoryEvent to support the Version field.
- Adds unit tests to validate the extracted version logic.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
test/Unit/Durable/OrchestrationVersionExtractorTests.cs | Adds tests for various scenarios of version extraction. |
src/DurableSDK/OrchestrationVersionExtractor.cs | Implements logic to extract the version from orchestration history events. |
src/DurableSDK/OrchestrationContext.cs | Adds a lazy Version property that retrieves the version using the extractor. |
src/DurableSDK/HistoryEvent.cs | Extends the HistoryEvent model to include the Version property. |
release_notes.md | Updates release notes to document the new Version property. |
Add Version property to the `$Context` object passed to orchestrator functions, similar to Azure/azure-functions-powershell-worker#1108. As a result, PowerShell Functions users will be able to specify a version in **host.json**: ``` json { "extensions": { "durableTask": { "defaultVersion": "2.0" } } } ``` and check the orchestration version in their orchestrator functions in order to keep them backward compatible, for example: ``` powershell if ($Context.Version -eq '1.0') { # Legacy code path Invoke-DurableActivity 'A' } elseif ($Context.Version -eq '2.0') { # New code path Invoke-DurableActivity 'B' } ``` **Note: Microsoft.Azure.WebJobs.Extensions.DurableTask 3.1.0+ is required for this to work properly.** ### Pull request checklist * [x] My changes **do not** require documentation changes * [ ] Otherwise: Documentation issue linked to PR * [ ] My changes **should not** be added to the release notes for the next release * [x] Otherwise: I've added my notes to `release_notes.md` * [x] My changes **do not** need to be backported to a previous version * [ ] Otherwise: Backport tracked by issue/PR #issue_or_pr * [x] I have added all required tests (Unit tests, E2E tests)
Add Version property to the
$Context
object passed to orchestrator functions, matching the behavior implemented for .NET in-proc in Azure/azure-functions-durable-extension#3072.As a result, PowerShell Functions users will be able to specify a version in host.json:
and check the orchestration version in their orchestrator functions in order to keep them backward compatible, for example:
Note: Microsoft.Azure.WebJobs.Extensions.DurableTask 3.1.0+ is required for this to work properly.
Pull request checklist
release_notes.md