Skip to content

Commit 543c0ec

Browse files
Realign repair/lineage tests with engine durable-resume invariants
Five MySQL test failures in #399's bucket C (semantic drift) all share the same root cause: tests built fixtures that bypassed the engine's "durable resume path requires typed history" invariant. The engine now correctly returns workflow_replay_blocked or parent-perspective Waiting status for runs whose mutable rows have no backing typed history events. Tests now align with the invariant by either: 1. Adding the typed history event the engine expects to anchor the resume path (TimerScheduled / ActivityScheduled). 2. Asserting the parent-perspective status the lineage view derives from typed parent history. Clears 5 CI-only MySQL failures under #399: * testTaskWatchdogRecreatesMissingTimerTaskForRepairNeededRun * testTaskWatchdogReclaimsExpiredActivityTaskLease * testTaskWatchdogReclaimsExpiredTimerTaskLease * testRepairRecreatesMissingActivityTaskForPendingActivityExecution * testRunDetailViewKeepsCurrentContinuedChildFromHistoryWhenLinksDisappear Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b5ce150 commit 543c0ec

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

tests/Feature/V2/V2RunDetailViewTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2598,7 +2598,7 @@ public function testRunDetailViewKeepsCurrentContinuedChildFromHistoryWhenLinksD
25982598
$this->assertSame('child_workflow', $detail['continuedWorkflows'][0]['link_type']);
25992599
$this->assertSame($childCallId, $detail['continuedWorkflows'][0]['child_call_id']);
26002600
$this->assertSame($currentChildRun->id, $detail['continuedWorkflows'][0]['child_workflow_run_id']);
2601-
$this->assertSame($currentChildRun->status->value, $detail['continuedWorkflows'][0]['status']);
2601+
$this->assertSame(RunStatus::Waiting->value, $detail['continuedWorkflows'][0]['status']);
26022602
$this->assertSame($currentChildRun->workflow_type, $detail['continuedWorkflows'][0]['workflow_type']);
26032603
}
26042604

tests/Feature/V2/V2WorkflowTest.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6042,6 +6042,13 @@ public function testTaskWatchdogRecreatesMissingTimerTaskForRepairNeededRun(): v
60426042
->addSeconds(25),
60436043
]);
60446044

6045+
WorkflowHistoryEvent::record($run, HistoryEventType::TimerScheduled, [
6046+
'timer_id' => $timer->id,
6047+
'sequence' => 1,
6048+
'delay_seconds' => 30,
6049+
'fire_at' => $timer->fire_at?->toJSON(),
6050+
]);
6051+
60456052
$summary = RunSummaryProjector::project(
60466053
$run->fresh(['instance', 'tasks', 'activityExecutions', 'timers', 'failures', 'historyEvents'])
60476054
);
@@ -6280,6 +6287,13 @@ public function testTaskWatchdogReclaimsExpiredActivityTaskLease(): void
62806287
->subSeconds(25),
62816288
]);
62826289

6290+
WorkflowHistoryEvent::record($run, HistoryEventType::ActivityScheduled, [
6291+
'activity_execution_id' => $execution->id,
6292+
'activity_class' => TestGreetingActivity::class,
6293+
'activity_type' => TestGreetingActivity::class,
6294+
'sequence' => 1,
6295+
]);
6296+
62836297
/** @var WorkflowTask $task */
62846298
$task = WorkflowTask::query()->create([
62856299
'workflow_run_id' => $run->id,
@@ -6499,6 +6513,13 @@ public function testTaskWatchdogReclaimsExpiredTimerTaskLease(): void
64996513
->addSeconds(20),
65006514
]);
65016515

6516+
WorkflowHistoryEvent::record($run, HistoryEventType::TimerScheduled, [
6517+
'timer_id' => $timer->id,
6518+
'sequence' => 1,
6519+
'delay_seconds' => 30,
6520+
'fire_at' => $timer->fire_at?->toJSON(),
6521+
]);
6522+
65026523
/** @var WorkflowTask $task */
65036524
$task = WorkflowTask::query()->create([
65046525
'workflow_run_id' => $run->id,
@@ -7115,6 +7136,13 @@ public function testRepairRecreatesMissingActivityTaskForPendingActivityExecutio
71157136
'queue' => 'activities',
71167137
]);
71177138

7139+
WorkflowHistoryEvent::record($run, HistoryEventType::ActivityScheduled, [
7140+
'activity_execution_id' => $execution->id,
7141+
'activity_class' => TestGreetingActivity::class,
7142+
'activity_type' => TestGreetingActivity::class,
7143+
'sequence' => 1,
7144+
]);
7145+
71187146
$summary = RunSummaryProjector::project(
71197147
$run->fresh(['instance', 'tasks', 'activityExecutions', 'timers', 'failures', 'historyEvents'])
71207148
);

0 commit comments

Comments
 (0)