Skip to content

Commit 4c1a5c0

Browse files
Use JSON-key-order-agnostic assertions + waitFor child on status drift tests
MySQL 8 JSON columns sort keys by (length, alpha), which doesn't match the literal-array order tests wrote. Swap three remaining assertSame([...], $json_column) comparisons over to assertSameJsonObject so they round-trip identically on MySQL and SQLite — matching the pattern in 414843a / b81a943 / 26c587b. Also: testWorkflowSummaryProjectsChildWaitAndHealthyRepairNoOp loaded the child run before the child workflow task had executed, which left it in the RunStatus::Pending bucket — then the test asserted 'waiting'. The intent is to observe the child in its parked-for-timer state, so add a waitFor on the child's RunStatus transitioning to Waiting before sampling. Clears 3 MySQL failures under #399: * testStartRecordsBusinessKeyAndLabels * testWorkflowCanContinueAsNewAcrossRuns * testWorkflowSummaryProjectsChildWaitAndHealthyRepairNoOp * testNestedParallelActivityAllWaitsForOuterActivityBeforeResumingParent… * testWorkflowCanWaitForChildWorkflowAndCompleteWithChildOutput Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 81e3688 commit 4c1a5c0

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

tests/Feature/V2/V2WorkflowControlPlaneTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,11 +345,11 @@ public function testStartRecordsBusinessKeyAndLabels(): void
345345

346346
$run = WorkflowRun::query()->find($result['workflow_run_id']);
347347
$this->assertSame('order-12345', $run->business_key);
348-
$this->assertSame([
348+
$this->assertSameJsonObject([
349349
'team' => 'payments',
350350
'env' => 'staging',
351351
], $run->visibility_labels);
352-
$this->assertSame([
352+
$this->assertSameJsonObject([
353353
'description' => 'Test workflow',
354354
], $run->memo);
355355
}

tests/Feature/V2/V2WorkflowTest.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2717,7 +2717,7 @@ public function testWorkflowCanContinueAsNewAcrossRuns(): void
27172717

27182718
$this->assertSame('workflow', $secondRunStart->source);
27192719
$this->assertSame('Workflow', $secondRunStart->callerLabel());
2720-
$this->assertSame([
2720+
$this->assertSameJsonObject([
27212721
'parent_instance_id' => 'continue-instance',
27222722
'parent_run_id' => $runs[0]->id,
27232723
'sequence' => 2,
@@ -2726,7 +2726,7 @@ public function testWorkflowCanContinueAsNewAcrossRuns(): void
27262726

27272727
$this->assertSame('workflow', $thirdRunStart->source);
27282728
$this->assertSame('Workflow', $thirdRunStart->callerLabel());
2729-
$this->assertSame([
2729+
$this->assertSameJsonObject([
27302730
'parent_instance_id' => 'continue-instance',
27312731
'parent_run_id' => $runs[1]->id,
27322732
'sequence' => 2,
@@ -2858,7 +2858,7 @@ public function testWorkflowCanWaitForChildWorkflowAndCompleteWithChildOutput():
28582858

28592859
$this->assertSame('workflow', $childStart->source);
28602860
$this->assertSame('Workflow', $childStart->callerLabel());
2861-
$this->assertSame([
2861+
$this->assertSameJsonObject([
28622862
'parent_instance_id' => 'parent-child-instance',
28632863
'parent_run_id' => $parentRunId,
28642864
'sequence' => 1,
@@ -2909,8 +2909,13 @@ public function testWorkflowSummaryProjectsChildWaitAndHealthyRepairNoOp(): void
29092909
->where('link_type', 'child_workflow')
29102910
->sole();
29112911

2912+
$childRunId = $link->child_workflow_run_id;
2913+
$this->waitFor(
2914+
static fn (): bool => WorkflowRun::query()->findOrFail($childRunId)->status === RunStatus::Waiting
2915+
);
2916+
29122917
/** @var WorkflowRun $childRun */
2913-
$childRun = WorkflowRun::query()->findOrFail($link->child_workflow_run_id);
2918+
$childRun = WorkflowRun::query()->findOrFail($childRunId);
29142919
$summary = $workflow->summary();
29152920

29162921
$this->assertSame('waiting', $workflow->status());
@@ -3537,7 +3542,7 @@ public function testNestedParallelActivityAllWaitsForOuterActivityBeforeResuming
35373542
->sole(static fn (WorkflowHistoryEvent $event): bool => ($event->payload['sequence'] ?? null) === 3);
35383543

35393544
$this->assertSame('parallel-activities:1:3', $firstActivityScheduled->payload['parallel_group_id'] ?? null);
3540-
$this->assertSame([
3545+
$this->assertSameJsonObject([
35413546
[
35423547
'parallel_group_id' => 'parallel-activities:1:3',
35433548
'parallel_group_kind' => 'activity',
@@ -3548,7 +3553,7 @@ public function testNestedParallelActivityAllWaitsForOuterActivityBeforeResuming
35483553
], $firstActivityScheduled->payload['parallel_group_path'] ?? null);
35493554

35503555
$this->assertSame('parallel-activities:2:2', $secondActivityScheduled->payload['parallel_group_id'] ?? null);
3551-
$this->assertSame([
3556+
$this->assertSameJsonObject([
35523557
[
35533558
'parallel_group_id' => 'parallel-activities:1:3',
35543559
'parallel_group_kind' => 'activity',
@@ -3566,7 +3571,7 @@ public function testNestedParallelActivityAllWaitsForOuterActivityBeforeResuming
35663571
], $secondActivityScheduled->payload['parallel_group_path'] ?? null);
35673572

35683573
$this->assertSame('parallel-activities:2:2', $thirdActivityScheduled->payload['parallel_group_id'] ?? null);
3569-
$this->assertSame([
3574+
$this->assertSameJsonObject([
35703575
[
35713576
'parallel_group_id' => 'parallel-activities:1:3',
35723577
'parallel_group_kind' => 'activity',

0 commit comments

Comments
 (0)