Skip to content

Commit 54f4372

Browse files
committed
fix history for create-callback-mixed-ops
1 parent 529b9f6 commit 54f4372

File tree

3 files changed

+45
-35
lines changed

3 files changed

+45
-35
lines changed

packages/aws-durable-execution-sdk-js-examples/src/examples/create-callback/mixed-ops/create-callback-mixed-ops.history.json

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
{
33
"EventType": "ExecutionStarted",
44
"EventId": 1,
5-
"Id": "3143bfd1-a390-4143-bf5c-f015c3c69dc3",
6-
"EventTimestamp": "2025-12-11T23:51:39.590Z",
5+
"Id": "420929c0-50c3-484b-9430-85d4f7b5d5a4",
6+
"EventTimestamp": "2025-12-12T00:05:31.127Z",
77
"ExecutionStartedDetails": {
88
"Input": {
99
"Payload": "{}"
@@ -16,7 +16,7 @@
1616
"EventId": 2,
1717
"Id": "c4ca4238a0b92382",
1818
"Name": "fetch-data",
19-
"EventTimestamp": "2025-12-11T23:51:39.624Z",
19+
"EventTimestamp": "2025-12-12T00:05:31.133Z",
2020
"StepStartedDetails": {}
2121
},
2222
{
@@ -25,7 +25,7 @@
2525
"EventId": 3,
2626
"Id": "c4ca4238a0b92382",
2727
"Name": "fetch-data",
28-
"EventTimestamp": "2025-12-11T23:51:39.624Z",
28+
"EventTimestamp": "2025-12-12T00:05:31.133Z",
2929
"StepSucceededDetails": {
3030
"Result": {
3131
"Payload": "{\"userId\":123,\"name\":\"John Doe\"}"
@@ -39,9 +39,9 @@
3939
"EventId": 4,
4040
"Id": "c81e728d9d4c2f63",
4141
"Name": "process-user",
42-
"EventTimestamp": "2025-12-11T23:51:39.644Z",
42+
"EventTimestamp": "2025-12-12T00:05:31.136Z",
4343
"CallbackStartedDetails": {
44-
"CallbackId": "eyJleGVjdXRpb25JZCI6ImUzZjZkZjhmLTk2NmQtNGRiMi1iYzkzLTQ4NWY5OWE1NWZlNSIsIm9wZXJhdGlvbklkIjoiYzgxZTcyOGQ5ZDRjMmY2MyIsInRva2VuIjoiZTBjMGE1OTgtOTBkYS00ODY1LWIzOWYtNDYxMzY2OWNiZTExIn0=",
44+
"CallbackId": "eyJleGVjdXRpb25JZCI6IjYyMWJiNmVkLTgxYTItNGJjZC1iM2IzLTcxYjljYmIxNDY0MSIsIm9wZXJhdGlvbklkIjoiYzgxZTcyOGQ5ZDRjMmY2MyIsInRva2VuIjoiY2U1NDg5ZTYtZjhjNi00YzYzLWFkYjMtOWY1NGZjNWQ1YjdmIn0=",
4545
"Timeout": 300,
4646
"Input": {}
4747
}
@@ -52,21 +52,21 @@
5252
"EventId": 5,
5353
"Id": "eccbc87e4b5ce2fe",
5454
"Name": "initial-wait",
55-
"EventTimestamp": "2025-12-11T23:51:39.669Z",
55+
"EventTimestamp": "2025-12-12T00:05:31.139Z",
5656
"WaitStartedDetails": {
5757
"Duration": 1,
58-
"ScheduledEndTimestamp": "2025-12-11T23:51:40.669Z"
58+
"ScheduledEndTimestamp": "2025-12-12T00:05:32.139Z"
5959
}
6060
},
6161
{
62-
"EventType": "WaitSucceeded",
63-
"SubType": "Wait",
62+
"EventType": "InvocationCompleted",
6463
"EventId": 6,
65-
"Id": "eccbc87e4b5ce2fe",
66-
"Name": "initial-wait",
67-
"EventTimestamp": "2025-12-11T23:51:39.670Z",
68-
"WaitSucceededDetails": {
69-
"Duration": 1
64+
"EventTimestamp": "2025-12-12T00:05:31.141Z",
65+
"InvocationCompletedDetails": {
66+
"StartTimestamp": "2025-12-12T00:05:31.127Z",
67+
"EndTimestamp": "2025-12-12T00:05:31.141Z",
68+
"Error": {},
69+
"RequestId": "1a48e171-2080-4f28-849a-9b13a6b268f3"
7070
}
7171
},
7272
{
@@ -75,43 +75,54 @@
7575
"EventId": 7,
7676
"Id": "c81e728d9d4c2f63",
7777
"Name": "process-user",
78-
"EventTimestamp": "2025-12-11T23:51:39.671Z",
78+
"EventTimestamp": "2025-12-12T00:05:31.238Z",
7979
"CallbackSucceededDetails": {
8080
"Result": {
81-
"Payload": "{\"processed\":true,\"timestamp\":1765497099653}"
81+
"Payload": "{\"processed\":true,\"timestamp\":1765497931237}"
8282
}
8383
}
8484
},
8585
{
8686
"EventType": "InvocationCompleted",
8787
"EventId": 8,
88-
"EventTimestamp": "2025-12-11T23:51:39.671Z",
88+
"EventTimestamp": "2025-12-12T00:05:31.241Z",
8989
"InvocationCompletedDetails": {
90-
"StartTimestamp": "2025-12-11T23:51:39.590Z",
91-
"EndTimestamp": "2025-12-11T23:51:39.671Z",
90+
"StartTimestamp": "2025-12-12T00:05:31.239Z",
91+
"EndTimestamp": "2025-12-12T00:05:31.241Z",
9292
"Error": {},
93-
"RequestId": "525d4dec-9396-4fd3-a630-55f21c6e7878"
93+
"RequestId": "a39e57be-733f-4623-bd5c-7e9705fb8505"
9494
}
9595
},
9696
{
97-
"EventType": "InvocationCompleted",
97+
"EventType": "WaitSucceeded",
98+
"SubType": "Wait",
9899
"EventId": 9,
99-
"EventTimestamp": "2025-12-11T23:51:39.686Z",
100+
"Id": "eccbc87e4b5ce2fe",
101+
"Name": "initial-wait",
102+
"EventTimestamp": "2025-12-12T00:05:32.139Z",
103+
"WaitSucceededDetails": {
104+
"Duration": 1
105+
}
106+
},
107+
{
108+
"EventType": "InvocationCompleted",
109+
"EventId": 10,
110+
"EventTimestamp": "2025-12-12T00:05:32.142Z",
100111
"InvocationCompletedDetails": {
101-
"StartTimestamp": "2025-12-11T23:51:39.685Z",
102-
"EndTimestamp": "2025-12-11T23:51:39.686Z",
112+
"StartTimestamp": "2025-12-12T00:05:32.139Z",
113+
"EndTimestamp": "2025-12-12T00:05:32.142Z",
103114
"Error": {},
104-
"RequestId": "fe0baf45-05a8-4b36-9c83-179e5ecce4f7"
115+
"RequestId": "bbbdd7de-3c2a-4f9b-acf2-1bc245928289"
105116
}
106117
},
107118
{
108119
"EventType": "ExecutionSucceeded",
109-
"EventId": 10,
110-
"Id": "3143bfd1-a390-4143-bf5c-f015c3c69dc3",
111-
"EventTimestamp": "2025-12-11T23:51:39.686Z",
120+
"EventId": 11,
121+
"Id": "420929c0-50c3-484b-9430-85d4f7b5d5a4",
122+
"EventTimestamp": "2025-12-12T00:05:32.142Z",
112123
"ExecutionSucceededDetails": {
113124
"Result": {
114-
"Payload": "{\"stepResult\":{\"userId\":123,\"name\":\"John Doe\"},\"callbackResult\":\"{\\\"processed\\\":true,\\\"timestamp\\\":1765497099653}\",\"completed\":true}"
125+
"Payload": "{\"stepResult\":{\"userId\":123,\"name\":\"John Doe\"},\"callbackResult\":\"{\\\"processed\\\":true,\\\"timestamp\\\":1765497931237}\",\"completed\":true}"
115126
}
116127
}
117128
}

packages/aws-durable-execution-sdk-js-examples/src/examples/create-callback/mixed-ops/create-callback-mixed-ops.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ createTests({
1212
tests: (runner, { assertEventSignatures }) => {
1313
it("should handle callback operations mixed with other operation types", async () => {
1414
const callbackOperation = runner.getOperation("process-user");
15-
const waitOperation = runner.getOperation("initial-wait");
1615

1716
const executionPromise = runner.run();
1817

1918
// Wait for callback to start (other operations complete synchronously)
2019
await callbackOperation.waitForData(WaitingOperationStatus.STARTED);
2120

22-
// Wait for invocation to complete (when the wait state starts)
23-
await waitOperation.waitForData();
21+
// Wait for invocation to complete
22+
await new Promise((resolve) => setTimeout(resolve, 100));
2423

2524
// Complete the callback
2625
const callbackResult = JSON.stringify({

packages/aws-durable-execution-sdk-js-examples/src/utils/test-helper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export function createTests<ResultType>(testDef: TestDefinition<ResultType>) {
228228
return assertEventSignatures(
229229
testResult.getHistoryEvents(),
230230
JSON.parse(readFileSync(historyFilePath).toString("utf-8")),
231-
isTimeSkipping,
231+
testHelper.isTimeSkipping,
232232
eventSignatureConfig,
233233
);
234234
},
@@ -287,7 +287,7 @@ export function createTests<ResultType>(testDef: TestDefinition<ResultType>) {
287287
beforeAll(() =>
288288
LocalDurableTestRunner.setupTestEnvironment({
289289
...testDef.localRunnerConfig,
290-
skipTime: isTimeSkipping,
290+
skipTime: testHelper.isTimeSkipping,
291291
}),
292292
);
293293
afterAll(() => LocalDurableTestRunner.teardownTestEnvironment());

0 commit comments

Comments
 (0)