Skip to content

test(postgrest): migrate PostgRESTTests to Swift Testing, keep Mocker (Phase 4)#1095

Merged
grdsdev merged 3 commits into
mainfrom
guilherme/sdk-1251-swift-testing-migration-phase-4-postgresttests
Jul 21, 2026
Merged

test(postgrest): migrate PostgRESTTests to Swift Testing, keep Mocker (Phase 4)#1095
grdsdev merged 3 commits into
mainfrom
guilherme/sdk-1251-swift-testing-migration-phase-4-postgresttests

Conversation

@grdsdev

@grdsdev grdsdev commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrates all 10 files in Tests/PostgRESTTests (~2900 lines) from XCTest to Swift Testing (#expect/#require/@Test/@Suite), per the Phase 0 decision (SDK-1247). Keeps Mocker for HTTP mocking — Replay isn't proven yet for all our cases, so we're sticking with Mocker for now (may revisit later). This is Phase 4 of the migration tracked in SDK-435.

Changes

  • All 10 test files converted to Swift Testing; zero import XCTest remains in the target.
  • Every .snapshotRequest { curl... } curl-body assertion is kept as-is — Mocker gives full query-string/body/header verification for free, so none of the extra matcher machinery an equivalent Replay port would need is necessary here.
  • PostgresQueryTests.swift, an XCTestCase base class shared via inheritance by 5 other test suites, is replaced by a composed PostgrestQueryFixture struct (renamed to PostgrestQueryFixture.swift), since Swift Testing suites don't support shared state through subclassing.
  • PostgrestBuilderTests is a plain struct (no deinit/class needed): the process-global _clock test seam it used to reset was already removed by a separate refactor that injects the clock explicitly per test via makeSUTWithCustomFetch.
  • BuildURLRequestTests keeps its assertSnapshot(as: .curl) request-shape snapshots, switching #file#filePath since Swift Testing resolves #file to a module-relative path (breaks snapshot directory resolution under both swift test and xcodebuild).
  • Carries forward test coverage added to main after this branch's original base: notIn/dryRun/maybeSingle modifier tests and the select(count:) Prefer-header fix test.
  • PostgRESTTests moves off the blanket .swiftLanguageMode(.v5) pin onto full Swift 6 language mode, matching production targets. Drops the unused InlineSnapshotTesting dependency. No new package dependency.

Cross-target Mocker race (found while verifying this PR)

The 5 suites built on PostgrestQueryFixture share Mocker's mock registry, so — same as StorageBucketAPITests/StorageFileAPITests — they're nested under a PostgrestMockerTests(.serialized) namespace so they don't run concurrently with each other.

That alone wasn't enough: Mocker's registry is process-global across the entire test binary, not per target. Running PostgRESTTests and the already-merged StorageTests together reliably failed (swift test --filter "StorageTests|PostgRESTTests"), even though each passed cleanly alone — Swift Testing schedules suites from every compiled test target against one shared executor, so StorageMockerTests and PostgrestMockerTests could still interleave and race on Mocker's shared registry.

Added Sources/TestHelpers/MockerSerialization.swift: a small process-wide async lock exposed as a .mockerSerialized Swift Testing trait, applied directly to every concrete Mocker-backed suite in both StorageTests and PostgRESTTests. It has to be applied suite-by-suite (isRecursive = false), not recursively via the enclosing namespace enums — marking it recursive there crashes Swift Testing's trait-application graph (stack overflow) when the namespace's only nested suites are declared via cross-file extension.

This touches StorageTests (already merged, outside this PR's nominal scope) because leaving it out would mean merging this PR immediately reintroduces full-suite flakiness on main.

Note: the pending Functions PR (#1094), once merged, will need the same .mockerSerialized treatment on FunctionsClientTests — it has its own Mocker-backed Swift Testing suite that will race against these two the same way.

Test plan

  • swift test --filter PostgRESTTests: 105/105 tests, 10 suites, run 6+ times consecutively — no flakiness (up from the original 97 due to tests added to main since).
  • swift test --filter "StorageTests|PostgRESTTests": run 5+ times — reliably failed before the cross-target fix, clean after.
  • Full swift test --skip IntegrationTests: run 3+ times, no regressions.
  • ./scripts/spell-check.sh and ./scripts/format.sh: clean.

Linear

Closes SDK-1251

@grdsdev
grdsdev requested a review from a team as a code owner July 8, 2026 21:11
@coveralls

coveralls commented Jul 8, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 29828798480

Coverage increased (+0.4%) to 83.943%

Details

  • Coverage increased (+0.4%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 6 coverage regressions across 2 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

6 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
Sources/Auth/Internal/Keychain.swift 5 37.23%
Sources/Auth/Storage/KeychainLocalStorage.swift 1 41.67%

Coverage Stats

Coverage Status
Relevant Lines: 9740
Covered Lines: 8176
Line Coverage: 83.94%
Coverage Strength: 1102442.52 hits per line

💛 - Coveralls

grdsdev added a commit that referenced this pull request Jul 9, 2026
Converts the largest AuthTests file (87 tests, 81 Mocker Mock() calls,
53 curl-snapshot assertions) to Swift Testing + Replay, per the Phase 0
decision (SDK-1247) and the Phase 4/Phase 3 conversion patterns
(PostgRESTTests PR #1095, StorageTests PR #1096).

- Curl-snapshot request-shape assertions dropped per the Phase 0 "no
  shim" decision, replaced by Replay's matcher-based enforcement.
- Query strings preserved via exact-URL matching (.method, .url) rather
  than path-only matching, so query-string regressions are still
  caught (the gap PR #1095's follow-up commit found and fixed).
- Request bodies verified via a custom .custom matcher that decodes
  both sides as AnyJSON for structural comparison (key order/whitespace
  insensitive), following the pattern from StorageTests PR #1096's
  jsonBody(of:) helper -- important here since most of this file's
  Mocker bodies carry auth-relevant payloads (passwords, tokens, PKCE
  code verifiers, MFA/passkey credentials).
- withMainSerialExecutor wrapping moved from XCTestCase.invokeTest into
  the handful of @test bodies that actually spawn concurrent
  authStateChanges-driven Tasks.
- HTTPResponse.stub(...) helper (used cross-file by SessionManagerTests)
  preserved at the bottom of the file.

Linear: SDK-1252
grdsdev added a commit that referenced this pull request Jul 9, 2026
… bugs

- RequestsTests.swift: converts the last remaining XCTest/Mocker file.
  These tests only verify request routing (method+path); response
  bodies are minimal but decodable fixtures where AuthClient actually
  decodes a response (Session/User), reusing AuthClientTests' MockData.
- Fixes two real bugs surfaced by actually running the suite (not just
  compiling): AuthClientTests/SessionManagerTests used
  `.method, .url` exact-URL matching, which broke on percent-encoding
  differences between how the stub URL string parses vs. how the live
  request is constructed (e.g. `:`/`/` in a redirect_to query value).
  Switched to `.method, .path, .query` throughout, matching the
  Matcher type's own documented guidance to prefer composed matchers
  over whole-URL comparison.
- SessionManagerTests/AuthClientTests: withMainSerialExecutor mutates
  a process-global flag; Swift Testing runs same-suite tests
  concurrently by default, so mark both suites .serialized to avoid
  cross-test interference, mirroring the _clock precedent in
  PostgrestBuilderTests (PR #1095).
- setSessionWithAFutureExpirationDate/updateUser: fixed stubs that
  decoded the wrong response type (Session vs User) — caught by
  running tests, not visible from a clean compile.

swift build --target AuthTests: 0 errors.
swift test --filter AuthTests: 206/206 passed.

Linear: SDK-1252
grdsdev added 2 commits July 21, 2026 07:19
Same Phase 4 migration as #1095, but stays on Mocker for HTTP mocking
instead of Replay -- Replay isn't proven yet for all our cases, so we
stick with Mocker for now. Restores .snapshotRequest curl-body
assertions everywhere instead of Replay's exact-URL/.query/.custom
matcher scheme (which existed only to claw back query/body coverage
that path-only Replay stubs had silently dropped in #1095's first
pass) -- Mocker gives that coverage for free.

PostgresQueryTests.swift's XCTestCase-inheritance base class becomes a
composed PostgrestQueryFixture struct (renamed file), since Swift
Testing suites don't support shared state through subclassing. The 5
suites built on that fixture (Builder/Filter/Query/Rpc/Transform) share
a process-global Mocker registry, so they're nested under a shared
PostgrestMockerTests(.serialized) namespace to keep them from running
concurrently with each other -- Swift Testing applies .serialized
recursively to nested suites.

PostgrestBuilderTests is a plain struct now, not a class with deinit:
main already refactored PostgrestBuilder off the process-global _clock
test seam (see the clock-DI commit) in favor of explicit per-test clock
injection via makeSUTWithCustomFetch, so the deinit-based global-clock
reset #1095 needed no longer applies.

Ported forward the tests/fixes that landed on main after #1095's branch
point: notIn/dryRun/maybeSingle coverage and the Prefer-header fix.

Linear: SDK-1251
Mocker's mock registry is process-global across the whole test binary,
not just within one test target. StorageTests' StorageMockerTests and
PostgRESTTests' PostgrestMockerTests namespaces each already serialize
their own suites internally (.serialized), but nothing stopped the two
*targets* from running concurrently with each other -- Swift Testing
schedules suites from every compiled test target against one shared
executor. That let one target's Mock.register()/lookup interleave with
the other's, causing intermittent "no matching stub" failures (and, in
one case, silently wrong response data) that only reproduced when both
targets' tests ran together, never in isolation.

Add a small process-wide async lock (Sources/TestHelpers/MockerSerialization.swift)
exposed as a `.mockerSerialized` Swift Testing trait, and apply it directly to
every concrete Mocker-backed suite in both targets (StorageBucketAPITests,
StorageFileAPITests, and the five PostgrestQueryFixture-based suites). The
trait's `isRecursive` must stay false and be applied suite-by-suite, not
recursively via an enclosing namespace: marking it recursive on the
otherwise test-less StorageMockerTests/PostgrestMockerTests enums (whose
nested suites are declared via cross-file `extension`) crashes Swift
Testing's trait-application graph with a stack overflow.

Verified: `swift test --filter "StorageTests|PostgRESTTests"` and the
full suite pass cleanly across many repeated runs; before this fix both
failed close to every time.
Copilot AI review requested due to automatic review settings July 21, 2026 10:38
@grdsdev
grdsdev force-pushed the guilherme/sdk-1251-swift-testing-migration-phase-4-postgresttests branch from 6072467 to 4bf9f25 Compare July 21, 2026 10:38
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7c7e547b-e36d-48ff-9f1e-279ff3514cf0

📥 Commits

Reviewing files that changed from the base of the PR and between 4bf9f25 and 334b571.

📒 Files selected for processing (3)
  • Tests/PostgRESTTests/PostgrestBuilderTests.swift
  • Tests/PostgRESTTests/PostgrestRpcBuilderTests.swift
  • Tests/PostgRESTTests/PostgrestTransformBuilderTests.swift
🚧 Files skipped from review as they are similar to previous changes (3)
  • Tests/PostgRESTTests/PostgrestRpcBuilderTests.swift
  • Tests/PostgRESTTests/PostgrestBuilderTests.swift
  • Tests/PostgRESTTests/PostgrestTransformBuilderTests.swift

📝 Walkthrough

Summary by CodeRabbit

  • Tests
    • Migrated PostgREST tests from XCTest to Swift Testing, updating suite structure, assertions, and payload naming.
    • Added shared PostgREST test fixtures plus serialized mock execution to avoid cross-target interference.
    • Preserved existing coverage across request building, query building, filtering, transforms, RPCs, responses, retries, and JSON decoding, including deterministic request snapshot checks.
    • Updated Swift 6 test-target behavior and adjusted snapshot testing dependency.
    • Removed the previous Postgres query test implementation.
  • Chores
    • Updated the spelling dictionary for development tooling.

Walkthrough

The pull request migrates PostgREST tests from XCTest to Swift Testing, adds shared query fixtures and deterministic request mocking, and introduces process-wide Mocker serialization through a Swift Testing trait. Query, filter, RPC, builder, transform, and Storage suites receive updated annotations and assertions while retaining existing request snapshots and behavioral coverage. Package configuration switches snapshot dependencies and enables Swift 6 checking for PostgREST tests.

Possibly related PRs


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@grdsdev grdsdev changed the title test(postgrest): migrate PostgRESTTests to Swift Testing + Replay (Phase 4) test(postgrest): migrate PostgRESTTests to Swift Testing, keep Mocker (Phase 4) Jul 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Migrates the PostgREST test target from XCTest to Swift Testing while preserving existing Mocker-based request verification, and adds a cross-target serialization trait to prevent Mocker registry races when multiple Swift Testing targets run together.

Changes:

  • Converted Tests/PostgRESTTests suites to Swift Testing (@Suite/@Test + #expect) and replaced shared XCTestCase inheritance with a composed PostgrestQueryFixture.
  • Added a process-wide .mockerSerialized trait in TestHelpers and applied it to Storage/PostgREST Mocker-backed suites to avoid cross-target flakiness.
  • Updated Package.swift to include PostgRESTTests in full Swift 6 checking and removed an unused test dependency.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
Tests/StorageTests/StorageFileAPITests.swift Applies .mockerSerialized to serialize Mocker-backed suite across targets.
Tests/StorageTests/StorageBucketAPITests.swift Documents cross-target Mocker race and applies .mockerSerialized.
Tests/PostgRESTTests/PostgrestTransformBuilderTests.swift Migrates suite to Swift Testing and composes PostgrestQueryFixture.
Tests/PostgRESTTests/PostgrestRpcBuilderTests.swift Migrates RPC builder tests to Swift Testing under serialized Mocker boundary.
Tests/PostgRESTTests/PostgrestResponseTests.swift Converts response unit tests to Swift Testing assertions.
Tests/PostgRESTTests/PostgrestQueryFixture.swift Introduces composed fixture + serialized namespace for PostgREST Mocker suites.
Tests/PostgRESTTests/PostgrestQueryBuilderTests.swift Converts query builder request/behavior tests to Swift Testing.
Tests/PostgRESTTests/PostgrestFilterValueTests.swift Converts filter value unit tests to Swift Testing.
Tests/PostgRESTTests/PostgrestFilterBuilderTests.swift Converts filter builder request-shape tests to Swift Testing.
Tests/PostgRESTTests/PostgrestBuilderTests.swift Converts builder tests (incl. retry tests) to Swift Testing and uses fixture.
Tests/PostgRESTTests/PostgresQueryTests.swift Removes the old XCTest base class in favor of composition.
Tests/PostgRESTTests/JSONTests.swift Converts JSON decoding tests to Swift Testing.
Tests/PostgRESTTests/BuildURLRequestTests.swift Keeps SnapshotTesting curl snapshots; updates to Swift Testing + #filePath.
Sources/TestHelpers/MockerSerialization.swift Adds process-wide async lock + .mockerSerialized Swift Testing trait.
Package.swift Drops unused InlineSnapshotTesting dep for PostgRESTTests and enables Swift 6 mode.
dictionary.txt Adds “subclassing” to cspell dictionary.

Comment thread Tests/PostgRESTTests/PostgrestRpcBuilderTests.swift
Comment thread Tests/PostgRESTTests/PostgrestRpcBuilderTests.swift
Comment thread Tests/PostgRESTTests/PostgrestBuilderTests.swift
Comment thread Tests/PostgRESTTests/PostgrestBuilderTests.swift
Comment thread Tests/PostgRESTTests/PostgrestBuilderTests.swift
Comment thread Tests/PostgRESTTests/PostgrestTransformBuilderTests.swift Outdated
Comment thread Tests/PostgRESTTests/PostgrestTransformBuilderTests.swift Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Tests/PostgRESTTests/PostgrestBuilderTests.swift`:
- Around line 61-68: Add Issue.record("Expected error to be thrown") immediately
after the awaited execute() call in executeWithNonSuccessStatusCode at
Tests/PostgRESTTests/PostgrestBuilderTests.swift#L61-L68 and
executeWithNonJSONError at
Tests/PostgRESTTests/PostgrestBuilderTests.swift#L83-L91, while preserving the
existing PostgrestError assertions in each catch block.

In `@Tests/PostgRESTTests/PostgrestRpcBuilderTests.swift`:
- Around line 88-110: Add an Issue.record("Expected error to be thrown")
immediately after execute() in both
rpcWithGetMethodAndNonJSONObjectShouldThrowError and
rpcWithHeadMethodAndNonJSONObjectShouldThrowError, so each test fails when no
error is thrown while preserving the existing PostgrestError assertions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cc7cdf57-328e-48f2-ba0b-5276c5dd244a

📥 Commits

Reviewing files that changed from the base of the PR and between f1cafe8 and 4bf9f25.

📒 Files selected for processing (16)
  • Package.swift
  • Sources/TestHelpers/MockerSerialization.swift
  • Tests/PostgRESTTests/BuildURLRequestTests.swift
  • Tests/PostgRESTTests/JSONTests.swift
  • Tests/PostgRESTTests/PostgresQueryTests.swift
  • Tests/PostgRESTTests/PostgrestBuilderTests.swift
  • Tests/PostgRESTTests/PostgrestFilterBuilderTests.swift
  • Tests/PostgRESTTests/PostgrestFilterValueTests.swift
  • Tests/PostgRESTTests/PostgrestQueryBuilderTests.swift
  • Tests/PostgRESTTests/PostgrestQueryFixture.swift
  • Tests/PostgRESTTests/PostgrestResponseTests.swift
  • Tests/PostgRESTTests/PostgrestRpcBuilderTests.swift
  • Tests/PostgRESTTests/PostgrestTransformBuilderTests.swift
  • Tests/StorageTests/StorageBucketAPITests.swift
  • Tests/StorageTests/StorageFileAPITests.swift
  • dictionary.txt
💤 Files with no reviewable changes (1)
  • Tests/PostgRESTTests/PostgresQueryTests.swift

Comment thread Tests/PostgRESTTests/PostgrestBuilderTests.swift
Comment thread Tests/PostgRESTTests/PostgrestRpcBuilderTests.swift
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Capability matrix drift detected

The following capabilities are marked implemented in the matrix but could not be found in swift:

  • auth.mfa.enroll → expected symbol: AuthMFA.enrollWebAuthnFactor
  • auth.mfa.verify → expected symbol: AuthMFA.verifyWebAuthnFactor
  • auth.passkey.register_passkey → expected symbol: AuthClient.registerPasskey
  • auth.passkey.register_passkey → expected symbol: AuthClient.getPasskeyRegistrationOptions
  • auth.passkey.register_passkey → expected symbol: AuthClient.verifyPasskeyRegistration
  • auth.passkey.sign_in_with_passkey → expected symbol: AuthClient.signInWithPasskey
  • auth.passkey.sign_in_with_passkey → expected symbol: AuthClient.getPasskeyAuthenticationOptions
  • auth.passkey.sign_in_with_passkey → expected symbol: AuthClient.verifyPasskeyAuthentication
  • realtime.subscriptions.broadcast → expected symbol: BroadcastJoinConfig.encode

The following capabilities are marked implemented in swift but have no registered symbols to verify:

  • client.authentication_integration.third_party_auth (no symbols list — cannot confirm implementation exists)
  • client.authentication_integration.cross_client_token_sync (no symbols list — cannot confirm implementation exists)
  • client.authentication_integration.oauth_flow_type (no symbols list — cannot confirm implementation exists)
  • client.authentication_integration.session_url_detection (no symbols list — cannot confirm implementation exists)
  • client.session_management.custom_storage (no symbols list — cannot confirm implementation exists)
  • client.session_management.persist_session (no symbols list — cannot confirm implementation exists)
  • client.request_configuration.global_headers (no symbols list — cannot confirm implementation exists)
  • client.observability.trace_propagation (no symbols list — cannot confirm implementation exists)
  • database.query.from_table (no symbols list — cannot confirm implementation exists)
  • database.query.select (no symbols list — cannot confirm implementation exists)
  • database.query.schema_selection (no symbols list — cannot confirm implementation exists)
  • database.query.rpc (no symbols list — cannot confirm implementation exists)
  • database.mutate.insert (no symbols list — cannot confirm implementation exists)
  • database.mutate.update (no symbols list — cannot confirm implementation exists)
  • database.mutate.upsert (no symbols list — cannot confirm implementation exists)
  • database.mutate.delete (no symbols list — cannot confirm implementation exists)
  • database.mutate.select_after_mutation (no symbols list — cannot confirm implementation exists)
  • database.using_filters.eq (no symbols list — cannot confirm implementation exists)
  • database.using_filters.neq (no symbols list — cannot confirm implementation exists)
  • database.using_filters.gt (no symbols list — cannot confirm implementation exists)
  • database.using_filters.gte (no symbols list — cannot confirm implementation exists)
  • database.using_filters.lt (no symbols list — cannot confirm implementation exists)
  • database.using_filters.lte (no symbols list — cannot confirm implementation exists)
  • database.using_filters.like (no symbols list — cannot confirm implementation exists)
  • database.using_filters.ilike (no symbols list — cannot confirm implementation exists)
  • database.using_filters.is (no symbols list — cannot confirm implementation exists)
  • database.using_filters.in (no symbols list — cannot confirm implementation exists)
  • database.using_filters.contains (no symbols list — cannot confirm implementation exists)
  • database.using_filters.contained_by (no symbols list — cannot confirm implementation exists)
  • database.using_filters.range_gt (no symbols list — cannot confirm implementation exists)
  • database.using_filters.range_gte (no symbols list — cannot confirm implementation exists)
  • database.using_filters.range_lt (no symbols list — cannot confirm implementation exists)
  • database.using_filters.range_lte (no symbols list — cannot confirm implementation exists)
  • database.using_filters.range_adjacent (no symbols list — cannot confirm implementation exists)
  • database.using_filters.overlaps (no symbols list — cannot confirm implementation exists)
  • database.using_filters.text_search (no symbols list — cannot confirm implementation exists)
  • database.using_filters.match (no symbols list — cannot confirm implementation exists)
  • database.using_filters.not (no symbols list — cannot confirm implementation exists)
  • database.using_filters.or (no symbols list — cannot confirm implementation exists)
  • database.using_filters.raw (no symbols list — cannot confirm implementation exists)
  • database.using_filters.regex (no symbols list — cannot confirm implementation exists)
  • database.using_filters.regex_icase (no symbols list — cannot confirm implementation exists)
  • database.using_filters.is_distinct (no symbols list — cannot confirm implementation exists)
  • database.using_filters.like_all (no symbols list — cannot confirm implementation exists)
  • database.using_filters.like_any (no symbols list — cannot confirm implementation exists)
  • database.using_filters.ilike_all (no symbols list — cannot confirm implementation exists)
  • database.using_filters.ilike_any (no symbols list — cannot confirm implementation exists)
  • database.using_modifiers.order (no symbols list — cannot confirm implementation exists)
  • database.using_modifiers.limit (no symbols list — cannot confirm implementation exists)
  • database.using_modifiers.range (no symbols list — cannot confirm implementation exists)
  • database.using_modifiers.single_row (no symbols list — cannot confirm implementation exists)
  • database.using_modifiers.strip_nulls (no symbols list — cannot confirm implementation exists)
  • database.using_modifiers.format_csv (no symbols list — cannot confirm implementation exists)
  • database.using_modifiers.format_geojson (no symbols list — cannot confirm implementation exists)
  • database.using_modifiers.max_affected_rows (no symbols list — cannot confirm implementation exists)
  • database.using_modifiers.request_cancellation (no symbols list — cannot confirm implementation exists)
  • database.configuration.auto_retry (no symbols list — cannot confirm implementation exists)
  • functions.invocation.invoke (no symbols list — cannot confirm implementation exists)
  • functions.invocation.set_auth_token (no symbols list — cannot confirm implementation exists)
  • functions.invocation.method_override (no symbols list — cannot confirm implementation exists)
  • functions.invocation.streaming_response (no symbols list — cannot confirm implementation exists)
  • functions.invocation.request_cancellation (no symbols list — cannot confirm implementation exists)
  • realtime.client.connect (no symbols list — cannot confirm implementation exists)
  • realtime.client.disconnect (no symbols list — cannot confirm implementation exists)
  • realtime.client.get_channels (no symbols list — cannot confirm implementation exists)
  • realtime.client.remove_channel (no symbols list — cannot confirm implementation exists)
  • realtime.client.remove_all_channels (no symbols list — cannot confirm implementation exists)
  • realtime.client.connection_state (no symbols list — cannot confirm implementation exists)
  • realtime.client.listen_heartbeats (no symbols list — cannot confirm implementation exists)
  • realtime.client.set_auth_token (no symbols list — cannot confirm implementation exists)
  • realtime.client.channel (no symbols list — cannot confirm implementation exists)
  • realtime.channel.subscribe (no symbols list — cannot confirm implementation exists)
  • realtime.channel.unsubscribe (no symbols list — cannot confirm implementation exists)
  • realtime.channel.send (no symbols list — cannot confirm implementation exists)
  • realtime.channel.broadcast_http (no symbols list — cannot confirm implementation exists)
  • realtime.subscriptions.postgres_changes (no symbols list — cannot confirm implementation exists)
  • realtime.subscriptions.subscribe_presence (no symbols list — cannot confirm implementation exists)
  • realtime.subscriptions.private_channel (no symbols list — cannot confirm implementation exists)
  • realtime.subscriptions.broadcast_self (no symbols list — cannot confirm implementation exists)
  • realtime.subscriptions.broadcast_ack (no symbols list — cannot confirm implementation exists)
  • realtime.subscriptions.broadcast_replay (no symbols list — cannot confirm implementation exists)
  • realtime.presence.track (no symbols list — cannot confirm implementation exists)
  • realtime.presence.untrack (no symbols list — cannot confirm implementation exists)
  • realtime.presence.presence_key (no symbols list — cannot confirm implementation exists)
  • realtime.configuration.custom_websocket_transport (no symbols list — cannot confirm implementation exists)
  • realtime.configuration.reconnect_backoff (no symbols list — cannot confirm implementation exists)
  • realtime.configuration.heartbeat_interval (no symbols list — cannot confirm implementation exists)
  • realtime.configuration.access_token_callback (no symbols list — cannot confirm implementation exists)
  • realtime.configuration.deferred_disconnect (no symbols list — cannot confirm implementation exists)
  • realtime.configuration.custom_logger (no symbols list — cannot confirm implementation exists)
  • realtime.configuration.binary_protocol (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.get_bucket (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.list_file_buckets (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.update_bucket (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.delete_file_bucket (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.empty_bucket (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.access_bucket (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.upload (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.download (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.move (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.copy (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.remove (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.create_signed_url (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.create_signed_urls (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.create_signed_upload_url (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.upload_with_signed_url (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.update_file (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.file_exists (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.file_info (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.list_files_paginated (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.copy_cross_bucket (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.move_cross_bucket (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.upload_with_metadata (no symbols list — cannot confirm implementation exists)
  • storage.file_buckets.url_cache_nonce (no symbols list — cannot confirm implementation exists)

These may have been renamed, removed, or never registered. Please update the capability matrix.
See: https://github.com/supabase/sdk/blob/main/docs/capability-matrix.md

grdsdev added a commit that referenced this pull request Jul 21, 2026
Same cross-target Mocker race fixed for StorageTests/PostgRESTTests in
#1095: Mocker's mock registry is process-global across the whole test
binary, so FunctionsClientTests' own .serialized trait only protects it
from itself, not from StorageTests/PostgRESTTests' Mocker-backed suites
running concurrently in the same swift-testing execution.

Adds the same Sources/TestHelpers/MockerSerialization.swift helper
(.mockerSerialized trait) and applies it alongside .serialized on
FunctionsClientTests. Verified in isolation (30/30, run 3x) and, by
temporarily pairing with #1095's fixed StorageTests files, cross-target
against Storage (run 5x, clean) -- the full local suite still shows the
race today only because main's merged StorageTests doesn't have the fix
yet; that lands with #1095.
Four error-path tests (executeWithNonSuccessStatusCode,
executeWithNonJSONError, rpcWithGetMethodAndNonJSONObjectShouldThrowError,
rpcWithHeadMethodAndNonJSONObjectShouldThrowError) asserted only inside
their catch block -- if execute() stopped throwing (a regression), the
do block would complete and the test would pass vacuously. Add
Issue.record after execute() in each, mirroring the pattern already
used elsewhere in this file (e.g. the stripNulls/csv combination tests).

Rename cSV/cSVWithStripNullsThrowsError to csv/csvWithStripNullsThrowsError
for standard lowerCamelCase test naming.

(Copilot also flagged `import HTTPTypes` in PostgrestBuilderTests.swift
as unused -- verified false: removing it breaks the build, since
`.init("apikey")!` implicitly constructs an HTTPField.Name and needs
the module in scope. Left it in place.)
Copilot AI review requested due to automatic review settings July 21, 2026 12:07
@grdsdev

grdsdev commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Addressed in 334b571:

  • Added Issue.record("Expected error to be thrown") after execute() in the 4 flagged error-path tests (executeWithNonSuccessStatusCode, executeWithNonJSONError, rpcWithGetMethodAndNonJSONObjectShouldThrowError, rpcWithHeadMethodAndNonJSONObjectShouldThrowError) — all previously passed vacuously if execute() stopped throwing.
  • Renamed cSV/cSVWithStripNullsThrowsErrorcsv/csvWithStripNullsThrowsError.
  • Checked Copilot's "unused import HTTPTypes" claim on PostgrestBuilderTests.swift — it's a false positive, removing it breaks the build (.init("apikey")! implicitly constructs an HTTPField.Name, which needs the module in scope even without an explicit type name at the call site). Left it in place.

Verified: 105/105 tests pass (3 runs), full suite green, format/spell-check clean.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.

@grdsdev
grdsdev merged commit f954625 into main Jul 21, 2026
31 checks passed
@grdsdev
grdsdev deleted the guilherme/sdk-1251-swift-testing-migration-phase-4-postgresttests branch July 21, 2026 12:49
grdsdev added a commit that referenced this pull request Jul 21, 2026
Same cross-target Mocker race fixed for StorageTests/PostgRESTTests in
binary, so FunctionsClientTests' own .serialized trait only protects it
from itself, not from StorageTests/PostgRESTTests' Mocker-backed suites
running concurrently in the same swift-testing execution.

Adds the same Sources/TestHelpers/MockerSerialization.swift helper
(.mockerSerialized trait) and applies it alongside .serialized on
FunctionsClientTests. Verified in isolation (30/30, run 3x) and, by
temporarily pairing with #1095's fixed StorageTests files, cross-target
against Storage (run 5x, clean) -- the full local suite still shows the
race today only because main's merged StorageTests doesn't have the fix
yet; that lands with #1095.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants