Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/durabletask-js/src/testing/in-memory-backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export class InMemoryOrchestrationBackend {
): void {
const instance = this.instances.get(instanceId);
if (!instance) {
throw new Error(`Orchestration instance '${instanceId}' not found`);
return; // Instance may have been purged or the backend reset
}

if (instance.completionToken !== completionToken) {
Expand Down
11 changes: 11 additions & 0 deletions packages/durabletask-js/test/in-memory-backend.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,17 @@ describe("In-Memory Backend", () => {
expect((backend as any).instanceTimers.has(id1)).toBe(false);
});

it("should silently ignore completeOrchestration for purged instances", () => {
// Verifies that completeOrchestration returns silently when the instance
// has been deleted (e.g., via purge or reset), consistent with how
// completeActivity handles missing instances.

// Should not throw — instance simply doesn't exist
expect(() => {
backend.completeOrchestration("nonexistent-instance", 1, []);
}).not.toThrow();
});

it("should allow reusing instance IDs after reset", async () => {
const orchestrator: TOrchestrator = async (_: OrchestrationContext, input: number) => {
return input * 2;
Expand Down
Loading