Shared Homes: CloudKit collaboration — production ready (build 33)#66
Shared Homes: CloudKit collaboration — production ready (build 33)#66barronlroth wants to merge 18 commits intomainfrom
Conversation
- Implement HomeSharingService with CKShare management - Add CloudSharingControllerRepresentable for UICloudSharingController - Add AppDelegate for share acceptance handling - Add HomeSharingServiceTests and SharePermissionTests - Wire up share acceptance in CubbyApp
- Add Cubby.xcdatamodel with Home, Room, Item, ShareParticipant entities - Implement PersistenceController with CloudKit container support - Add CoreDataModelTests (entity validation, relationships, cascading deletes) - Add PersistenceControllerTests (CRUD operations) - Update FeatureGate with sharedHomes flag
- Remove trailing closure from fetchShares(matching:) — API is synchronous - Fix test access to CloudKit container options via store descriptions - Fix merge policy type assertion in tests
- SharedHomesGateService for permission checks - HomeSharingEnvironment service - UI integration across Home, Location, Item views - Permission gating tests
- DataMigrationService for schema migration - RemoteChangeHandler for CloudKit sync - SharingErrorHandler for error recovery - Updated PersistenceController and CloudSyncCoordinator - Tests for all new services
…y UUID instead of broken cast The managedObject(for:) method was casting Home (@model) to NSManagedObject which always returned nil, silently breaking all sharing operations. Now fetches CDHome from Core Data viewContext by matching home.id UUID. Also bumps build to 33.
|
Claude finished @barronlroth's task —— View job Code Review: Shared Homes CloudKit Collaboration (Build 33)Comprehensive review of this CloudKit collaboration implementation across 34 files with 3,699 additions. Executive SummaryThis is a production-ready, well-architected implementation that demonstrates excellent software engineering practices. The hybrid SwiftData/CoreData approach with comprehensive testing and error handling makes this a solid foundation for collaborative features. ✅ StrengthsArchitecture Excellence
Security & Permissions
Error Handling & UX
Test Coverage
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5a26235d5b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| persistenceController.persistentContainer.acceptShareInvitations( | ||
| from: [metadata], | ||
| into: sharedPersistentStore |
There was a problem hiding this comment.
Surface accepted shares in the app’s active data store
This path accepts invitations directly into the Core Data shared store, but the app UI still reads homes from SwiftData (HomeView uses @Query over Home) and there is no follow-up bridge that materializes accepted shared homes into that SwiftData store. In environments where the shared-homes flags are enabled, invite acceptance can succeed at CloudKit level while the invited home never appears in the home list, making collaboration unusable for recipients.
Useful? React with 👍 / 👎.
| guard let managedObject = managedObject(for: home) else { | ||
| throw HomeSharingServiceError.unsupportedHomeModel |
There was a problem hiding this comment.
Sync new homes to Core Data before invoking share
shareHome hard-requires a matching CDHome and throws unsupportedHomeModel when none exists. The only SwiftData→CoreData copy is the one-time startup migration (runMigrationIfNeeded), so homes created after that migration are never inserted into Core Data and cannot be shared. With shared homes enabled, users can create a home and then consistently fail when tapping “Share Home” for that home.
Useful? React with 👍 / 👎.
Flips shouldUseCoreDataSharingStack() to return true, enabling CloudKit shared homes for all users. Migration runs on first launch.
|
Claude finished @barronlroth's task —— View job Code Review: Shared Homes CloudKit Collaboration (Build 33)Comprehensive review of this CloudKit collaboration implementation across 34 files. 🏗️ Architecture & Design ExcellenceHybrid SwiftData/CoreData Approach: Sophisticated dual-persistence architecture that allows safe rollout:
🔒 Security & Permissions Analysis✅ Strong Permission System:
✅ CloudKit Security:
🧪 Test Coverage AssessmentExcellent Coverage across 8 comprehensive test suites:
Test Quality: Uses Swift Testing framework with proper mocks and isolation. 🚨 Critical Issues (Blocking for Production)Issue 1: Accepted shared homes never appear in UILocation: try await acceptShareInvitation(from: metadata) // Goes to Core Data shared storeProblem:
Recommendation: Implement a bridging mechanism to create SwiftData Issue 2: Post-migration homes cannot be sharedLocation: guard let managedObject = managedObject(for: home) else {
throw HomeSharingServiceError.unsupportedHomeModel // Always fails for new homes
}Problem:
Recommendation: Implement continuous sync from SwiftData to Core Data, or create Core Data records on-demand during sharing.
|
Two gates were blocking the Share button: 1. FeatureGate.shouldUseCoreDataSharingStack (fixed in build 34) 2. SharedHomesGateService.runtimeEnabled (fixed now — defaults to true)
|
Claude finished @barronlroth's task —— View job Code Review: Shared Homes CloudKit Collaboration (Build 33)Comprehensive review of this CloudKit collaboration implementation across 34 files with 3,709 additions. Todo List
🚨 Critical Issues (Blocking for Production)Issue 1: Accepted shared homes never appear in UILocation: try await acceptShareInvitation(from: metadata) // Goes to Core Data shared storeProblem:
Issue 2: Post-migration homes cannot be sharedLocation: guard let managedObject = managedObject(for: home) else {
throw HomeSharingServiceError.unsupportedHomeModel // Always fails for new homes
}Problem:
Recommendation: These architectural gaps in the SwiftData ↔ Core Data bridge make shared homes functionality unusable for end users. ✅ Major Strengths🏗️ Architecture Excellence
🔒 Security & Permissions
🧪 Test Coverage
🎨 Error Handling & UX
|
Includes Phases 1-3 + bridge fix. Build 33.