fix: handle SENDENTITYMESSAGE and TERMINATEORCHESTRATION in InMemoryOrchestrationBackend#327
Open
YunchuWang wants to merge 1 commit into
Open
Conversation
…TYMESSAGE and TERMINATEORCHESTRATION action types Add handling for SENDENTITYMESSAGE (case 8) and TERMINATEORCHESTRATION (case 7) action types in InMemoryOrchestrationBackend.processAction(). Previously, orchestrations using entity signals or terminate-orchestration actions would crash with 'Unexpected action type' when run against the in-memory testing backend. - SENDENTITYMESSAGE: No-op (entity signals are fire-and-forget; in-memory backend does not simulate entity workers) - TERMINATEORCHESTRATION: Extracts target instance ID and delegates to existing terminate() method - Adds 3 unit tests verifying entity signal orchestrations complete without crashing Fixes #209 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes crashes in the in-memory testing backend by handling additional orchestrator action types that can be produced by entity interactions and orchestration termination.
Changes:
- Handle
SENDENTITYMESSAGEactions inInMemoryOrchestrationBackend.processAction()(acknowledged/no-op). - Handle
TERMINATEORCHESTRATIONactions by terminating the targeted instance. - Add unit tests to verify entity signal (fire-and-forget) orchestrations don’t crash when run against the in-memory backend.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/durabletask-js/src/testing/in-memory-backend.ts | Adds handling for SENDENTITYMESSAGE and TERMINATEORCHESTRATION orchestrator actions. |
| packages/durabletask-js/test/in-memory-backend.spec.ts | Adds regression tests ensuring entity signaling doesn’t crash the in-memory backend. |
Comments suppressed due to low confidence (1)
packages/durabletask-js/src/testing/in-memory-backend.ts:471
- TERMINATEORCHESTRATION handling is newly added but isn't covered by a unit test (the existing termination test exercises external termination via the test client, not an OrchestratorAction of type TERMINATEORCHESTRATION). Adding a regression test would help ensure this action type doesn't reintroduce crashes.
case pb.OrchestratorAction.OrchestratoractiontypeCase.TERMINATEORCHESTRATION:
// Terminate-orchestration actions are used for recursive termination of
// sub-orchestrations. Process by terminating the target instance.
this.processTerminateOrchestrationAction(action);
break;
Comment on lines
+654
to
+658
| try { | ||
| this.terminate(targetInstanceId, output); | ||
| } catch { | ||
| // Target instance may not exist or already terminated - ignore | ||
| } |
Comment on lines
+467
to
+471
| case pb.OrchestratorAction.OrchestratoractiontypeCase.TERMINATEORCHESTRATION: | ||
| // Terminate-orchestration actions are used for recursive termination of | ||
| // sub-orchestrations. Process by terminating the target instance. | ||
| this.processTerminateOrchestrationAction(action); | ||
| break; |
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.
Fixes #209.
InMemoryOrchestrationBackendcrashed on theSENDENTITYMESSAGEandTERMINATEORCHESTRATIONaction types because they were unhandled. This adds handling for both.Opens the existing fix branch
copilot-finds/bug/in-memory-backend-missing-entity-action-handlingas a PR (automated triage of active [copilot-finds] issues that had a ready fix branch but no open PR).