Skip to content

chore: Move the whole package to the Swift 6 language mode#104

Merged
keelerm84 merged 1 commit into
4.xfrom
mk/SDK-2605/v6-test-target
Jun 26, 2026
Merged

chore: Move the whole package to the Swift 6 language mode#104
keelerm84 merged 1 commit into
4.xfrom
mk/SDK-2605/v6-test-target

Conversation

@keelerm84

@keelerm84 keelerm84 commented Jun 26, 2026

Copy link
Copy Markdown
Member

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 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 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.

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: EventSink becomes a lock-guarded @unchecked Sendable class (replacing a mutating struct with semaphore/queue), with reset() so MockingProtocol.requested can stay a static let. MockHandler is final with an immutable events sink; Box<T> lets testDispatchError mutate counters inside @Sendable connectionErrorHandler closures; DummyError becomes 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.

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.
@keelerm84 keelerm84 requested a review from a team as a code owner June 26, 2026 14:46
@keelerm84 keelerm84 merged commit 330c089 into 4.x Jun 26, 2026
17 checks passed
@keelerm84 keelerm84 deleted the mk/SDK-2605/v6-test-target branch June 26, 2026 18:44
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