feat!: drop GlobalOptions.session in favor of URLSessionTransport(session:) - #1326
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks 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 |
|
The following capabilities are marked
The following capabilities are marked
These may have been renamed, removed, or never registered. Please update the capability matrix. |
b5fd555 to
0f227f3
Compare
de46518 to
5631925
Compare
…sion:) `SupabaseClientOptions.GlobalOptions` had two ways to configure HTTP: `session` backed the default transport only while `http.transport` was nil, and was also copied into Realtime's WebSocket options. One knob now configures HTTP: pass `URLSessionTransport(session:)` as `GlobalOptions.http.transport`. Realtime's WebSocket session is configured only on `RealtimeClientOptions.session` and no longer inherits a global one. BREAKING CHANGE: `GlobalOptions.init` has no `session:` parameter and `GlobalOptions.session` is removed. See V3_MIGRATION.md. Fixes SDK-1820 Co-Authored-By: Claude <noreply@anthropic.com>
5631925 to
59db72b
Compare
16e90b1
into
guilhermesouza/sdk-1786-expose-one-public-transport-protocol-and-middleware-chain
…sion:) (#1326) `SupabaseClientOptions.GlobalOptions` had two ways to configure HTTP: `session` backed the default transport only while `http.transport` was nil, and was also copied into Realtime's WebSocket options. One knob now configures HTTP: pass `URLSessionTransport(session:)` as `GlobalOptions.http.transport`. Realtime's WebSocket session is configured only on `RealtimeClientOptions.session` and no longer inherits a global one. BREAKING CHANGE: `GlobalOptions.init` has no `session:` parameter and `GlobalOptions.session` is removed. See V3_MIGRATION.md. Fixes SDK-1820 Co-authored-by: Claude <noreply@anthropic.com>
…ss all modules (#1325) * feat(helpers): add HTTPBody, the streaming body for the public transport * docs(helpers): add missing DocC comments to HTTPBody public API * feat(helpers): add ClientTransport, ClientMiddleware and URLSessionTransport * fix(helpers): address review feedback on URLSessionTransport Add missing DocC on send(), clarify the streamed-response buffering comments (unbounded stream, bounded chunk size), document why Content-Length is set explicitly, simplify makeBody, note the buffered-vs-streamed iterationBehavior split on the type doc, and strengthen the buffered-GET test to assert length/iterationBehavior. * refactor(helpers): run HTTPClient over ClientTransport and ClientMiddleware * fix(helpers): drain a discarded response body before retrying * feat(auth)!: replace fetch with transport and middlewares AuthClient.Configuration now takes transport: any ClientTransport and middlewares: [any ClientMiddleware] instead of a raw fetch closure, matching the ClientTransport/ClientMiddleware seam introduced in Helpers. Auth's internal HTTPClient no longer goes through the temporary FetchTransport adapter for its own configuration. SupabaseClient keeps wiring its OpenTelemetry-tracing fetch closure into AuthClient through FetchTransport for now; SupabaseClientOptions.global gains its own transport/middlewares in a follow-up. * feat(postgrest)!: replace fetch with transport and middlewares * fix(postgrest): capture nil body on bodiless requests in test helpers QueryCapture/RequestCapture only called capturedBody.setValue when the request had a body, so a capture instance reused for a later bodiless request kept returning the previous request's body from bodyString. * feat(functions)!: replace fetch with transport and stream responses through it * feat(storage)!: replace StorageHTTPSession with transport and middlewares * feat(realtime)!: replace fetch with transport and middlewares * feat(supabase)!: add global.transport and global.middlewares * fix(supabase): keep caller realtime middlewares and prove middleware ordering * refactor!: delete HTTPRuntime, superseded by the public ClientTransport * docs!: migration guide and compliance for the public transport * fix(helpers): harden logger and file body streaming, serialize Mocker suite, add chunk-split tests * refactor!: group transport and middlewares into HTTPClientConfiguration * docs(helpers): update transport samples for HTTPClientConfiguration * fix(helpers): import FoundationNetworking in HTTPClientTests and register transport symbols `HTTPClientTests` reads `HTTPURLResponse.url`, which lives in FoundationNetworking on Linux; the missing import broke the Linux and Linux integration CI jobs. The capability-matrix check flagged every public member of the new transport API as unregistered. They are now listed under `client.request_configuration.custom_http_client`: the per-module `http` configuration properties as entry points, and the `HTTPBody`, `HTTPClientConfiguration`, `ClientTransport`, `ClientMiddleware` and `URLSessionTransport` members as supporting symbols. Co-Authored-By: Claude <noreply@anthropic.com> * test(helpers): skip the file-body mock assertion on Linux swift-corelibs-foundation keeps a file upload on the URLSessionTask, not on the `URLRequest` that `MockingURLProtocol` observes, so the mock sees no body there and the assertion failed on the Linux CI job. The status and response-body checks still run on every platform. Co-Authored-By: Claude <noreply@anthropic.com> * feat!: drop GlobalOptions.session in favor of URLSessionTransport(session:) (#1326) `SupabaseClientOptions.GlobalOptions` had two ways to configure HTTP: `session` backed the default transport only while `http.transport` was nil, and was also copied into Realtime's WebSocket options. One knob now configures HTTP: pass `URLSessionTransport(session:)` as `GlobalOptions.http.transport`. Realtime's WebSocket session is configured only on `RealtimeClientOptions.session` and no longer inherits a global one. BREAKING CHANGE: `GlobalOptions.init` has no `session:` parameter and `GlobalOptions.session` is removed. See V3_MIGRATION.md. Fixes SDK-1820 Co-authored-by: Claude <noreply@anthropic.com> * perf(helpers): stream responses from a task delegate instead of per-byte AsyncBytes `URLSessionTransport` iterated `URLSession.AsyncBytes` one byte at a time and yielded a chunk at every newline. Against a local Storage server a 200 MiB download took 10 s where curl takes 0.6 s, and the unbounded chunk backlog cost 29 to 44 MB even for a consumer that discards every chunk. The Darwin path now runs a `URLSessionDataDelegate` on the data task: the head is handed back as soon as `didReceive(response:)` fires and every `didReceive(data:)` delivery is one chunk. Same download now takes 0.65 s with a 1 to 2 MB streaming floor. Chunk boundaries follow the network rather than the payload, so the migration note tells SSE consumers to reassemble on the frame separator; the newline-split test is replaced by one that asserts chunks are passed through as received, plus a failure-path test. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
What
Removes
SupabaseClientOptions.GlobalOptions.session. TheURLSessionHTTP goes through is now configured on the transport only:Sources/Supabase/Types.swift: property and init parameter removed, docs updated.Sources/Supabase/SupabaseClient.swift: the resolved transport ishttp.transport ?? URLSessionTransport(); the copy of the global session intoRealtimeClientOptions.sessionis gone.RealtimeClientOptions.session. It no longer inherits a global one.V3_MIGRATION.md: new section "SupabaseClientOptions.GlobalOptions.sessionis removed"; the earlier "GlobalOptions.sessionstays" note under the transport section is deleted.Why
After #1325,
GlobalOptionshad two knobs for HTTP.sessionbacked the default transport only whilehttp.transportwas nil, so a caller who set both silently lost the session for HTTP. It was also copied into Realtime for the WebSocket, which never goes throughClientTransport. One knob now configures HTTP, and Realtime's socket session is set where it lives.Stacked on #1325 (base branch
guilhermesouza/sdk-1786-expose-one-public-transport-protocol-and-middleware-chain). Retarget tomainonce that merges.Test plan
SupabaseClientTests: the two realtime-session propagation tests are replaced by one that checks a Realtime-specific session is preserved and that the HTTP transport's session does not leak into Realtime. Seven other test call sites move fromGlobalOptions(session:)to the transport form with no behavior change.Verification
Fixes SDK-1820