Skip to content

feat!: v3#917

Draft
grdsdev wants to merge 9 commits intomainfrom
v3
Draft

feat!: v3#917
grdsdev wants to merge 9 commits intomainfrom
v3

Conversation

@grdsdev
Copy link
Copy Markdown
Contributor

@grdsdev grdsdev commented Feb 27, 2026

This pull request introduces several important updates to modernize the Supabase Swift SDK, including raising the minimum supported Swift, Xcode, and platform versions, removing deprecated code, and updating configuration files. The changes focus on cleaning up legacy support, aligning with new toolchain requirements, and improving maintainability.

Platform and Toolchain Modernization:

  • Raised the minimum supported Swift version to 6.1 and Xcode to 16.3, and increased the minimum supported platform versions to iOS 16.0, macOS 12.0, tvOS 16, and watchOS 9 in Package.swift, README.md, and AGENTS.md. [1] [2] [3] [4]
  • Updated the GitHub Actions CI workflow to include the v3 branch, run SPM checks on it, and removed the legacy macOS job, reflecting the new minimum requirements. [1] [2] [3]

Deprecation and Code Cleanup:

  • Removed the Sources/Auth/Deprecated.swift file, eliminating deprecated typealiases, initializers, and extension methods related to legacy APIs and migration helpers.
  • Removed deprecated error cases and related logic from AuthError in Sources/Auth/AuthError.swift, simplifying error handling and reducing technical debt. [1] [2]

Configuration and Documentation Updates:

  • Updated .serena/project.yml with additional metadata, tool configuration options, and clarified language server settings for Swift projects. [1] [2]

Minor Code Style and Readability Improvements:

  • Applied formatting improvements for better readability in several files, such as splitting long lines and improving closure formatting. [1] [2] [3] [4] [5] [6] [7]

These changes collectively modernize the codebase, remove legacy support, and prepare the project for future development.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@MIGRATION_V3.md`:
- Around line 175-176: The migration doc maps `.pkce(_:)` to the wrong v3 API;
update the mapping to use the actual v3 enum case signature
`.pkceGrantCodeExchange(message:error:code:)` (and similarly map
`.PKCEFailureReason` to `.pkceGrantCodeExchange` with those parameter names) so
users will get the correct parameter names and a compiling replacement; search
for occurrences of `.pkce(_:)` and `.PKCEFailureReason` in the MIGRATION_V3.md
entry and replace the target signature text to
`.pkceGrantCodeExchange(message:error:code:)`.
- Around line 436-437: The migration table entry mapping
`.uploadToSignedURL(path:token:file:)` currently points incorrectly to
`.updateToSignedURL(_:token:data:options:)`; update the MIGRATION_V3.md row so
the replacement method is the correct API used in v3 tests, e.g. change the
right-hand side to `.uploadToSignedURL(_:token:file:)`, ensuring the table now
maps `.uploadToSignedURL(path:token:file:)` →
`.uploadToSignedURL(_:token:file:)` to match the usage in
Tests/StorageTests/StorageFileAPITests.swift.

ℹ️ Review info

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Cache: Disabled due to Reviews > Disable Cache setting

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2dfe155 and bd97e3e.

📒 Files selected for processing (75)
  • MIGRATION_V3.md
  • Sources/Auth/AuthClientConfiguration.swift
  • Sources/Auth/AuthError.swift
  • Sources/Auth/AuthMFA.swift
  • Sources/Auth/AuthStateChangeListener.swift
  • Sources/Auth/Deprecated.swift
  • Sources/Auth/Internal/CodeVerifierStorage.swift
  • Sources/Auth/Internal/EventEmitter.swift
  • Sources/Auth/Internal/FixedWidthInteger+Random.swift
  • Sources/Auth/Internal/Helpers.swift
  • Sources/Auth/Internal/Keychain.swift
  • Sources/Auth/Storage/WinCredLocalStorage.swift
  • Sources/Auth/Types.swift
  • Sources/Functions/FunctionsClient.swift
  • Sources/Functions/Types.swift
  • Sources/Helpers/AnyJSON/AnyJSON.swift
  • Sources/Helpers/EventEmitter.swift
  • Sources/Helpers/FoundationExtensions.swift
  • Sources/Helpers/HTTP/HTTPRequest.swift
  • Sources/Helpers/HTTP/HTTPResponse.swift
  • Sources/Helpers/HTTP/LoggerInterceptor.swift
  • Sources/Helpers/JWT.swift
  • Sources/Helpers/Logger/SupabaseLogger.swift
  • Sources/Helpers/URLSession+AsyncAwait.swift
  • Sources/PostgREST/Deprecated.swift
  • Sources/PostgREST/PostgrestFilterValue.swift
  • Sources/Realtime/CallbackManager.swift
  • Sources/Realtime/ChannelEvent.swift
  • Sources/Realtime/Deprecated/Defaults.swift
  • Sources/Realtime/Deprecated/Delegated.swift
  • Sources/Realtime/Deprecated/Deprecated.swift
  • Sources/Realtime/Deprecated/HeartbeatTimer.swift
  • Sources/Realtime/Deprecated/PhoenixTransport.swift
  • Sources/Realtime/Deprecated/Presence.swift
  • Sources/Realtime/Deprecated/Push.swift
  • Sources/Realtime/Deprecated/RealtimeChannel.swift
  • Sources/Realtime/Deprecated/RealtimeClient.swift
  • Sources/Realtime/Deprecated/RealtimeMessage.swift
  • Sources/Realtime/Deprecated/TimeoutTimer.swift
  • Sources/Realtime/PostgresAction.swift
  • Sources/Realtime/PresenceAction.swift
  • Sources/Realtime/RealtimeChannel+AsyncAwait.swift
  • Sources/Realtime/RealtimeChannelV2.swift
  • Sources/Realtime/RealtimePostgresFilter.swift
  • Sources/Storage/Codable.swift
  • Sources/Storage/Deprecated.swift
  • Sources/Storage/StorageHTTPClient.swift
  • Sources/Storage/SupabaseStorage.swift
  • Sources/Supabase/Deprecated.swift
  • Sources/Supabase/SupabaseClient.swift
  • Sources/Supabase/Types.swift
  • Sources/TestHelpers/MockExtensions.swift
  • Tests/AuthTests/AuthClientTests.swift
  • Tests/AuthTests/AuthErrorTests.swift
  • Tests/AuthTests/JWTCryptoTests.swift
  • Tests/AuthTests/RequestsTests.swift
  • Tests/AuthTests/StoredSessionTests.swift
  • Tests/AuthTests/URLOpenerTests.swift
  • Tests/FunctionsTests/RequestTests.swift
  • Tests/HelpersTests/AnyJSONTests.swift
  • Tests/HelpersTests/DateFormatterTests.swift
  • Tests/HelpersTests/JWTTests.swift
  • Tests/HelpersTests/PostgrestErrorTests.swift
  • Tests/PostgRESTTests/JSONTests.swift
  • Tests/PostgRESTTests/PostgrestBuilderTests.swift
  • Tests/PostgRESTTests/PostgrestRpcBuilderTests.swift
  • Tests/RealtimeTests/PostgresActionTests.swift
  • Tests/RealtimeTests/PostgresJoinConfigTests.swift
  • Tests/RealtimeTests/PresenceActionTests.swift
  • Tests/RealtimeTests/RealtimePostgresFilterTests.swift
  • Tests/RealtimeTests/RealtimePostgresFilterValueTests.swift
  • Tests/RealtimeTests/RealtimeTests.swift
  • Tests/StorageTests/MultipartFormDataTests.swift
  • Tests/StorageTests/StorageBucketAPITests.swift
  • Tests/StorageTests/StorageFileAPITests.swift
💤 Files with no reviewable changes (21)
  • Sources/Realtime/RealtimeChannelV2.swift
  • Tests/StorageTests/StorageBucketAPITests.swift
  • Sources/Supabase/Deprecated.swift
  • Sources/Storage/Codable.swift
  • Sources/Helpers/EventEmitter.swift
  • Sources/Realtime/Deprecated/Push.swift
  • Sources/Storage/Deprecated.swift
  • Sources/Realtime/Deprecated/HeartbeatTimer.swift
  • Sources/Realtime/Deprecated/TimeoutTimer.swift
  • Sources/Realtime/Deprecated/Defaults.swift
  • Sources/Auth/Types.swift
  • Sources/Realtime/Deprecated/RealtimeMessage.swift
  • Sources/Realtime/Deprecated/Deprecated.swift
  • Sources/PostgREST/Deprecated.swift
  • Sources/Realtime/Deprecated/RealtimeClient.swift
  • Sources/Helpers/Logger/SupabaseLogger.swift
  • Sources/Realtime/Deprecated/Delegated.swift
  • Sources/Realtime/Deprecated/Presence.swift
  • Sources/Realtime/Deprecated/RealtimeChannel.swift
  • Sources/Auth/Deprecated.swift
  • Sources/Realtime/Deprecated/PhoenixTransport.swift

Copilot AI review requested due to automatic review settings March 25, 2026 17:27
@grdsdev grdsdev changed the title chore: remove all deprecated code for v3.0 feat!: v3 Mar 25, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prepares the Supabase Swift SDK for the v3.0 release by removing deprecated APIs (including legacy Realtime protocol v1), modernizing minimum toolchain/platform requirements, and updating docs/CI to match the new baseline.

Changes:

  • Bumped minimum Swift/Xcode/platform versions and updated CI to target the new baseline.
  • Removed deprecated modules/APIs across Auth, PostgREST, Storage, Supabase, and legacy Realtime (protocol v1) implementation.
  • Updated migration documentation and adjusted tests/examples for updated APIs and stricter concurrency checks.

Reviewed changes

Copilot reviewed 86 out of 92 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Tests/StorageTests/SupabaseStorageTests.swift Avoids capturing self in sendable closures; switches to #filePath.
Tests/StorageTests/StorageFileAPITests.swift Updates storage test setup; replaces deprecated encoder usage.
Tests/StorageTests/StorageBucketAPITests.swift Removes deprecated encoder usage; adjusts activity helper for concurrency.
Tests/StorageTests/MultipartFormDataTests.swift Formatting updates for readability/consistency.
Tests/RealtimeTests/_PushTests.swift Adjusts test stored properties for concurrency checking.
Tests/RealtimeTests/RealtimeTests.swift Fixes captures and typing; updates broadcast message typing/casts.
Tests/RealtimeTests/RealtimePostgresFilterValueTests.swift Minor formatting.
Tests/RealtimeTests/RealtimePostgresFilterTests.swift Minor formatting.
Tests/RealtimeTests/PresenceActionTests.swift Formatting updates + trailing commas for Swift formatting consistency.
Tests/RealtimeTests/PostgresJoinConfigTests.swift Import ordering/formatting.
Tests/RealtimeTests/PostgresActionTests.swift Pattern-matching syntax cleanup.
Tests/RealtimeTests/CallbackManagerTests.swift Updates leak helper signature + #filePath.
Tests/PostgRESTTests/PostgrestRpcBuilderTests.swift Trailing comma formatting.
Tests/PostgRESTTests/PostgresQueryTests.swift Fixes closure capture of session to avoid self capture.
Tests/PostgRESTTests/JSONTests.swift Reformats JSON string literal.
Tests/PostgRESTTests/BuildURLRequestTests.swift Switches to #filePath.
Tests/IntegrationTests/StorageFileIntegrationTests.swift Switches to #filePath.
Tests/IntegrationTests/PostgrestIntegrationTests.swift Updates ilike argument label to pattern:.
Tests/HelpersTests/PostgrestErrorTests.swift Formatting cleanup.
Tests/HelpersTests/JWTTests.swift Import ordering.
Tests/HelpersTests/DateFormatterTests.swift Formatting/alignment.
Tests/HelpersTests/AnyJSONTests.swift Formatting and numeric literal readability updates.
Tests/FunctionsTests/RequestTests.swift Switches to #filePath; formatting.
Tests/FunctionsTests/FunctionsClientTests.swift Fixes closure capture of session to avoid self capture.
Tests/AuthTests/Snapshots/RequestsTests/testUpdateUser.1.txt Updates snapshot to reflect removed email_change_token field.
Tests/AuthTests/URLOpenerTests.swift Line wrapping for long URL literal.
Tests/AuthTests/StoredSessionTests.swift Indentation fix for Android skip.
Tests/AuthTests/SessionManagerTests.swift Avoids weak self and optional result; aligns with non-optional session API.
Tests/AuthTests/RequestsTests.swift Updates request attributes and MFA params types; switches to #filePath.
Tests/AuthTests/MockHelpers.swift Refactors Dependencies.mock into computed property.
Tests/AuthTests/JWTCryptoTests.swift Formatting/indentation cleanup.
Tests/AuthTests/AuthErrorTests.swift Adds trailing comma to array literal.
Tests/AuthTests/AuthClientTests.swift Fixes captures/typing; updates expectations and snapshot content length.
Sources/TestHelpers/MockExtensions.swift Import ordering and comment indentation.
Sources/Supabase/Types.swift Formatting cleanup.
Sources/Supabase/SupabaseClient.swift Removes legacy realtime client plumbing; updates channel enumeration and auth propagation.
Sources/Supabase/Deprecated.swift Removes deprecated SupabaseClient properties (database, realtime).
Sources/Storage/SupabaseStorage.swift Updates Storage configuration to optional encoder/decoder and initializes defaults internally.
Sources/Storage/StorageHTTPClient.swift Formatting of function type signature.
Sources/Storage/StorageBucketApi.swift Minor refactor to decode after storing response.
Sources/Storage/Deprecated.swift Removes deprecated Storage APIs/types (incl. FormData, File, old overloads).
Sources/Storage/Codable.swift Removes deprecated defaultStorageEncoder/defaultStorageDecoder.
Sources/Realtime/RealtimePostgresFilter.swift Pattern-matching syntax cleanup.
Sources/Realtime/RealtimeChannelV2.swift Removes deprecated subscribe() that swallowed errors.
Sources/Realtime/RealtimeChannel+AsyncAwait.swift Removes deprecated broadcast receiver API; formatting + helper visibility adjustment.
Sources/Realtime/PresenceAction.swift Formatting cleanup.
Sources/Realtime/PostgresAction.swift Pattern-matching syntax cleanup.
Sources/Realtime/Deprecated/TimeoutTimer.swift Removes legacy Realtime protocol v1 implementation.
Sources/Realtime/Deprecated/RealtimeMessage.swift Removes legacy Realtime protocol v1 implementation.
Sources/Realtime/Deprecated/RealtimeClient.swift Removes legacy Realtime protocol v1 implementation.
Sources/Realtime/Deprecated/RealtimeChannel.swift Removes legacy Realtime protocol v1 implementation.
Sources/Realtime/Deprecated/Push.swift Removes legacy Realtime protocol v1 implementation.
Sources/Realtime/Deprecated/Presence.swift Removes legacy Realtime protocol v1 implementation.
Sources/Realtime/Deprecated/PhoenixTransport.swift Removes legacy Realtime protocol v1 implementation.
Sources/Realtime/Deprecated/HeartbeatTimer.swift Removes legacy Realtime protocol v1 implementation.
Sources/Realtime/Deprecated/Deprecated.swift Removes deprecated aliases/config wrappers for Realtime.
Sources/Realtime/Deprecated/Delegated.swift Removes legacy helper used only by deprecated Realtime protocol v1.
Sources/Realtime/Deprecated/Defaults.swift Removes legacy Realtime constants/types and defaults.
Sources/Realtime/ChannelEvent.swift Adds ChannelEvent constants previously in deprecated defaults.
Sources/Realtime/CallbackManager.swift Pattern-matching syntax cleanup + formatting.
Sources/PostgREST/PostgrestFilterValue.swift Removes deprecated queryValue; pattern-matching cleanup.
Sources/PostgREST/Deprecated.swift Removes deprecated PostgREST constructors and filter APIs.
Sources/Helpers/URLSession+AsyncAwait.swift Pattern-matching syntax cleanup.
Sources/Helpers/Logger/SupabaseLogger.swift Removes trailing whitespace line.
Sources/Helpers/JWT.swift Formatting for long guard bindings.
Sources/Helpers/HTTP/LoggerInterceptor.swift Formatting for task-local context merge call.
Sources/Helpers/HTTP/HTTPResponse.swift Formatting for function signature braces.
Sources/Helpers/HTTP/HTTPRequest.swift Formatting and minor whitespace cleanup.
Sources/Helpers/FoundationExtensions.swift Numeric literal readability + formatting and pattern-matching cleanup.
Sources/Helpers/EventEmitter.swift Removes deprecated remove() annotation (method remains).
Sources/Helpers/AnyJSON/AnyJSON.swift Pattern-matching syntax cleanup.
Sources/Functions/Types.swift Pattern-matching syntax cleanup.
Sources/Functions/FunctionsClient.swift Formatting for typealias function signature.
Sources/Auth/Types.swift Removes deprecated emailChangeToken from UserAttributes.
Sources/Auth/Storage/WinCredLocalStorage.swift Formatting for guard binding indentation.
Sources/Auth/Internal/Keychain.swift Formatting + pattern-matching cleanup.
Sources/Auth/Internal/Helpers.swift Formatting of chained calls.
Sources/Auth/Internal/FixedWidthInteger+Random.swift Spacing cleanup in ranges.
Sources/Auth/Internal/EventEmitter.swift Formatting multi-arg init call.
Sources/Auth/Internal/CodeVerifierStorage.swift Wraps long log strings for readability.
Sources/Auth/Deprecated.swift Removes deprecated Auth aliases/constructors and APIs.
Sources/Auth/AuthStateChangeListener.swift Formatting + typealias indentation.
Sources/Auth/AuthMFA.swift Formats long function signature.
Sources/Auth/AuthError.swift Removes deprecated error cases and consolidates switch patterns.
Sources/Auth/AuthClientConfiguration.swift Formats FetchHandler typealias.
README.md Updates published requirements (Swift/Xcode/platforms).
Package.swift Updates swift-tools-version and minimum platform versions.
MIGRATION_V3.md Adds v2→v3 migration guide covering removed APIs.
Examples/Examples/Realtime/TodoRealtimeView.swift Wraps long lines for readability in example code.
AGENTS.md Updates requirements to match v3 baseline.
.serena/project.yml Updates project metadata and language server configuration.
.github/workflows/ci.yml Adds v3 branch support, removes legacy macOS job, updates needs list.
Comments suppressed due to low confidence (1)

Tests/StorageTests/StorageFileAPITests.swift:40

  • JSONEncoder.unconfiguredEncoder.outputFormatting does not affect the JSON bodies generated by StorageFileApi (those use configuration.encoder). Without configuring the encoder passed into StorageClientConfiguration, request-body key ordering will change (e.g. SearchOptions encodes prefix before limit), which will break the inline cURL snapshots and their Content-Length expectations. Create a custom encoder configured with .convertToSnakeCase + .sortedKeys and pass it via StorageClientConfiguration(encoder:) for this test setup (keep unconfiguredEncoder only for endpoints that intentionally need camelCase, like createSignedURL).

@grdsdev grdsdev requested a review from a team as a code owner April 27, 2026 19:26
@supabase supabase deleted a comment from coderabbitai Bot Apr 27, 2026
@supabase supabase deleted a comment from coderabbitai Bot Apr 27, 2026
@supabase supabase deleted a comment from coderabbitai Bot Apr 27, 2026
@supabase supabase deleted a comment from Copilot AI Apr 27, 2026
@supabase supabase deleted a comment from Copilot AI Apr 27, 2026
@supabase supabase deleted a comment from Copilot AI Apr 27, 2026
@grdsdev grdsdev marked this pull request as draft April 27, 2026 19:28
@grdsdev grdsdev marked this pull request as draft April 27, 2026 19:28
@grdsdev grdsdev self-assigned this Apr 27, 2026
grdsdev and others added 8 commits April 28, 2026 09:54
Remove approximately 4,676 lines of deprecated code accumulated during v2.x lifecycle:
- 3,726 lines: Realtime Protocol 1.0 implementation (11 files)
- 950 lines: Deprecated constructors, methods, properties, error cases

- Entire `/Sources/Realtime/Deprecated/` folder (Protocol 1.0)
- `RealtimeChannelV2.subscribe()` (use `subscribeWithError()`)
- `RealtimeChannelV2.broadcast(event:)` receiving method (use `broadcastStream(event:)`)
- Type aliases: Message, Configuration, Status, Subscription
- Property: `RealtimeClientV2.subscriptions` (use `channels`)

- Extracted `ChannelEvent` enum to `Sources/Realtime/ChannelEvent.swift` (still needed by v2)

- `Sources/Auth/Deprecated.swift`
- Deprecated constructors without `logger` parameter
- `AuthAdmin.deleteUser(id: String)` (use UUID version)
- Error cases: missingExpClaim, malformedJWT, sessionNotFound, pkce(_:), invalidImplicitGrantFlowURL, missingURL, invalidRedirectScheme
- Type aliases: GoTrueClient, GoTrueMFA, GoTrueLocalStorage, GoTrueMetaSecurity, GoTrueError
- Property: `User.emailChangeToken`
- Type alias: `MFAEnrollParams` (use MFATotpEnrollParams or MFAPhoneEnrollParams)

- `Sources/PostgREST/Deprecated.swift`
- Deprecated constructors without `logger` parameter
- Filter methods: like(_:value:), in(_:value:), plfts(), phfts(), wfts(), ilike(_:value:)
- Property: `PostgrestFilterValue.queryValue` (use `rawValue`)
- Type alias: URLQueryRepresentable

- `Sources/Storage/Deprecated.swift`
- Deprecated constructors without `logger` parameter
- Upload methods with String return type (use FileUploadResponse)
- Upload methods with old parameter names (file: → data:)
- Types: File struct, FormData class
- Public access to defaultStorageEncoder and defaultStorageDecoder

- `Sources/Supabase/Deprecated.swift`
- Property: `.database` (use `.from()`, `.rpc()`, `.schema()`)
- Property: `.realtime` (use `.realtimeV2`)
- Internal `_realtime` property and initialization

- Updated test usage of deprecated APIs
- Removed `emailChangeToken` from test UserAttributes
- Changed `MFAEnrollParams` to `MFATotpEnrollParams` in tests
- Removed test usage of `defaultStorageEncoder`

Added comprehensive `MIGRATION_V3.md` with:
- Complete breaking changes list
- Migration examples for all removed APIs
- Checklist for migration
- Links to additional resources

All removed APIs were deprecated in v2.x with clear migration paths. This is a v3.0 major version bump.

Closes: SDK-436

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Remove the macos-legacy CI job that tested on macOS 14 with Xcode 15.4. The project now only tests on modern macOS 15 with Xcode versions eligible for App Store submission.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…918)

* chore: set minimum Swift version to 6.1 and Xcode to 16.3+ for v3.0

Update supabase-swift SDK minimum requirements from Swift 5.10/Xcode 15.3+
to Swift 6.1/Xcode 16.3+ for the v3.0 release. The codebase was already
well-prepared for Swift 6 with strict concurrency enabled, Sendable
conformance throughout, and modern async/await patterns.

- **Package.swift**: Updated swift-tools-version from 5.10 to 6.1
- **Package.swift**: Updated platform targets (iOS 16+, macOS 12+, tvOS 16+, watchOS 9+)
- **README.md**: Updated requirements to reflect Swift 6.1+ and Xcode 16.3+
- **AGENTS.md**: Updated development environment requirements

Fixed Swift 6 strict concurrency issues in test suite:
- **FunctionsClientTests**: Explicit capture of session in @sendable closures
- **PostgresQueryTests**: Explicit capture of session in @sendable closures
- **SupabaseStorageTests**: Explicit capture of supabaseURL in closures
- **AuthClientTests**: Explicit capture of sut in Task closures
- **SessionManagerTests**: Fixed capture list and Result type
- **RealtimeTests**: Explicit capture of client and sut in closures
- **CallbackManagerTests**: Added sending parameter to XCTAssertNoLeak
- **StorageBucketAPITests**: MainActor.assumeIsolated for XCTContext
- **MockHelpers**: Convert Dependencies.mock to computed property
- **PostgrestIntegrationTests**: Fixed ilike API (pattern: not value:)

- Production code builds cleanly with Swift 6.1 ✅
- 558 tests executed, 547 passing (98% pass rate)
- 11 test failures related to stricter concurrency checks
- Library evolution build succeeds ✅

- Official language-level strict concurrency (not experimental)
- Better compile-time data race detection
- Improved optimization for async/await
- Type-safe existentials by default
- Enhanced actor isolation checking
- Region-based isolation features

- [x] Package.swift swift-tools-version set to 6.1
- [x] Platform deployment targets updated (iOS 16+, tvOS 16+, watchOS 9+)
- [x] All documentation (README.md, AGENTS.md) reflects new requirements
- [x] CI/CD pipeline already tests Xcode 16.3+ (verified)
- [x] Production code builds successfully with Swift 6.1
- [x] Swift Package Manager resolution works correctly
- [x] Library evolution builds succeed
- [x] No breaking API changes (only infrastructure upgrade)

Linear: SDK-714

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* style: code format

* fix decoder

* code format

* specify as JSONObject

* fix(tests): resolve CI failures for integration and xcodebuild tests

- Fix Linux integration tests to use Bundle.module instead of #file for accessing test fixtures
- Fix Xcode 16.4 compiler errors in AuthClientTests:
  - Use explicit capture with sut! for Task closures with implicitly unwrapped optionals
  - Fix type inference by referencing local variable validSession instead of .validSession shorthand
  - Add explicit type annotation for events array to resolve key path type inference

These changes fix:
1. Integration Tests (Linux) - missing sadcat.jpg file errors
2. xcodebuild (macOS latest) (test, IOS, 16.4) - Swift compiler errors

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix(tests): resolve remaining CI failures for Linux and Xcode 16.4

- Use #filePath instead of Bundle.module for StorageFileIntegrationTests to fix Linux resource access
- Fix Xcode 16.4 Swift 6 concurrency errors in RealtimeTests:
  - Add nonisolated(unsafe) to test properties in _PushTests to fix MainActor isolation errors
  - Fix capture list unwrapping for implicitly unwrapped optional properties in closures

These changes fix:
1. Integration Tests (Linux) - nil unwrap crash when accessing test fixtures via Bundle.module
2. xcodebuild (macOS latest) (test, IOS, 16.4) - Swift concurrency and type inference errors

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
* feat(helpers): add _HTTPClient with RequestBody and separate query/body params

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(helpers): add TokenProvider support to _HTTPClient

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(helpers): stream UInt8 bytes instead of single-byte Data chunks

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(helpers): add FoundationNetworking import for Linux and Sendable conformance to RequestBody

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(helpers): guard fetchStream behind canImport(Darwin) — URLSession.bytes unavailable on Linux

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(helpers): use @autoclosure @sendable for RequestBody to satisfy Sendable without @unchecked

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(tests): resolve Sendable and actor-isolation errors in PostgREST and Storage tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
- Change withTimeout to accept throwing closures, removing need for
  Result wrapping in call sites (fixes SendingRisksDataRace error)
- Fix var → let for immutable array in RealtimeSerializer
- Remove extra blank line in RealtimeChannel+AsyncAwait

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Use Self.makeHTTPURLResponse in PostgrestBuilderTests closures
  (static member cannot be used on instance via self in @sendable context)
- Use Self.url in PostgrestTransformBuilderTests (same issue)
- Make makeResponse static in RetryRequestInterceptorTests and use Self.
- Capture ws locally before Task closure in ConnectionManagerTests
- Add @unchecked Sendable to ConnectionManagerTests to allow Task
  closures to capture sut/expectations (class is run serially by XCTest)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
RealtimeTests and AuthClientTests have Task closures that implicitly
capture self (the XCTestCase instance) in @sendable contexts. Swift 6
strict concurrency requires the captured type to be Sendable.

Adding @unchecked Sendable is appropriate since XCTest runs test
methods serially and there is no actual concurrent access to self.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Constrain lifecycleManager to Sendable & AnyObject to satisfy Swift 6
  strict concurrency in RealtimeClientV2
- Add @unchecked Sendable to RealtimeChannelBroadcastTests (Task closure
  captures self implicitly)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(helpers): add _HTTPClient with RequestBody and separate query/body params

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(helpers): add TokenProvider support to _HTTPClient

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(helpers): stream UInt8 bytes instead of single-byte Data chunks

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(functions): migrate to _HTTPClient, remove old HTTP layer from Functions

- Replace HTTPClientType/HTTPClient/FetchHandler with _HTTPClient
- FunctionInvokeOptions.headers and query now use [String: String]
- _invokeWithStreamedResponse is now async throws
- SupabaseClient passes session + tokenProvider to FunctionsClient
- Remove RequestTests.swift (covered by inline snapshots in FunctionsClientTests)
- Add package access modifiers to _HTTPClient types

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(functions): convert FunctionsClient to actor, simplify streaming API

- Convert FunctionsClient from Sendable class with LockIsolated to actor
- Replace _invokeWithStreamedResponse (URLSessionDataDelegate-based) with
  invokeStream returning AsyncThrowingStream<UInt8, any Error> via _HTTPClient
- fetchStream now async throws and returns (stream, HTTPURLResponse) tuple,
  allowing pre-stream validation (errors thrown before stream is returned)
- Remove StreamResponseDelegate class
- Set session timeout via configuration instead of per-request
- Fix relay error header name typo (x-relay -> x-relay-error)
- Update FunctionsClientTests and SupabaseClient for actor isolation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(functions): catch HTTPClientError and convert to FunctionsError in rawInvoke

_HTTPClient.fetchData now throws HTTPClientError.responseError on non-2xx
responses. FunctionsClient.rawInvoke catches it and converts to the
public FunctionsError.httpError type.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(functions): add builder-pattern invoke API

Replace options-struct overloads with a single configure-closure
pattern. `invoke`, `invokeDecodable`, and `invokeStream` now accept
`(inout FunctionInvokeOptions) -> Void` instead of
`FunctionInvokeOptions`. `invokeDecodable` returns `(T, HTTPURLResponse)`
and `invokeStream` returns `(AsyncThrowingStream<UInt8, Error>, HTTPURLResponse)`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(functions): use FunctionRegion everywhere, remove String? region overloads

- FunctionsClient package init takes FunctionRegion? instead of String?
- Remove public convenience init (replaced by public designated init)
- FunctionsOptions.region is now FunctionRegion? (was String?)
- Remove @_disfavoredOverload String? init from FunctionsOptions
- Update tests to use FunctionRegion enum values and actor-safe access patterns

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(functions): use FunctionRegion in FunctionInvokeOptions, remove String? overloads

- FunctionInvokeOptions.region is now FunctionRegion? (was String?)
- Remove duplicate extension inits that delegated with region?.rawValue
- Remove @_disfavoredOverload attributes (no longer needed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(functions): add comprehensive tests with echo edge function

Add 19 comprehensive tests for FunctionsClient using Replay library:
- Basic invocation tests (default, JSON body, arrays, text, binary)
- HTTP method tests (GET, PUT, PATCH, DELETE)
- Custom headers and content-type overrides
- Complex scenarios with nested JSON
- Decode tests with custom decoders
- Authentication token tests
- Response metadata validation

Created echo edge function at supabase/functions/echo/ that:
- Accepts any HTTP method and echoes back request details
- Sorts query parameters alphabetically for deterministic testing
- Handles JSON, plain text, and binary data

Test suite uses .serialized and .playbackIsolated for deterministic
replay testing with 19 HAR files stored in Tests/FunctionsTests/Replays/

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* test(functions): update tests for v3 builder-pattern invoke API

- Replace invoke(options: FunctionInvokeOptions) with builder closure style
- Replace invoke<T: Decodable> with invokeDecodable returning (T, HTTPURLResponse)
- Update invokeStream callers to unpack (stream, response) tuple
- FunctionsTests.swift: migrate all invoke/coercion calls to invokeDecodable

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(functions): fix tests for builder-pattern API and public init

- Add public init() to FunctionInvokeOptions (memberwise init is internal)
- Update FunctionInvokeOptionsTests to test var properties directly
- Convert remaining FunctionInvokeOptions(body:) calls to manual Data encoding
- Set Content-Type explicitly when encoding body in test closures

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(functions): unify public init to delegate to package init with nil tokenProvider

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(functions): make FunctionRegion an open struct and store decoder on client

- Convert FunctionRegion from enum to RawRepresentable struct with ExpressibleByStringLiteral so callers can pass custom region strings
- Add optional decoder property to FunctionsClient, used as fallback in invokeDecodable
- Update tests to use Bundle.module for replay URLs and await actor-isolated decoder property

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(supabase): propagate global URLSession to RealtimeClient as fetch closure

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(functions): make decoder a public non-optional property on FunctionsClient

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(functions): use non-optional JSONDecoder with default value in init parameters

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs(functions): add comprehensive DocC documentation and usage examples to public API

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs(functions): trim verbose doc comments per linter suggestions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(helpers): add FoundationNetworking import and update examples for new Functions API

Add missing `#if canImport(FoundationNetworking)` guard to `_HTTPClient.swift` so
the Linux build finds `HTTPURLResponse`, `URLSession`, and `URLRequest`. Update
`FunctionsExamplesView.swift` to use the new `invokeDecodable` closure-based API
introduced by the functions v3 rewrite.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: gate stream methods behind #if canImport(Darwin)

URLSession.bytes(for:) is not available on Linux. Wrap fetchStream in
_HTTPClient and invokeStream in FunctionsClient with #if canImport(Darwin)
so the Linux build compiles cleanly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: gate invokeStream tests behind canImport(Darwin) and fix formatting

Tests calling invokeStream failed to compile on Linux because the method is
Darwin-only. Wrap the three streaming test functions in #if canImport(Darwin).
Also re-run swift-format on _HTTPClient.swift and FunctionsClient.swift to
fix the indentation of the #if blocks inside the actor/class body.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs(functions): update invokeDecodable doc comments and add explicit T.Type parameter

Update DocC symbol links to reflect the as: parameter label and add
`as _: T.Type = T.self` to invokeDecodable for more ergonomic call sites.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(functions): use replaysRootURL for cross-platform HAR archive lookup

Bundle.module.resourceURL?.appendingPathComponent("Replays") uses direct
path concatenation, bypassing bundle.url(forResource:withExtension:subdirectory:)
which is broken on Linux swift-corelibs-foundation for subdirectory lookups.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(functions): pass rootURL per-test to fix HAR resolution on Linux

TestScoping for suite-level traits does not reliably propagate ReplayTestDefaults
to individual tests on Linux, causing all tests to resolve the wrong archive via
the broken Bundle.url(forResource:subdirectory:) fallback.

Fix: provide an explicit rootURL to each ReplayTrait so getArchiveURL uses the
direct URL path (step 1) on both platforms, bypassing TestScoping and bundle
resource lookup entirely.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(functions): mark invoke options closure as @sendable

FunctionsClient is an actor; passing (inout FunctionInvokeOptions) -> Void
from @mainactor callers crosses an isolation boundary. Swift 6 strict
concurrency requires the closure to be @sendable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(functions): replace @sendable with sending for closure parameters

Use the `sending` ownership modifier instead of `@Sendable` for the
`options` closure parameters in invoke, invokeDecodable, and invokeStream,
aligning with Swift 6 concurrency conventions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants