feat: throw WorkflowInstanceAlreadyExistsException when scheduling a workflow with an active instance ID#1782
Open
javier-aliaga wants to merge 3 commits into
Conversation
…workflow with an active instance ID Signed-off-by: Javier Aliaga <javier@diagrid.io>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a dedicated client-side exception for duplicate active workflow instance IDs and wires the scheduling APIs to translate the runtime/sidecar “already exists” signal into that exception (including a legacy-runtime fallback), with tests covering the new behavior.
Changes:
- Introduces
WorkflowInstanceAlreadyExistsExceptionas a first-class client exception carrying the conflicting instance ID (when known). - Wraps
scheduleNewWorkflow*overloads inDaprWorkflowClientto translate gRPCALREADY_EXISTS(and legacy UNKNOWN+message cases) into the new exception. - Adds unit tests validating the translation and that unrelated gRPC errors are rethrown.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| sdk-workflows/src/main/java/io/dapr/workflows/client/DaprWorkflowClient.java | Maps specific gRPC failures from scheduling calls into WorkflowInstanceAlreadyExistsException. |
| sdk-workflows/src/main/java/io/dapr/workflows/client/WorkflowInstanceAlreadyExistsException.java | Adds a new exception type that exposes the conflicting workflow instance ID. |
| sdk-workflows/src/test/java/io/dapr/workflows/client/DaprWorkflowClientTest.java | Adds tests for duplicate-instance translation (including legacy-runtime behavior) and rethrow behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Annotate nullable instanceId field, restrict the legacy fallback to UNKNOWN status with the runtime's specific collision message, and assert instance ID propagation into NewOrchestrationInstanceOptions. Signed-off-by: Javier Aliaga <javier@diagrid.io>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1782 +/- ##
============================================
+ Coverage 76.89% 76.96% +0.06%
- Complexity 2307 2319 +12
============================================
Files 244 245 +1
Lines 7163 7180 +17
Branches 753 756 +3
============================================
+ Hits 5508 5526 +18
Misses 1288 1288
+ Partials 367 366 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Description
related to dapr/dapr#10153
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #[issue number]
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: