From 7fcfc4594408f6caf5a05a65e0bc0ab5c3d81451 Mon Sep 17 00:00:00 2001 From: dorsha Date: Mon, 22 Jun 2026 18:43:36 +0300 Subject: [PATCH 1/2] feat(http): also retry on transient status code 520 Add Cloudflare status code 520 ("Web Server Returned an Unknown Error") to the HTTP client's retryable status codes, alongside the existing 503/521/522/524/530. Brings this SDK in line with the go-sdk and python-sdk. Relates to https://github.com/descope/etc/issues/14039 Co-Authored-By: Claude Opus 4.8 (1M context) --- src/SDK/API.php | 4 ++-- src/tests/APIRetryTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SDK/API.php b/src/SDK/API.php index 8f616b4..f1b1b94 100644 --- a/src/SDK/API.php +++ b/src/SDK/API.php @@ -15,7 +15,7 @@ class API { - private const RETRYABLE_STATUS_CODES = [503, 521, 522, 524, 530]; + private const RETRYABLE_STATUS_CODES = [503, 520, 521, 522, 524, 530]; private $httpClient; private $projectId; @@ -244,7 +244,7 @@ public function generateJwtResponse(array $responseBody, ?string $refreshToken = /** * Executes an HTTP request callable, retrying on transient status codes - * (503, 521, 522, 524, 530) with delays of 100ms, 5s, 5s. + * (503, 520, 521, 522, 524, 530) with delays of 100ms, 5s, 5s. * Non-retryable RequestExceptions are re-thrown immediately. * * @param callable $requestFn Zero-argument callable that performs the Guzzle request. diff --git a/src/tests/APIRetryTest.php b/src/tests/APIRetryTest.php index ef367e0..e370835 100644 --- a/src/tests/APIRetryTest.php +++ b/src/tests/APIRetryTest.php @@ -62,7 +62,7 @@ public function testRetriesOnRetryableStatusCodeAndSucceedsOnSecondAttempt(int $ public static function retryableStatusCodeProvider(): array { - return [[503], [521], [522], [524], [530]]; + return [[503], [520], [521], [522], [524], [530]]; } public function testRetriesUpToThreeTimesAndThrowsOnExhaustion(): void From 83015b0f0f3b6e1d2264a0037d1493da0c79c1e9 Mon Sep 17 00:00:00 2001 From: dorsha Date: Mon, 22 Jun 2026 18:51:57 +0300 Subject: [PATCH 2/2] fix(ci): revert phpunit to ^9.6.21 to match lockfile and PHP matrix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #106 bumped phpunit/phpunit to ^12.0.0 in composer.json but never updated composer.lock (still pinned at 9.6.33), so `composer install` fails dependency resolution on every PR. phpunit 12 also requires PHP 8.3+, which is incompatible with the 7.4/8.1 CI matrix. Revert the constraint to ^9.6.21 — the value composer.lock was last generated against (#71) — restoring a consistent, installable set. No lockfile change is needed since it is unchanged since #71. Co-Authored-By: Claude Opus 4.8 (1M context) --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b5217ce..0abd128 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "vlucas/phpdotenv": "^5.6.1" }, "require-dev": { - "phpunit/phpunit": "^12.0.0", + "phpunit/phpunit": "^9.6.21", "squizlabs/php_codesniffer": "*" }, "autoload": {