Skip to content

Commit 26c587b

Browse files
Fold full retry-policy snapshot shape into v2 retry tests
ActivityRetryPolicy::snapshot() has always emitted all eight snapshot fields (snapshot_version, max_attempts, backoff_seconds, four *_timeout fields, non_retryable_error_types), but two assertSame sites only declared three. Order-sensitive under SQLite this happened to coincide but hit "two arrays identical" on MySQL because the extra keys arrived. Declare the full shape and switch to assertSameJsonObject so key-order differences between PHP literal and MySQL JSON storage don't fail the comparison. Also convert two heartbeat progress comparisons to assertSameJsonObject for the same reason (test builds the progress literal, stores through MySQL JSON column, reads back with normalized key order). Refs #399 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b81a943 commit 26c587b

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

tests/Feature/V2/V2WorkflowTest.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,10 +1108,15 @@ public function testActivityRetriesBeforeResumingWorkflow(): void
11081108
$this->assertSame(ActivityStatus::Pending, $execution->refresh()->status);
11091109
$this->assertSame('failed', $firstAttempt->status->value);
11101110
$this->assertSame(1, $execution->attempt_count);
1111-
$this->assertSame([
1111+
$this->assertSameJsonObject([
11121112
'snapshot_version' => 1,
11131113
'max_attempts' => 2,
11141114
'backoff_seconds' => [5],
1115+
'start_to_close_timeout' => null,
1116+
'schedule_to_start_timeout' => null,
1117+
'schedule_to_close_timeout' => null,
1118+
'heartbeat_timeout' => null,
1119+
'non_retryable_error_types' => [],
11151120
], $execution->retry_policy);
11161121
$this->assertSame(1, $retryTask->attempt_count);
11171122
$this->assertSame($execution->id, $retryTask->payload['activity_execution_id'] ?? null);
@@ -1365,7 +1370,7 @@ public function testActivityTaskBridgeClaimsHeartbeatsAndCompletesAttemptWithout
13651370
->where('event_type', HistoryEventType::ActivityHeartbeatRecorded->value)
13661371
->sole();
13671372

1368-
$this->assertSame($progress, $heartbeat->payload['progress'] ?? null);
1373+
$this->assertSameJsonObject($progress, $heartbeat->payload['progress'] ?? null);
13691374

13701375
$this->assertSame($claim['activity_attempt_id'], $completed->payload['activity_attempt_id'] ?? null);
13711376
$this->assertSame(1, $completed->payload['attempt_number'] ?? null);
@@ -1432,10 +1437,15 @@ public function testActivityTaskBridgeUsesSnappedRetryPolicyForExternalFailures(
14321437
->firstOrFail();
14331438

14341439
$this->assertSame(ActivityStatus::Pending, $execution->status);
1435-
$this->assertSame([
1440+
$this->assertSameJsonObject([
14361441
'snapshot_version' => 1,
14371442
'max_attempts' => 2,
14381443
'backoff_seconds' => [5],
1444+
'start_to_close_timeout' => null,
1445+
'schedule_to_start_timeout' => null,
1446+
'schedule_to_close_timeout' => null,
1447+
'heartbeat_timeout' => null,
1448+
'non_retryable_error_types' => [],
14391449
], $execution->retry_policy);
14401450
$this->assertSame($execution->id, $retryTask->payload['activity_execution_id'] ?? null);
14411451
$this->assertSame(
@@ -1789,7 +1799,7 @@ public function testActivityHeartbeatRenewsCurrentAttemptLease(): void
17891799
$this->assertSame($attempt->id, $heartbeat->payload['activity_attempt_id'] ?? null);
17901800
$this->assertSame($heartbeatAt->toJSON(), $heartbeat->payload['heartbeat_at'] ?? null);
17911801
$this->assertSame($leaseExpiresAt->toJSON(), $heartbeat->payload['lease_expires_at'] ?? null);
1792-
$this->assertSame($expectedProgress, $heartbeat->payload['progress'] ?? null);
1802+
$this->assertSameJsonObject($expectedProgress, $heartbeat->payload['progress'] ?? null);
17931803
$this->assertSame($heartbeatAt->toJSON(), $heartbeat->payload['activity']['last_heartbeat_at'] ?? null);
17941804
$this->assertSame($task->id, $heartbeat->workflow_task_id);
17951805
} finally {

0 commit comments

Comments
 (0)