chore: Move the whole package to the Swift 6 language mode#104
Merged
Conversation
Completes the Swift 6 migration started in SDK-2593: the library target was already on the v6 language mode while the test target stayed on v5 as a temporary seam until the test doubles were made Sendable. This makes the whole package build and test under the v6 language mode. - Rework EventSink<T> from a mutating value type backed by a semaphore + serial queue into a final, @unchecked Sendable class guarded by an NSCondition, with a reset() so the shared instance can be reused across tests. - Make MockHandler and RequestHandler final, and EventSink properties immutable. - Replace MockingProtocol's static mutable `requested` with a static let that is reset() between tests rather than reassigned. - Add a lock-protected Box<T> so tests can mutate counters/actions captured by the @sendable connectionErrorHandler closures. - Turn DummyError into a struct so it is trivially Sendable. - Declare the v6 language mode once at the package level via swiftLanguageModes: [.v6] instead of per target.
tanderson-ld
approved these changes
Jun 26, 2026
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.
Completes the Swift 6 migration started in SDK-2593: the library target was
already on the v6 language mode while the test target stayed on v5 as a
temporary seam until the test doubles were made Sendable. This makes the whole
package build and test under the v6 language mode.
queue into a final, @unchecked Sendable class guarded by an NSCondition, with
a reset() so the shared instance can be reused across tests.
requestedwith a static let that isreset() between tests rather than reassigned.
the @sendable connectionErrorHandler closures.
swiftLanguageModes: [.v6] instead of per target.
Note
Low Risk
Changes are confined to Package.swift and test support code; production library sources are unchanged aside from shared language mode.
Overview
Finishes the Swift 6 migration by applying
swiftLanguageModes: [.v6]at the package level instead of per-target settings, so tests compile under the same rules as the library.Test infrastructure is reworked for v6 concurrency:
EventSinkbecomes a lock-guarded@unchecked Sendableclass (replacing a mutating struct with semaphore/queue), withreset()soMockingProtocol.requestedcan stay astatic let.MockHandlerisfinalwith an immutable events sink;Box<T>letstestDispatchErrormutate counters inside@SendableconnectionErrorHandlerclosures;DummyErrorbecomes a struct for trivial Sendability.Reviewed by Cursor Bugbot for commit 49eec47. Bugbot is set up for automated code reviews on this repo. Configure here.