feat(http): also retry on transient status code 520#111
Conversation
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
descope/etc#14039
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
🐕 Review complete — View session on Shuni Portal 🐾 |
🐕 Suggested ReviewersThe review assignment prioritizes recent contributors who have worked directly on the changed files, ensuring they are knowledgeable about the specific code sections affected, and covers different areas to scrutinize the update thoroughly.
Suggested by Shuni based on git history and PR context. Names are not @-mentioned to avoid notifying anyone — request a review from whoever fits best. |
There was a problem hiding this comment.
🐕 Shuni's Review
Adds Cloudflare status code 520 to the HTTP client's retryable status codes, with matching docstring and test-data updates.
No issues found — good bones! Change is consistent across the constant, the docstring, and the test provider; 520 is correctly grouped with the other transient Cloudflare 52x codes. Woof!
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) <noreply@anthropic.com>
Summary
Add Cloudflare status code
520("Web Server Returned an Unknown Error") to the HTTP client's retryable status codes, alongside the existing503/521/522/524/530.Like the other Cloudflare 52x codes already retried,
520is a transient edge error returned when the origin is briefly unreachable (e.g. during pod replacement on deploy), so the request is safe to retry. Follow-up to #104; brings this SDK in line with go-sdk (descope/go-sdk#775), python-sdk (descope/python-sdk#1581) and core-js-sdk (descope/descope-js#1423).https://github.com/descope/etc/issues/14039
Also: CI dependency fix (separate commit)
CI was red on
mainfor every PR: #106 bumpedphpunit/phpunitto^12.0.0incomposer.jsonbut never updatedcomposer.lock(still9.6.33), socomposer installfails dependency resolution. phpunit 12 also requires PHP 8.3+, incompatible with the 7.4/8.1 CI matrix. This PR reverts the constraint to^9.6.21— the valuecomposer.lockwas last generated against (#71) — restoring a consistent, installable set. No lockfile change is needed (unchanged since #71).Test plan
520toretryableStatusCodeProviderinAPIRetryTest.php🤖 Generated with Claude Code