fix: make raiseIfFailed honor failed runtime status#308
Open
YunchuWang wants to merge 2 commits into
Open
Conversation
…ns without failure details raiseIfFailed() only checked failureDetails presence, not runtimeStatus. When an orchestration had FAILED status but failure details were missing (e.g., empty error message/type from sidecar), the method silently returned without throwing, giving callers a false sense of success. Now also checks runtimeStatus === FAILED and throws with synthetic details when real failure details are absent. Adds 10 unit tests covering all status combinations. Fixes microsoft#204 Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a gap in the core OrchestrationState.raiseIfFailed() API: it now throws for orchestrations in FAILED runtime status even when failureDetails is absent, aligning behavior with the orchestration’s authoritative runtime status and preventing silent success.
Changes:
- Update
raiseIfFailed()to also checkruntimeStatus === FAILEDand throw with syntheticFailureDetailswhen real details are missing. - Add regression tests covering failure-without-details as well as non-failure statuses.
- Add a test ensuring real
failureDetailstake precedence over synthetic details.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/durabletask-js/src/orchestration/orchestration-state.ts | Makes raiseIfFailed() honor FAILED runtime status by synthesizing failure details when missing. |
| packages/durabletask-js/test/orchestration-state.spec.ts | Adds regression coverage for raiseIfFailed() across failed/non-failed states, including missing failure details. |
…message - Replace fail(...) with throw new Error(...) in orchestration-state.spec.ts; fail is not a guaranteed global under jest-circus (Jest 29 default runner), so a regression would surface as a clean assertion failure instead of ReferenceError. - Include the synthetic failure message in the OrchestrationFailedError thrown from the runtimeStatus===FAILED path, matching the failure-details path message format. Co-authored-by: Copilot <[email protected]> Copilot-Session: d175a43f-c852-49a2-a0de-63db579a8e3a
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
Fixes #204
Testing
npm test -w @microsoft/durabletask-js -- --runTestsByPath test/orchestration-state.spec.tsnpm run build:core