Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
90158c2
test(sdk): show that an operation runs after the invocation terminated
ParidelPooya Nov 9, 2026
ce628df
fix(sdk): start no operation after the invocation terminated
ParidelPooya Nov 9, 2026
8f88e0d
test(sdk): show that the invocation does not stop at its deadline
ParidelPooya Nov 9, 2026
387d797
fix(sdk): terminate the invocation when its deadline passes
ParidelPooya Nov 9, 2026
d6c8d69
docs(sdk): describe the deadline termination for Lambda Managed Insta…
ParidelPooya Nov 9, 2026
40d39f3
test(otel): report time left in two propagation test contexts
ParidelPooya Nov 10, 2026
8924203
test(sdk): show three gaps in the deadline termination
ParidelPooya Nov 10, 2026
0c19c72
fix(sdk): close three gaps in the deadline termination
ParidelPooya Nov 10, 2026
f04dece
fix(sdk): send queued checkpoints after a termination again
ParidelPooya Nov 10, 2026
fc02420
Merge branch 'main' into fix/sdk-no-operations-after-termination
ParidelPooya Nov 10, 2026
637827c
docs(sdk): say that RETRYING does not promise a later invocation
ParidelPooya Nov 10, 2026
2632c22
docs(sdk): tell plugins to end open operations on RETRYING
ParidelPooya Nov 10, 2026
4d46660
Merge branch 'main' into fix/sdk-no-operations-after-termination
ParidelPooya Nov 10, 2026
2bc45ab
Merge branch 'main' into fix/sdk-no-operations-after-termination
ParidelPooya Nov 10, 2026
8e192fb
Merge remote-tracking branch 'origin/main' into fix/sdk-no-operations…
ParidelPooya Nov 11, 2026
69b1d4b
test(sdk): show that a step result is serialized after the deadline
ParidelPooya Nov 11, 2026
23bd407
fix(sdk): start no serialization after the invocation terminated
ParidelPooya Nov 11, 2026
8810286
Merge branch 'main' into fix/sdk-no-operations-after-termination
ParidelPooya Nov 12, 2026
529b9fe
Merge branch 'main' into fix/sdk-no-operations-after-termination
ParidelPooya Nov 12, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ describe.each([
};
const lambdaContext: Context = {
awsRequestId: "req",
getRemainingTimeInMillis: () => 0,
getRemainingTimeInMillis: () => 300_000,
callbackWaitsForEmptyEventLoop: false,
functionName: "parent",
functionVersion: "1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const executionArn =
const started = new Date("2026-01-01T00:00:00Z");
const lambdaContext: Context = {
awsRequestId: "request",
getRemainingTimeInMillis: () => 0,
getRemainingTimeInMillis: () => 300_000,
callbackWaitsForEmptyEventLoop: false,
functionName: "parent",
functionVersion: "1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,12 @@ export class DurableContextImpl<Logger extends DurableLogger>
}

private checkForNonResolvingPromise(): Promise<never> | null {
// A terminated invocation records nothing further, so an operation it starts must not
// run. On Lambda Managed Instances the handler's code keeps running after termination,
// and a step started then would run its function with no record of it.
if (this._executionContext.terminationManager.isTerminationRequested()) {
return new Promise<never>(() => {});
Comment thread
ParidelPooya marked this conversation as resolved.
Resolved
}
Comment thread
ParidelPooya marked this conversation as resolved.
Resolved
Comment thread
ParidelPooya marked this conversation as resolved.
Resolved
if (
this.durableExecutionMode === DurableExecutionMode.ReplaySucceededContext
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
/**
* An operation that the handler starts after the invocation terminated must not run.
*
* Termination ends the invocation: the wrapper answers, and the checkpoint manager accepts no
* further checkpoint. The handler's own code can still run after that, for example when it
* awaits a timer or I/O outside any operation. On standard Lambda the execution environment
* freezes, so that code never resumes. On Lambda Managed Instances it does not freeze. A step
* that the handler starts then would run its function, and the service would never learn of it.
*
* Every test here holds a callback pending, waits outside any operation until the invocation
* suspends, and then starts one more operation.
*/
import { describe, it, expect } from "vitest";
import { Context } from "aws-lambda";

import { withDurableExecution } from "../../with-durable-execution";
import { DurableExecutionInvocationInputWithClient } from "../../utils/durable-execution-invocation-input/durable-execution-invocation-input";
import { hashId } from "../../utils/step-id-utils/step-id-utils";
import {
DurableContext,
DurableExecutionClient,
InvocationStatus,
OperationSubType,
} from "../../types";
import {
CheckpointDurableExecutionResponse,
GetDurableExecutionStateResponse,
OperationStatus,
OperationType,
WireOperation,
} from "../../types/wire";
import { CHECKPOINT_TERMINATION_COOLDOWN_MS } from "../../utils/constants/constants";

// Longer than the cooldown, so the invocation suspends while the handler waits.
const WAIT_OUTSIDE_OPERATION_MS = CHECKPOINT_TERMINATION_COOLDOWN_MS * 3 + 30;

const sleep = (ms: number): Promise<void> =>
new Promise((resolve) => setTimeout(resolve, ms));

const lambdaContext = {
awsRequestId: "request-1",
getRemainingTimeInMillis: () => 300_000,
} as unknown as Context;

const now = (): string => new Date().toISOString();

const executionOp = {
Id: hashId("execution"),
Type: OperationType.EXECUTION,
Status: OperationStatus.STARTED,
StartTimestamp: now(),
ExecutionDetails: { InputPayload: "{}" },
} as unknown as WireOperation;

/** The first root operation: a callback that was created and never completes. */
const pendingCallbackOp = {
Id: hashId("1"),
Type: OperationType.CALLBACK,
SubType: OperationSubType.CALLBACK,
Name: "cb",
Status: OperationStatus.STARTED,
StartTimestamp: now(),
CallbackDetails: { CallbackId: "callback-id" },
} as unknown as WireOperation;

const client: DurableExecutionClient = {
getExecutionState: async (): Promise<GetDurableExecutionStateResponse> => ({
Operations: [],
NextMarker: undefined,
}),
checkpoint: async (): Promise<CheckpointDurableExecutionResponse> => ({
CheckpointToken: "next-token",
NewExecutionState: undefined,
}),
};

/**
* Runs `lateOperation` after the invocation suspended. Returns the invocation response and
* whether the late operation ran its function or settled.
*/
const run = async (
lateOperation: (context: DurableContext, markRan: () => void) => unknown,
): Promise<{ response: unknown; ran: boolean; settled: boolean }> => {
let ran = false;
let settled = false;
const response = await withDurableExecution(
async (_event: unknown, context: DurableContext) => {
const [callbackPromise] = await context.createCallback("cb");
// Promise.all awaits the callback at once, so the callback is waiting while the
// other branch sleeps outside any operation. The invocation then suspends.
const [result] = await Promise.all([
callbackPromise,
(async (): Promise<void> => {
await sleep(WAIT_OUTSIDE_OPERATION_MS);
await lateOperation(context, () => {
ran = true;
});
settled = true;
})(),
]);
return result;
},
)(
new DurableExecutionInvocationInputWithClient(
{
DurableExecutionArn:
"arn:aws:lambda:us-east-1:123456789012:function:repro:$LATEST",
CheckpointToken: "token-1",
InitialExecutionState: {
Operations: [executionOp, pendingCallbackOp],
NextMarker: "",
},
},
client,
),
lambdaContext,
);
// The handler is still running. Give it time to start the late operation.
await sleep(WAIT_OUTSIDE_OPERATION_MS * 2);
return { response, ran, settled };
};

describe("an operation started after the invocation terminated", () => {
it("step: does not run the step function", async () => {
const { response, ran, settled } = await run((context, markRan) =>
context.step("late", async () => {
markRan();
}),
);

expect(response).toEqual({ Status: InvocationStatus.PENDING });
expect(ran).toBe(false);
expect(settled).toBe(false);
});

it("runInChildContext: does not run the child function", async () => {
const { response, ran, settled } = await run((context, markRan) =>
context.runInChildContext("late", async () => {
markRan();
}),
);

expect(response).toEqual({ Status: InvocationStatus.PENDING });
expect(ran).toBe(false);
expect(settled).toBe(false);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,31 @@ retry of the same execution.
The SDK never stops that code by force. A step can stop itself when the SDK aborts its
`ctx.signal`. So follow these rules in a durable function:

1. Keep each step much shorter than the function timeout. The SDK does not check the deadline
when an operation starts. So when the deadline passes during a step, the step finishes and
the SDK starts the next operation. Split long work into several steps.
2. Give every I/O call in a step a timeout that is shorter than the time left in the
invocation. A step that cannot wait forever cannot outlive its invocation by much. The SDK
does not abort `ctx.signal` at the deadline. So combine the two signals:
1. Keep each step much shorter than the function timeout. When the deadline passes, the SDK
terminates the invocation: it aborts `ctx.signal` of every running step, sends no further
checkpoint, and starts no further operation. Lambda retries the invocation. A step that
was running at the deadline runs again on the retry. Split long work into several steps.
2. Pass `ctx.signal` to every I/O call in a step. The SDK aborts it at the deadline, so the
step stops instead of running next to the retry:

```typescript
await context.step("load", async (ctx) => {
const remaining = context.lambdaContext.getRemainingTimeInMillis();
const timeout = Math.max(0, remaining - 1000);
const res = await fetch(url, {
signal: AbortSignal.any([ctx.signal, AbortSignal.timeout(timeout)]),
});
const res = await fetch(url, { signal: ctx.signal });
// Read the body inside the step. The signal also covers the body read,
// and the step returns plain data that the SDK can checkpoint.
return res.json();
});
```

A step that ignores the signal keeps running after the deadline. Its result is not
checkpointed.

3. Make every step idempotent. Derive the idempotency key from the execution and the step, not
from the time. A step already runs at least once. On LMI, an old invocation can also run the
same step at the same time as its retry.
4. Pass `ctx.signal` to every I/O call in a step that runs inside a `map` or `parallel`. When
the batch [completes early](BATCH_COMPLETION.md), the SDK aborts the signal of every step that
still runs. So those steps can stop.
4. The same signal stops leftover steps in a `map` or `parallel`. When the batch
[completes early](BATCH_COMPLETION.md), the SDK aborts the signal of every step that still
runs.
5. After `context.promise.race`, the remaining branches keep running, and the SDK does not
abort their signals. A step that ignores its signal also keeps running. So use
`promise.race` or such a step only when its leftover work has no side effects, or side
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
CheckpointUnrecoverableInvocationError,
} from "./checkpoint-errors/checkpoint-errors";
import { SerdesFailedError } from "./serdes-errors/serdes-errors";
import { InvocationDeadlineError } from "./invocation-deadline-error/invocation-deadline-error";
import { createErrorObjectFromError } from "../utils/error-object/error-object";

// createErrorObjectFromError writes `error.name` as the checkpoint ErrorType
Expand All @@ -22,6 +23,11 @@ const cases: Array<[string, { name: string }, () => Error]> = [
() => new CheckpointUnrecoverableExecutionError(),
],
["SerdesFailedError", SerdesFailedError, () => new SerdesFailedError()],
[
"InvocationDeadlineError",
InvocationDeadlineError,
() => new InvocationDeadlineError(),
],
];

const renamed: Array<{ name: string }> = [];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { TerminationReason } from "../../termination-manager/types";
import { UnrecoverableInvocationError } from "../unrecoverable-error/unrecoverable-error";

/**
* The invocation's deadline passed before the handler finished.
*
* Thrown from the invocation, so it is an invocation error and Lambda retries the
* invocation. It does not fail the execution. Lambda has usually answered with its own
* timeout already, so this answer is then ignored.
*/
export class InvocationDeadlineError extends UnrecoverableInvocationError {
override name = "InvocationDeadlineError";
readonly terminationReason = TerminationReason.INVOCATION_DEADLINE_PASSED;

constructor() {
super("Invocation deadline passed");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
beforeEach(() => {
mockTerminationManager = {
terminate: vi.fn(),
isTerminationRequested: vi.fn().mockReturnValue(false),
getTerminationPromise: vi.fn(),
} as unknown as Mocked<TerminationManager>;

Expand Down Expand Up @@ -54,14 +55,14 @@
});

// Call safeSerialize but don't await it (it will never resolve due to termination)
safeSerialize(
mockSerdes,
value,
TEST_CONSTANTS.STEP_ID_1,
TEST_CONSTANTS.STEP_NAME,
mockTerminationManager,
TEST_CONSTANTS.DURABLE_EXECUTION_ARN,
);

Check warning on line 65 in packages/aws-durable-execution-sdk-js/src/errors/serdes-errors/serdes-errors.test.ts

View workflow job for this annotation

GitHub Actions / lint / lint

lint/nursery/noFloatingPromises

A "floating" Promise was found, meaning it is not properly handled and could lead to ignored errors or unexpected behavior.

// Wait a small amount of time for the async operations to complete
await new Promise((resolve) => setTimeout(resolve, 100));
Expand All @@ -81,14 +82,14 @@
});

// Call safeSerialize but don't await it (it will never resolve due to termination)
safeSerialize(
mockSerdes,
value,
TEST_CONSTANTS.STEP_ID_1,
TEST_CONSTANTS.STEP_NAME,
mockTerminationManager,
TEST_CONSTANTS.DURABLE_EXECUTION_ARN,
);

Check warning on line 92 in packages/aws-durable-execution-sdk-js/src/errors/serdes-errors/serdes-errors.test.ts

View workflow job for this annotation

GitHub Actions / lint / lint

lint/nursery/noFloatingPromises

A "floating" Promise was found, meaning it is not properly handled and could lead to ignored errors or unexpected behavior.

// Wait a small amount of time for the async operations to complete
await new Promise((resolve) => setTimeout(resolve, 100));
Expand All @@ -108,14 +109,14 @@
});

// Call safeSerialize but don't await it (it will never resolve due to termination)
safeSerialize(
mockSerdes,
value,
TEST_CONSTANTS.STEP_ID_1,
undefined,
mockTerminationManager,
TEST_CONSTANTS.DURABLE_EXECUTION_ARN,
);

Check warning on line 119 in packages/aws-durable-execution-sdk-js/src/errors/serdes-errors/serdes-errors.test.ts

View workflow job for this annotation

GitHub Actions / lint / lint

lint/nursery/noFloatingPromises

A "floating" Promise was found, meaning it is not properly handled and could lead to ignored errors or unexpected behavior.

// Wait a small amount of time for the async operations to complete
await new Promise((resolve) => setTimeout(resolve, 100));
Expand All @@ -134,14 +135,14 @@
mockSerdes.serialize.mockRejectedValue(originalError);

// Call safeSerialize but don't await it (it will never resolve due to termination)
safeSerialize(
mockSerdes,
value,
TEST_CONSTANTS.STEP_ID_1,
TEST_CONSTANTS.STEP_NAME,
mockTerminationManager,
TEST_CONSTANTS.DURABLE_EXECUTION_ARN,
);

Check warning on line 145 in packages/aws-durable-execution-sdk-js/src/errors/serdes-errors/serdes-errors.test.ts

View workflow job for this annotation

GitHub Actions / lint / lint

lint/nursery/noFloatingPromises

A "floating" Promise was found, meaning it is not properly handled and could lead to ignored errors or unexpected behavior.

// Wait a small amount of time for the async operations to complete
await new Promise((resolve) => setTimeout(resolve, 100));
Expand All @@ -159,14 +160,14 @@
mockSerdes.serialize.mockRejectedValue("Async string error");

// Call safeSerialize but don't await it (it will never resolve due to termination)
safeSerialize(
mockSerdes,
value,
TEST_CONSTANTS.STEP_ID_1,
TEST_CONSTANTS.STEP_NAME,
mockTerminationManager,
TEST_CONSTANTS.DURABLE_EXECUTION_ARN,
);

Check warning on line 170 in packages/aws-durable-execution-sdk-js/src/errors/serdes-errors/serdes-errors.test.ts

View workflow job for this annotation

GitHub Actions / lint / lint

lint/nursery/noFloatingPromises

A "floating" Promise was found, meaning it is not properly handled and could lead to ignored errors or unexpected behavior.

// Wait a small amount of time for the async operations to complete
await new Promise((resolve) => setTimeout(resolve, 100));
Expand All @@ -184,14 +185,14 @@
mockSerdes.serialize.mockRejectedValue("Async string error");

// Call safeSerialize but don't await it (it will never resolve due to termination)
safeSerialize(
mockSerdes,
value,
TEST_CONSTANTS.STEP_ID_1,
undefined,
mockTerminationManager,
TEST_CONSTANTS.DURABLE_EXECUTION_ARN,
);

Check warning on line 195 in packages/aws-durable-execution-sdk-js/src/errors/serdes-errors/serdes-errors.test.ts

View workflow job for this annotation

GitHub Actions / lint / lint

lint/nursery/noFloatingPromises

A "floating" Promise was found, meaning it is not properly handled and could lead to ignored errors or unexpected behavior.

// Wait a small amount of time for the async operations to complete
await new Promise((resolve) => setTimeout(resolve, 100));
Expand All @@ -215,6 +216,7 @@
beforeEach(() => {
mockTerminationManager = {
terminate: vi.fn(),
isTerminationRequested: vi.fn().mockReturnValue(false),
getTerminationPromise: vi.fn(),
} as unknown as Mocked<TerminationManager>;

Expand Down Expand Up @@ -250,14 +252,14 @@
});

// Call safeDeserialize but don't await it (it will never resolve due to termination)
safeDeserialize(
mockSerdes,
data,
TEST_CONSTANTS.STEP_ID_1,
TEST_CONSTANTS.STEP_NAME,
mockTerminationManager,
TEST_CONSTANTS.DURABLE_EXECUTION_ARN,
);

Check warning on line 262 in packages/aws-durable-execution-sdk-js/src/errors/serdes-errors/serdes-errors.test.ts

View workflow job for this annotation

GitHub Actions / lint / lint

lint/nursery/noFloatingPromises

A "floating" Promise was found, meaning it is not properly handled and could lead to ignored errors or unexpected behavior.

// Wait a small amount of time for the async operations to complete
await new Promise((resolve) => setTimeout(resolve, 100));
Expand All @@ -277,14 +279,14 @@
});

// Call safeDeserialize but don't await it (it will never resolve due to termination)
safeDeserialize(
mockSerdes,
data,
TEST_CONSTANTS.STEP_ID_1,
TEST_CONSTANTS.STEP_NAME,
mockTerminationManager,
TEST_CONSTANTS.DURABLE_EXECUTION_ARN,
);

Check warning on line 289 in packages/aws-durable-execution-sdk-js/src/errors/serdes-errors/serdes-errors.test.ts

View workflow job for this annotation

GitHub Actions / lint / lint

lint/nursery/noFloatingPromises

A "floating" Promise was found, meaning it is not properly handled and could lead to ignored errors or unexpected behavior.

// Wait a small amount of time for the async operations to complete
await new Promise((resolve) => setTimeout(resolve, 100));
Expand All @@ -304,14 +306,14 @@
});

// Call safeDeserialize but don't await it (it will never resolve due to termination)
safeDeserialize(
mockSerdes,
data,
TEST_CONSTANTS.STEP_ID_1,
undefined,
mockTerminationManager,
TEST_CONSTANTS.DURABLE_EXECUTION_ARN,
);

Check warning on line 316 in packages/aws-durable-execution-sdk-js/src/errors/serdes-errors/serdes-errors.test.ts

View workflow job for this annotation

GitHub Actions / lint / lint

lint/nursery/noFloatingPromises

A "floating" Promise was found, meaning it is not properly handled and could lead to ignored errors or unexpected behavior.

// Wait a small amount of time for the async operations to complete
await new Promise((resolve) => setTimeout(resolve, 100));
Expand All @@ -330,14 +332,14 @@
mockSerdes.deserialize.mockRejectedValue(originalError);

// Call safeDeserialize but don't await it (it will never resolve due to termination)
safeDeserialize(
mockSerdes,
data,
TEST_CONSTANTS.STEP_ID_1,
TEST_CONSTANTS.STEP_NAME,
mockTerminationManager,
TEST_CONSTANTS.DURABLE_EXECUTION_ARN,
);

Check warning on line 342 in packages/aws-durable-execution-sdk-js/src/errors/serdes-errors/serdes-errors.test.ts

View workflow job for this annotation

GitHub Actions / lint / lint

lint/nursery/noFloatingPromises

A "floating" Promise was found, meaning it is not properly handled and could lead to ignored errors or unexpected behavior.

// Wait a small amount of time for the async operations to complete
await new Promise((resolve) => setTimeout(resolve, 100));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ export async function safeSerialize<T>(
terminationManager: TerminationManager,
durableExecutionArn: string,
): Promise<string | undefined> {
// A terminated invocation records nothing further, so its result is not needed. A serdes
// can also write the value somewhere, such as a file keyed by the step. On Lambda Managed
// Instances a step can return after the deadline, when the retry may have written the same
// value already. So no serialization starts after termination.
if (terminationManager.isTerminationRequested()) {
return new Promise<string | undefined>(() => {});
}
try {
const context: SerdesContext = {
entityId: stepId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe("Invoke Handler Two-Phase Execution", () => {
getStepData: vi.fn().mockReturnValue(null),
terminationManager: {
terminate: vi.fn(),
isTerminationRequested: vi.fn().mockReturnValue(false),
},
durableExecutionArn: "test-arn",
isOperationUpdatedBetweenInvocation: vi.fn().mockReturnValue(false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ describe("InvokeHandler - plugin hooks", () => {
} as any;
mockContext = {
getStepData: vi.fn().mockReturnValue(undefined),
terminationManager: { terminate: vi.fn() },
terminationManager: {
terminate: vi.fn(),
isTerminationRequested: vi.fn().mockReturnValue(false),
},
durableExecutionArn: "test-arn",
isOperationUpdatedBetweenInvocation: vi.fn().mockReturnValue(false),
} as any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ describe("InvokeHandler", () => {
getStepData: vi.fn().mockReturnValue(undefined),
terminationManager: {
terminate: vi.fn(),
isTerminationRequested: vi.fn().mockReturnValue(false),
},
durableExecutionArn: "test-arn",
isOperationUpdatedBetweenInvocation: vi.fn().mockReturnValue(false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const header =
"Root=1-5759e988-bd862e3fe1be46a994272793;Parent=53995c3f42cd8ad8;Sampled=1";
const lambdaContext: Context = {
awsRequestId: "request",
getRemainingTimeInMillis: () => 0,
getRemainingTimeInMillis: () => 300_000,
callbackWaitsForEmptyEventLoop: false,
functionName: "parent",
functionVersion: "1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,8 @@ describe("Run In Child Context Integration Tests", () => {
[hashId("1")]: {
Id: "1",
Type: OperationType.CONTEXT,
Name: "test-replay-child-context",
SubType: "RunInChildContext",
StartTimestamp: new Date(),
Status: OperationStatus.SUCCEEDED,
ContextDetails: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe("Run In Child Context Handler Two-Phase Execution", () => {
terminationManager: {
shouldTerminate: vi.fn().mockReturnValue(false),
terminate: vi.fn(),
isTerminationRequested: vi.fn().mockReturnValue(false),
},
} as any;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ describe("RunInChildContext Handler - plugin hooks", () => {
vi.resetAllMocks();
mockExecutionContext = {
_stepData: {},
terminationManager: { terminate: vi.fn() },
terminationManager: {
terminate: vi.fn(),
isTerminationRequested: vi.fn().mockReturnValue(false),
},
getStepData: vi.fn((stepId: string) => {
return getStepData(mockExecutionContext._stepData, stepId);
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe("Run In Child Context Handler", () => {
_stepData: {},
terminationManager: {
terminate: vi.fn(),
isTerminationRequested: vi.fn().mockReturnValue(false),
getTerminationPromise: vi.fn(),
},
mutex: {
Expand Down Expand Up @@ -716,6 +717,7 @@ describe("runInChildContext with custom serdes", () => {
_stepData: {},
terminationManager: {
terminate: vi.fn(),
isTerminationRequested: vi.fn().mockReturnValue(false),
},
getStepData: vi.fn((stepId: string) => {
return getStepData(mockExecutionContext._stepData, stepId);
Expand Down Expand Up @@ -1000,6 +1002,7 @@ describe("runWithContext Integration", () => {
_stepData: {},
terminationManager: {
terminate: vi.fn(),
isTerminationRequested: vi.fn().mockReturnValue(false),
getTerminationPromise: vi.fn(),
},
mutex: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ describe("runInChildContext serdes round-trip", () => {
[hashId("1")]: {
Id: "1",
Type: OperationType.CONTEXT,
Name: "large-child",
SubType: "RunInChildContext",
StartTimestamp: new Date(),
Status: OperationStatus.SUCCEEDED,
ContextDetails: {
Expand Down
Loading
Loading