Commit c3e4f3b
Keep query replay history-authoritative for unresolved child workflow calls
When a workflow yields a ChildWorkflowCall during query replay,
QueryStateReplayer::run() was checking the child's DB row status first
and only falling back to the "wait at this step" path if none of the
child's runs had reached a terminal status. That made cross-run DB
state (a racing child worker, a repair pass, or a test that manipulates
the child directly) leak into query replay: the query would report the
workflow "past" the child call even though the parent's own history
had no ChildRunCompleted / ChildRunFailed / ChildRunCancelled event
yet. Workflow history is meant to be the only source of truth for
parent replay, so this was an event-sourcing purity regression — and
it's exactly the shape that caused the test to observe
"stage: child-resolved" when the fixture only had ChildWorkflowScheduled
persisted.
Reorder the replay branch so it consults
`ChildRunHistory::parentHistoryBlocksResolutionWithoutEvent()` BEFORE
falling back to the child's terminal DB status. If the parent has
already committed a Scheduled/Started event for this sequence without
a resolution event, hold the replay at the call regardless of what
the child row says. Only when neither history nor the child DB state
can tell us anything do we fall through to the existing derived
resolution paths.
Also: bucket `testActivityTaskBridgeHeartbeatReportsCancellationAndClosesAttempt`
and `testWorkflowActivityHeartbeatPersistsAttemptMetadata` were asserting
string-identical on values the engine has semantically tightened. The
first test reaches a state where the run has been cancelled (not just
the attempt), so `ActivityOutcomeRecorder` correctly reports
'run_cancelled' instead of the more generic 'stale_attempt'; adopt the
tighter value. The heartbeat test compares MySQL JSON column contents
by literal array order, same fix as the rest of the #399 run: use
`assertSameJsonObject` so key order is normalized.
Clears 3 MySQL failures under #399:
* testQueriesKeepWaitingForChildUntilParentCommitsChildResolutionHistory
* testActivityTaskBridgeHeartbeatReportsCancellationAndClosesAttempt
* testWorkflowActivityHeartbeatPersistsAttemptMetadata
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 4c1a5c0 commit c3e4f3b
2 files changed
Lines changed: 17 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
327 | 340 | | |
328 | 341 | | |
329 | 342 | | |
| |||
357 | 370 | | |
358 | 371 | | |
359 | 372 | | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | 373 | | |
366 | 374 | | |
367 | 375 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
559 | 559 | | |
560 | 560 | | |
561 | 561 | | |
562 | | - | |
| 562 | + | |
563 | 563 | | |
564 | 564 | | |
565 | 565 | | |
566 | 566 | | |
567 | 567 | | |
568 | 568 | | |
569 | 569 | | |
570 | | - | |
571 | | - | |
| 570 | + | |
| 571 | + | |
572 | 572 | | |
573 | 573 | | |
574 | 574 | | |
| |||
1597 | 1597 | | |
1598 | 1598 | | |
1599 | 1599 | | |
1600 | | - | |
| 1600 | + | |
1601 | 1601 | | |
1602 | 1602 | | |
1603 | 1603 | | |
| |||
0 commit comments