Handle and work around concurrency warnings
Summary by CodeRabbit
-
Chores
- Updated Swift toolchain requirement to version 6.0
- Upgraded continuous integration to macOS 15 with Xcode 16.4
- Improved simulator testing with more flexible device matching patterns
- Enhanced notification API with thread-safety and concurrency attributes
[!NOTE]
Other AI code review bot(s) detected
CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.
Walkthrough
The PR upgrades the Swift package to Swift 6.0 tooling, updates CI to macOS 15 with Xcode 16.4, modernizes build device matching in the Makefile, and adds comprehensive Sendable conformance and concurrency attributes across the public API surface. Test discovery manifests for non-Objective-C environments are removed.
Changes
| Cohort / File(s) | Change Summary |
|---|---|
CI & Build Infrastructure .github/workflows/ci.yml, Makefile, Package.swift |
Updates GitHub Actions workflow to macOS 15 with Xcode 16.4; replaces hard-coded device identifiers with regex patterns and changes UDID selection from JSON/jq parsing to grep/sort/head/awk; bumps Swift tools version to 6.0 |
Concurrency & Sendable Conformance Sources/ComposableUserNotifications/Interface.swift, Sources/ComposableUserNotifications/LiveKey.swift, Sources/ComposableUserNotifications/Model.swift |
Adds @preconcurrency imports, Sendable conformance to public types and enums, @Sendable closure annotations on all public closure-typed properties, and wraps completion handlers with UncheckedSendable; marks internal delegate as final Sendable |
Test Discovery Removal Tests/ComposableUserNotificationsTests/ComposableUserNotificationsTests.swift, Tests/ComposableUserNotificationsTests/XCTestManifests.swift |
Removes allTests static declaration and Linux XCTest manifest entry function for automatic test discovery |
Sequence Diagram(s)
sequenceDiagram
participant Client
participant UserNotificationClient
participant Delegate
participant UNUserNotificationCenter
Note over Client,UNUserNotificationCenter: With Sendable Conformance
Client->>UserNotificationClient: Call @Sendable closure property
activate UserNotificationClient
UserNotificationClient->>Delegate: Route through AsyncStream (UncheckedSendable)
activate Delegate
Delegate->>UNUserNotificationCenter: Invoke UserNotifications API
activate UNUserNotificationCenter
UNUserNotificationCenter-->>Delegate: Response
deactivate UNUserNotificationCenter
rect rgba(200, 150, 100, 0.1)
Delegate->>Delegate: Wrap completion handler in @Sendable
end
Delegate-->>UserNotificationClient: Yield result
deactivate Delegate
UserNotificationClient-->>Client: Return async value
deactivate UserNotificationClient
Estimated code review effort
🎯 4 (Complex) | ⏱️ ~60 minutes
- Model.swift: Dense concurrency refactoring with Sendable conformance across 10+ types; nonisolated(unsafe) rawValue properties and wrapped @Sendable closures require careful verification of thread-safety assumptions
- Interface.swift: Extensive public API surface changes with @Sendable attributes on all closure-typed properties; @preconcurrency imports need validation
- LiveKey.swift: UncheckedSendable wrapping of completion handlers and delegate lifecycle management; verify AsyncStream termination closure correctness
- Makefile: Regex-based device pattern changes and UDID selection logic shift from JSON to grep/awk pipeline; test against various simulator configurations
Poem
🐰 Swift six arrives with Sendable grace, Closures don thread-safe embrace, No more allTests, tests auto-find, macOS 15, Xcode—we're redesigned! Concurrency crowned, our notifs now race, Safe in the cloud, at any pace ✨
Pre-merge checks and finishing touches
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title Check | ✅ Passed | The title "Handle and work around concurrency warnings" accurately describes the primary focus of this changeset. The core substantive changes—across Interface.swift, LiveKey.swift, and Model.swift—center on adding concurrency safety through Sendable conformance, @Sendable closure attributes, @preconcurrency imports, and UncheckedSendable workarounds. While the PR also includes supporting changes (CI workflow update to macOS 15/Xcode 16.4, Makefile device identifier updates, Swift tools version bump to 6.0, and test infrastructure cleanup), these align with or enable the concurrency work. The title is specific enough that a teammate reviewing history would clearly understand this PR addresses concurrency warnings and safety concerns in the composable-user-notifications library. |
✨ Finishing touches
- [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
- [ ] Commit unit tests in branch
task/concurrency-warnings
Comment @coderabbitai help to get the list of available commands and usage tips.
@coderabbitai review
✅ Actions performed
Review triggered.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.