Migrate project targets to Swift 6 - #82
Conversation
|
Warning Review limit reached
Next review available in: 45 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughSwift 6 is enabled across application and test targets. Shared models gain ChangesSwift 6 concurrency migration
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Reviewer's GuideMigrates all first-party app and test targets to Swift 6 by tightening actor isolation, marking core models/utilities as nonisolated and Sendable, updating async patterns to use Swift concurrency tasks, and aligning delegate APIs and deinitializers with Swift 6 concurrency rules. Sequence diagram for Shimeji resource download and manifest loading under Swift concurrencysequenceDiagram
participant URLSession
participant ShimejiResourceManager
participant MainActor
participant TaskDetached
ShimejiResourceManager->>URLSession: downloadTask(with: packURL)
URLSession-->>ShimejiResourceManager: completion(tempURL,error)
ShimejiResourceManager->>MainActor: deliverDownloadCompletion(to:tempURL:error)
MainActor->>ShimejiResourceManager: handleDownloadCompletion(tempURL:error)
ShimejiResourceManager->>TaskDetached: Task.detached(extractAndLoad(zipURL:))
TaskDetached-->>ShimejiResourceManager: ShimejiManifest
ShimejiResourceManager->>ShimejiResourceManager: manifest,state = ready
URLSession-->>ShimejiResourceManager: progress.fractionCompleted
ShimejiResourceManager->>MainActor: deliverProgress(progress,to:manager)
MainActor->>ShimejiResourceManager: state = .downloading(progress)
Sequence diagram for WatchSessionPublisher handling WCSession callbacks on MainActorsequenceDiagram
participant WCSession
participant WatchSessionPublisher
participant MainActor
WCSession-->>WatchSessionPublisher: session(activationDidCompleteWith:error:)
WatchSessionPublisher->>MainActor: publish(bumpingGeneration:false)
WCSession-->>WatchSessionPublisher: sessionWatchStateDidChange
WatchSessionPublisher->>MainActor: publish(bumpingGeneration:false)
WCSession-->>WatchSessionPublisher: session(didReceiveMessage:replyHandler:)
WatchSessionPublisher->>MainActor: publish(bumpingGeneration:true)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In ShimejiResourceManager, the Task that wraps the detached extract/load work now mutates
manifestandstatedirectly; consider enforcing main-actor updates (e.g. via@MainActoron the type orMainActor.run) to keep ObservableObject state changes on the UI thread. - The RadioController polling loop now reads
shouldKeepPollingand callsclearPollTask()withoutawait; verify these are either nonisolated or explicitly main-actor-safe, or adjust their actor isolation to match the background polling context.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In ShimejiResourceManager, the Task that wraps the detached extract/load work now mutates `manifest` and `state` directly; consider enforcing main-actor updates (e.g. via `@MainActor` on the type or `MainActor.run`) to keep ObservableObject state changes on the UI thread.
- The RadioController polling loop now reads `shouldKeepPolling` and calls `clearPollTask()` without `await`; verify these are either nonisolated or explicitly main-actor-safe, or adjust their actor isolation to match the background polling context.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@Twinskaraoke/Services/Shimeji/ShimejiResourceManager.swift`:
- Around line 108-141: Update the installation flow around the detached
extraction Task and the `deleteDownloadedPack()`/`retry()` methods to track an
installation generation or cancellable task, incrementing or invalidating it in
both delete and retry paths. Before swapping the extracted directory and before
publishing `.ready` or `.failed` state and the manifest, verify the work still
matches the current installation generation; otherwise discard the stale result
and clean up temporary files.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: c8aec85b-3029-4162-8c4d-0d826ca83082
📒 Files selected for processing (16)
Twinskaraoke.xcodeproj/project.pbxprojTwinskaraoke/Components/Shared/CaptchaWebView.swiftTwinskaraoke/Components/Shimeji/ShimejiOverlayWindow.swiftTwinskaraoke/Services/Debug/ScrollPerformanceState.swiftTwinskaraoke/Services/Shimeji/ShimejiModels.swiftTwinskaraoke/Services/Shimeji/ShimejiResourceManager.swiftTwinskaraoke/Services/Shimeji/ShimejiZipReader.swiftTwinskaraoke/Services/Storage/LyricsCacheStore.swiftTwinskaraoke/Services/User/AuthManager.swiftTwinskaraoke/Services/User/WatchSessionPublisher.swiftTwinskaraokeShared/Models/LyricsModels.swiftTwinskaraokeTVApp/Services/AudioManager.swiftTwinskaraokeUITests/TwinskaraokeUITests.swiftTwinskaraokeWatchApp/Services/AudioManager.swiftTwinskaraokeWatchApp/Services/RadioController.swiftTwinskaraokeWatchAppUITests/TwinskaraokeWatchAppUITests.swift
Summary
DispatchWorkItemdebounce with a cancellable Swift concurrency taskWhy
The project used the Swift 6 compiler and approachable concurrency settings, but every target still explicitly compiled in Swift 5 language mode. Enabling Swift 6 exposed compile-time isolation issues and two runtime executor violations that could crash test hosts.
Third-party Swift packages keep the language modes declared by their own package manifests.
Validation
Summary by Sourcery
Migrate app, watch, tv, and test targets to Swift 6 and update concurrency usage to comply with Swift 6 isolation and sendability rules.
New Features:
Bug Fixes:
Enhancements:
Build:
Tests:
Summary by CodeRabbit