Skip to content

Commit 97cfbff

Browse files
Fix HistoryExport retry_policy assertion for JSON key-order variance
MySQL 8's JSON type normalizes object keys by length ascending, so a retry_policy stored as [snapshot_version, max_attempts, backoff_seconds] reads back as [max_attempts, backoff_seconds, snapshot_version]. The in-memory Eloquent cast keeps the original insertion order, so the bundle's policy (reloaded from the DB) and the model's in-memory policy disagree on key order but not on values. `assertSame` is key-order sensitive and failed on every v2 run. Switch the single offending assertion to `assertEquals`, which compares values the way JSON semantics actually are. All 18 HistoryExportTest tests now pass against MySQL 8.
1 parent 1ba6a63 commit 97cfbff

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tests/Unit/V2/HistoryExportTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,10 @@ public function testItBuildsVersionedReplayBundleFromTypedHistoryAndProjections(
429429
$this->assertSame($activity->id, $bundle['activities'][0]['id']);
430430
$this->assertSame($activity->id, $bundle['activities'][0]['idempotency_key']);
431431
$this->assertTrue($bundle['activities'][0]['diagnostic_only']);
432-
$this->assertSame($activity->retry_policy, $bundle['activities'][0]['retry_policy']);
432+
// retry_policy is JSON-cast and key order is not preserved across
433+
// DB engines (MySQL 8 sorts JSON object keys by length). The contract
434+
// is value equality, not insertion order.
435+
$this->assertEquals($activity->retry_policy, $bundle['activities'][0]['retry_policy']);
433436
$this->assertSame($attempt->id, $bundle['activities'][0]['attempts'][0]['id']);
434437
$this->assertSame($childCallId, $bundle['links']['children'][0]['child_call_id']);
435438

0 commit comments

Comments
 (0)