Skip to content
Open
50 changes: 0 additions & 50 deletions Test/DurableTask.Core.Tests/VersionSettingsTests.cs

This file was deleted.

8 changes: 8 additions & 0 deletions docs/features/versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,14 @@ var instance = await client.CreateOrchestrationInstanceAsync(
| `Reject` | Default. Abandon the work item so another worker can pick it up (or retry later). |
| `Fail` | Fail the orchestration with a `VersionMismatch` error. |

#### Unversioned Infrastructure Orchestrations

A small number of explicitly registered, unversioned infrastructure orchestrations are internally exempted from the worker version check so that they can run under the configured version policy without being treated as business orchestrations. This exemption is internal to the Durable Task Framework and its approved integrations; it is not a public, customer-configurable allow list.

The exemption applies only when both the orchestration name is an exact, exempted match and its execution version is `null` or the empty string. Nonempty versions, including whitespace, still follow the configured version matching and failure strategies for every orchestration, exempted or not. Business orchestration version policies and failure behavior are otherwise unchanged and apply per worker exactly as described above.

The exclusion skips only the worker version check, which runs before orchestration middleware and execution. It does not register an orchestration, change its execution version or history, or bypass name/version lookup. The same check applies on replay and after `ContinueAsNew`; continuing with a nonempty version re-enables the normal version policy.

#### Blue-Green Deployment Example

Run old and new workers simultaneously during deployments:
Expand Down
11 changes: 10 additions & 1 deletion src/DurableTask.Core/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,17 @@

using System.Runtime.CompilerServices;

#if !SIGN_ASSEMBLY
#if SIGN_ASSEMBLY
// Grants the signed Azure Functions Durable Task host access to internal members, such as the
// worker-version exclusion used for its own infrastructure orchestrations.
// A strongly-named assembly must specify the full public key, not just the public key token, of
// any strongly-named friend assembly.
[assembly: InternalsVisibleTo("Microsoft.Azure.WebJobs.Extensions.DurableTask, PublicKey=0024000004800000940000000602000000240000525341310004000001000100cd1dabd5a893b40e75dc901fe7293db4a3caf9cd4d3e3ed6178d49cd476969abe74a9e0b7f4a0bb15edca48758155d35a4f05e6e852fff1b319d103b39ba04acbadd278c2753627c95e1f6f6582425374b92f51cca3deb0d2aab9de3ecda7753900a31f70a236f163006beefffe282888f85e3c76d1205ec7dfef7fa472a17b1")]
#else
[assembly: InternalsVisibleTo("DurableTask.Core.Tests")]
[assembly: InternalsVisibleTo("DurableTask.Framework.Tests")]
[assembly: InternalsVisibleTo("DurableTask.ServiceBus.Tests")]
// An unsigned assembly does not enforce a public key on its friends, so the same host assembly
// can be declared by simple name alone for unsigned (non-Release) builds of this assembly.
[assembly: InternalsVisibleTo("Microsoft.Azure.WebJobs.Extensions.DurableTask")]
#endif
14 changes: 14 additions & 0 deletions src/DurableTask.Core/Settings/VersioningSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// ----------------------------------------------------------------------------------

using System;
using System.Collections.Generic;

namespace DurableTask.Core.Settings
{
Expand Down Expand Up @@ -72,6 +73,19 @@ public enum VersionFailureStrategy
/// </summary>
public VersionFailureStrategy FailureStrategy { get; set; } = VersionFailureStrategy.Reject;

/// <summary>
/// Gets the orchestration names whose unversioned executions are excluded from worker version checks.
/// </summary>
/// <remarks>
/// This set is empty by default and matches names using an exact, case-sensitive ordinal comparison.
/// An exclusion applies only when the execution version is null or empty; nonempty versions still
/// follow <see cref="MatchStrategy"/> and <see cref="FailureStrategy"/>.
/// This is reserved for registering explicitly, unversioned infrastructure orchestrations, not business
/// orchestrations. Exclusions do not change execution versions or orchestration registration and lookup.
/// Configure this set before starting the worker and do not modify it while the worker is running.
/// </remarks>
internal ISet<string> ExcludedOrchestrationNames { get; } = new HashSet<string>(StringComparer.Ordinal);

/// <summary>
/// Compare two versions to each other.
/// </summary>
Expand Down
4 changes: 3 additions & 1 deletion src/DurableTask.Core/TaskOrchestrationDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,9 @@ protected async Task<bool> OnProcessWorkItemAsync(TaskOrchestrationWorkItem work
IReadOnlyList<OrchestratorAction> decisions = new List<OrchestratorAction>();
bool versioningFailed = false;

if (this.versioningSettings != null)
if (this.versioningSettings != null &&
!(string.IsNullOrEmpty(runtimeState.Version) &&
this.versioningSettings.ExcludedOrchestrationNames.Contains(runtimeState.Name)))
{
switch (this.versioningSettings.MatchStrategy)
{
Expand Down
Loading
Loading