Problem
InMemoryOrchestrationBackend.createInstance() does not accept or forward parent instance information to the ExecutionStartedEvent it creates. When processCreateSubOrchestrationAction() creates a sub-orchestration, it calls createInstance(subInstanceId, name, input) without passing the parent orchestration's identity.
This causes ctx.parent to always be undefined for sub-orchestrations in the test environment, even though the real sidecar populates this field via the ParentInstanceInfo on the ExecutionStartedEvent.
Affected files:
packages/durabletask-js/src/testing/in-memory-backend.ts — createInstance() (line 80) and processCreateSubOrchestrationAction() (line 567)
Root Cause
createInstance() has no parentInstance parameter, so it always calls newExecutionStartedEvent(name, instanceId, input) without the fourth parentInstance argument. The helper function already supports this parameter — it just was never passed from the in-memory backend.
processCreateSubOrchestrationAction() has access to the parent instance's name, instanceId, and the taskId (which serves as taskScheduledId), but does not forward them.
Proposed Fix
- Add an optional
parentInstance parameter to createInstance()
- Forward it to
newExecutionStartedEvent()
- Pass parent info from
processCreateSubOrchestrationAction() when creating sub-orchestrations
Impact
Severity: Medium — Any test that checks ctx.parent in a sub-orchestration will get undefined instead of the correct parent info. This creates a behavioral gap between the test environment and production, which could cause:
- Tests that verify parent-child relationships to falsely fail
- Tests that rely on
ctx.parent being set to silently skip logic that would run in production
Problem
InMemoryOrchestrationBackend.createInstance()does not accept or forward parent instance information to theExecutionStartedEventit creates. WhenprocessCreateSubOrchestrationAction()creates a sub-orchestration, it callscreateInstance(subInstanceId, name, input)without passing the parent orchestration's identity.This causes
ctx.parentto always beundefinedfor sub-orchestrations in the test environment, even though the real sidecar populates this field via theParentInstanceInfoon theExecutionStartedEvent.Affected files:
packages/durabletask-js/src/testing/in-memory-backend.ts—createInstance()(line 80) andprocessCreateSubOrchestrationAction()(line 567)Root Cause
createInstance()has noparentInstanceparameter, so it always callsnewExecutionStartedEvent(name, instanceId, input)without the fourthparentInstanceargument. The helper function already supports this parameter — it just was never passed from the in-memory backend.processCreateSubOrchestrationAction()has access to the parent instance'sname,instanceId, and thetaskId(which serves astaskScheduledId), but does not forward them.Proposed Fix
parentInstanceparameter tocreateInstance()newExecutionStartedEvent()processCreateSubOrchestrationAction()when creating sub-orchestrationsImpact
Severity: Medium — Any test that checks
ctx.parentin a sub-orchestration will getundefinedinstead of the correct parent info. This creates a behavioral gap between the test environment and production, which could cause:ctx.parentbeing set to silently skip logic that would run in production