Implementation flaw
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start in SyncedDatabase at line 350 and review how pendingRecordZoneChanges and the stateUpdate event are handled. Assess the crash window described in the issue and the proposed asynchronous API change; done requires a maintainer-confirmed resolution to the data-loss or API-design concern.
Written by the indexing model from the issue text.
Description
Hi there,
I think there is an implementation error in the sample project - more specifically, a flaw in the design of CKSyncEngine.
In the SyncedDatabase file, line 350:
self.syncEngine.state.add(pendingRecordZoneChanges: pendingSaves)
This tells the syncEngine what to do when the time is right. Since this piece of information is not persisted in this call (I think its persisted in .stateUpdate(let event)), there is a chance that this information is lost if the app crashes between .add(pendingRecordZoneChanges: pendingSaves) and .stateUpdate(let event).
I know this is just a sample project, but I really think this is a flaw in the API design of CKSyncEngine since I do not see an easy way to guarantee correct behavior. A simple fix would be to make .add(pendingRecordZoneChanges: pendingSaves) (and similar methods) async and only complete after .stateUpdate(let event) was called.
What do you think?
- Dominant language
- Swift
- Stars
- 270
- Forks
- 15
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apple/sample-cloudkit-sync-engine
-
Difficulty 4/5 3-5 days Newbie friendliness 28/100
apple/sample-cloudkit-sync-engine#17 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
apple/sample-cloudkit-sync-engine#15 · 6 comments · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
apple/sample-cloudkit-sync-engine#13 · 1 comment ·
-
var listID: String Open
Difficulty 1/5 Under an hour Newbie friendliness 42/100
apple/sample-cloudkit-sync-engine#10 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
apple/sample-cloudkit-sync-engine#6 · 3 reactions ·
All issues in apple/sample-cloudkit-sync-engine
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
maxgoedjen/secretive#840 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
manaflow-ai/cmux#13763 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
openwallet-foundation/multipaz#2028 ·