Commit 0c8c2be
authored
fix(sdk): fix waitForCallback determinism and serdes errors (#328)
*Issue #, if available:*
#324
*Description of changes:*
Fixing waitForCallback serdes not working properly. The serdes was only
passed to the `createCallback` result, and `runInChildContext` had the
default serdes (JSON stringify/parse).
Before:
- Any deserialization that happened in createCallback would be lost on
replay, since runInChildContext had the default serdes
- If the serdes passed into createCallback created a string that could
not be serialized or deserialized into JSON, it would fail the execution
- For example, if you deserialized into a structure that had a circular
object, it would fail the execution (even though it's valid to do this)
- waitForCallback and createCallback both required the serdes to include
a `serialization` function, even though it was not used
After:
- Deserialization works both before and after replay
- Now, createCallback is not passed a serdes, and and runInChildContext
uses passThroughSerdes. Deserialization happens on the runInChildContext
result
- We can't pass serdes to runInChildContext since deserialization does
not happen on the initial execution, only on replay. We want this
deserialization to happen on the createCallback string result every time
- Deserialization into circular structures will not fail the execution
- waitForCallback and createCallback only use the `deserialization`
function of serdes.
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.1 parent bc67710 commit 0c8c2be
File tree
10 files changed
+317
-123
lines changed- packages
- aws-durable-execution-sdk-js-examples/src/examples/wait-for-callback/serdes
- aws-durable-execution-sdk-js/src
- context/durable-context
- handlers
- callback-handler
- invoke-handler
- wait-for-callback-handler
- types
10 files changed
+317
-123
lines changedLines changed: 27 additions & 43 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | 9 | | |
37 | 10 | | |
38 | 11 | | |
| |||
46 | 19 | | |
47 | 20 | | |
48 | 21 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | 22 | | |
61 | | - | |
62 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
63 | 34 | | |
64 | 35 | | |
65 | 36 | | |
66 | 37 | | |
67 | 38 | | |
68 | 39 | | |
69 | 40 | | |
70 | | - | |
71 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
72 | 56 | | |
73 | 57 | | |
74 | 58 | | |
| |||
Lines changed: 36 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | 25 | | |
37 | 26 | | |
38 | 27 | | |
| |||
45 | 34 | | |
46 | 35 | | |
47 | 36 | | |
48 | | - | |
49 | 37 | | |
50 | | - | |
| 38 | + | |
51 | 39 | | |
52 | 40 | | |
53 | 41 | | |
54 | | - | |
55 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
56 | 54 | | |
57 | 55 | | |
58 | 56 | | |
59 | 57 | | |
60 | 58 | | |
61 | | - | |
| 59 | + | |
62 | 60 | | |
63 | 61 | | |
64 | 62 | | |
| |||
70 | 68 | | |
71 | 69 | | |
72 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
73 | 86 | | |
74 | 87 | | |
75 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
76 | 93 | | |
77 | 94 | | |
78 | 95 | | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
| 441 | + | |
441 | 442 | | |
442 | 443 | | |
443 | 444 | | |
| |||
Lines changed: 25 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
16 | 20 | | |
17 | 21 | | |
18 | 22 | | |
| |||
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
24 | | - | |
| 28 | + | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
| |||
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
39 | | - | |
40 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
41 | 46 | | |
42 | 47 | | |
43 | 48 | | |
44 | | - | |
| 49 | + | |
45 | 50 | | |
46 | 51 | | |
47 | 52 | | |
| |||
56 | 61 | | |
57 | 62 | | |
58 | 63 | | |
59 | | - | |
| 64 | + | |
60 | 65 | | |
61 | 66 | | |
62 | 67 | | |
| |||
67 | 72 | | |
68 | 73 | | |
69 | 74 | | |
70 | | - | |
| 75 | + | |
71 | 76 | | |
72 | 77 | | |
73 | 78 | | |
| |||
88 | 93 | | |
89 | 94 | | |
90 | 95 | | |
91 | | - | |
| 96 | + | |
92 | 97 | | |
93 | 98 | | |
94 | 99 | | |
95 | 100 | | |
96 | 101 | | |
97 | 102 | | |
98 | 103 | | |
99 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
100 | 107 | | |
101 | 108 | | |
102 | 109 | | |
| |||
161 | 168 | | |
162 | 169 | | |
163 | 170 | | |
164 | | - | |
| 171 | + | |
165 | 172 | | |
166 | 173 | | |
167 | 174 | | |
168 | 175 | | |
169 | 176 | | |
170 | 177 | | |
171 | 178 | | |
172 | | - | |
| 179 | + | |
173 | 180 | | |
174 | 181 | | |
175 | 182 | | |
| |||
196 | 203 | | |
197 | 204 | | |
198 | 205 | | |
199 | | - | |
| 206 | + | |
200 | 207 | | |
201 | 208 | | |
202 | 209 | | |
| |||
221 | 228 | | |
222 | 229 | | |
223 | 230 | | |
224 | | - | |
| 231 | + | |
225 | 232 | | |
226 | 233 | | |
227 | 234 | | |
| |||
246 | 253 | | |
247 | 254 | | |
248 | 255 | | |
249 | | - | |
| 256 | + | |
250 | 257 | | |
251 | 258 | | |
252 | 259 | | |
253 | 260 | | |
254 | 261 | | |
255 | 262 | | |
256 | 263 | | |
257 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
258 | 267 | | |
259 | 268 | | |
260 | 269 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
346 | | - | |
| 346 | + | |
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
| |||
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
405 | | - | |
| 405 | + | |
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
| |||
0 commit comments