Commit e9ce909
committed
fix(run-store): keep completed waitpoints that have no batch index
A completed waitpoint with no batch index was invisible to every Redis read, so
a run resumed from the store lost that wait's result while Postgres still
returned it. That is every wait.for, every single triggerAndWait and every
token: the engine passes index as batchIndex ?? undefined, so only waits inside
a batch carry one.
The cause was reading the id set out of the ordered list. That list is the index
oracle and its positions ARE the indexes, so it can only ever hold indexed ids,
and deduping it yields a set missing exactly the index-less ones. Postgres has no
such restriction: its completed-waitpoint join records every id.
The cycle key now carries the complete distinct set in its own field, written
when the cycle is minted and read back beside the order. The order keeps its
meaning and stays index-only.
Two tests: one asserting an index-less wait survives a round trip with an empty
order, and one asserting the set matches the Postgres join for a mix of indexed
and index-less waits. Verified by deriving the set from the order again, which
makes the waitpoint vanish.
The suites missed this because every earlier case gave each waitpoint an index.1 parent e03a185 commit e9ce909
2 files changed
Lines changed: 103 additions & 6 deletions
File tree
- internal-packages/run-store/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
32 | 45 | | |
33 | 46 | | |
34 | 47 | | |
| |||
270 | 283 | | |
271 | 284 | | |
272 | 285 | | |
| 286 | + | |
273 | 287 | | |
274 | 288 | | |
275 | 289 | | |
276 | 290 | | |
277 | 291 | | |
278 | 292 | | |
| 293 | + | |
279 | 294 | | |
280 | 295 | | |
281 | 296 | | |
| |||
300 | 315 | | |
301 | 316 | | |
302 | 317 | | |
303 | | - | |
| 318 | + | |
| 319 | + | |
304 | 320 | | |
305 | 321 | | |
306 | 322 | | |
| |||
407 | 423 | | |
408 | 424 | | |
409 | 425 | | |
410 | | - | |
| 426 | + | |
411 | 427 | | |
412 | 428 | | |
413 | 429 | | |
| |||
588 | 604 | | |
589 | 605 | | |
590 | 606 | | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
591 | 614 | | |
592 | 615 | | |
593 | 616 | | |
| |||
607 | 630 | | |
608 | 631 | | |
609 | 632 | | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
610 | 636 | | |
611 | 637 | | |
612 | 638 | | |
| |||
641 | 667 | | |
642 | 668 | | |
643 | 669 | | |
644 | | - | |
| 670 | + | |
645 | 671 | | |
646 | 672 | | |
647 | 673 | | |
| |||
736 | 762 | | |
737 | 763 | | |
738 | 764 | | |
739 | | - | |
| 765 | + | |
740 | 766 | | |
741 | 767 | | |
742 | 768 | | |
| |||
848 | 874 | | |
849 | 875 | | |
850 | 876 | | |
851 | | - | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
852 | 882 | | |
853 | | - | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
854 | 887 | | |
855 | 888 | | |
856 | 889 | | |
| |||
873 | 906 | | |
874 | 907 | | |
875 | 908 | | |
| 909 | + | |
876 | 910 | | |
877 | 911 | | |
878 | 912 | | |
| |||
Lines changed: 63 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
245 | 308 | | |
246 | 309 | | |
247 | 310 | | |
| |||
0 commit comments