Changing the default dedupe statuses behavior#622
Conversation
There was a problem hiding this comment.
Pull request overview
This PR changes the default behavior for orchestration ID reuse policies to allow all orchestration statuses to be reusable, rather than just terminal statuses. This is a breaking change that assumes server-side implementations will terminate existing orchestrations in non-terminal states before creating new ones with the same instance ID.
Changes:
- Renamed
GetTerminalStatuses()toGetAllStatuses()and expanded it to include non-terminal statuses (Pending, Running, Suspended) - Modified
ConvertDedupeStatusesToReusePolicy()to return non-nullable policy and work with all statuses instead of just terminal ones - Updated all unit tests to reflect the new behavior and removed tests that validated non-terminal status filtering
- Updated comments in server-side code to reflect the new semantics
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| src/Client/Grpc/ProtoUtils.cs | Renamed method to GetAllStatuses, added non-terminal statuses, changed return type to non-nullable, updated logic to handle all statuses |
| src/Client/Grpc/GrpcDurableTaskClient.cs | Refactored dedupe status handling using collection expressions, removed conditional policy assignment logic |
| src/InProcessTestHost/Sidecar/Grpc/TaskHubGrpcServer.cs | Updated comment to reflect "all statuses" instead of "terminal statuses" |
| test/Client/Grpc.Tests/ProtoUtilsTests.cs | Comprehensive test updates including renamed tests, updated assertions for all statuses, removed non-terminal filtering tests, added tests for new statuses |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
src/InProcessTestHost/Sidecar/Grpc/TaskHubGrpcServer.cs:214
- With the new semantics, making non-terminal statuses replaceable implies the server should terminate an existing non-terminal instance before creating the new one. This in-process gRPC server currently only converts the policy to
dedupeStatusesand proceeds to create the orchestration, without any termination step, which can diverge from the intended behavior. Consider implementing the termination behavior here so the test host matches real backends.
return Task.FromResult(new P.DeleteTaskHubResponse());
}
/// <summary>
/// Starts a new orchestration instance.
src/Client/OrchestrationServiceClientShim/ShimDurableTaskClient.cs
Outdated
Show resolved
Hide resolved
src/Client/OrchestrationServiceClientShim/ShimDurableTaskClient.cs
Outdated
Show resolved
Hide resolved
test/Client/OrchestrationServiceClientShim.Tests/ShimDurableTaskClientTests.cs
Outdated
Show resolved
Hide resolved
…upe statuses is null (never set by the client. this is different than explicitly making it an empty list)
src/Client/OrchestrationServiceClientShim/ShimDurableTaskClient.cs
Outdated
Show resolved
Hide resolved
| // Note: This requires the protobuf to support OrchestrationIdReusePolicy field | ||
| // If the protobuf doesn't support it yet, this will need to be updated when the protobuf is updated | ||
| if (options?.DedupeStatuses != null && options.DedupeStatuses.Count > 0) | ||
| if (options?.DedupeStatuses != null) |
There was a problem hiding this comment.
What's the reason for removing the options.DedupeStatuses.Count check? Is that a behavior change?
There was a problem hiding this comment.
This is indeed a behavior change. My thinking is:
- If the user didn't specify dedupe statuses at all, we should default to whatever the backend implementation does
- If the user specifically set the dedupe statuses to an empty array, we should take that to mean all statuses are reusable
Previously, I think both situations would default to whatever the backend does
Summary
Currently, only terminal statuses are reusable when creating a new orchestration with a given instance ID. This is enforced when creating the
OrchestrationIdReusePolicy, which ensures that only terminal statuses are considered "reusable" (minus whatever statuses the user includes in the dedupe statuses passed to the creation call). This PR allows all statuses to be reusable, with the assumption that the server-side implementation will terminate an existing orchestration if it is running, pending, or suspended (in a non-terminal status) before creating a new one. This is a breaking change for which all server-side implementations will need to be updated accordingly:Project checklist
release_notes.mdAI-assisted code disclosure (required)
Was an AI tool used? (select one)
If AI was used:
AI verification (required if AI was used):
Notes for reviewers