Conversation
…orage and Functions Auth, PostgREST, Storage and Functions now retry through a single middleware driven by a `RetryPolicy` value: full-jitter capped exponential backoff, `Retry-After` honoured up to the cap, idempotent methods only unless an `Idempotency-Key` header is present, stop on cancellation. The retry rule is per target. PostgREST keeps its fixed postgrest-js rule (GET/HEAD, 503/520, 4 attempts) and only its on/off switch is public; its private loop is deleted. Storage and Functions gain retries for the first time, with a public, configurable `retryPolicy`. Auth keeps retrying POST so token refreshes are replayed. The Realtime reconnect delay carries the same full jitter. BREAKING CHANGE: retry timing changes for every module (jitter instead of a fixed schedule; Auth makes 3 attempts instead of 2), Storage and Functions start retrying transient failures by default, and only `URLError` counts as a retryable transport failure. See V3_MIGRATION.md. Fixes SDK-1791 Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report for CI Build 34894874449Warning No base build found for commit Coverage: 88.099%Details
Uncovered Changes
Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Auth, PostgREST, Storage and Functions now retry through a single middleware driven by a
RetryPolicyvalue: full-jitter capped exponential backoff,Retry-Afterhonoured up to the cap, idempotent methods only unless anIdempotency-Keyheader is present, and an immediate stop on cancellation. Every retry carriesX-Retry-Count: n.The retry rule is per target. PostgREST keeps its fixed postgrest-js rule (GET/HEAD, 503/520, 4 attempts) and only its on/off switch stays public; its private loop is deleted. Storage and Functions gain retries for the first time, with a public, configurable
retryPolicy. Auth keeps retrying POST so token refreshes are replayed. The Realtime reconnect delay carries the same full jitter. OnlyURLErrorcounts as a transport failure; errors thrown by user code propagate untouched.Breaking (behavior only, compiles silently): retry timing changes for every module, Auth makes 3 attempts instead of 2, and Storage/Functions start retrying by default. See the new section in V3_MIGRATION.md.
Review first:
Sources/Helpers/HTTP/RetryPolicy.swift(the delay math andRetry-Afterparsing) andSources/Helpers/HTTP/RetryRequestInterceptor.swift(what is retried). Everything else is wiring.Test evidence
The known issue is pre-existing. New tests:
RetryPolicyTests(jitter bounds, cap,Retry-Afterdelta-seconds / HTTP-date / garbage), a rewrittenRetryRequestInterceptorTests(statuses, methods, idempotency key, attempts, cancellation, bodies, delays,X-Retry-Count), Storage and Functions retry tests, and a PostgREST test pinning that a 500 on GET is never retried.Companion spec drafts for
database.configuration.auto_retryandstorage.configuration.auto_retryare written locally insupabase/sdkand will follow as a separate PR.Fixes SDK-1791