apple / apple/sample-cloudkit-sync-engine

Implementation flaw

オープン
#5 コメント 14 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
Swift
スター
270
フォーク
15
PR マージ指標
30日以内にマージされた PR はありません

説明

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?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

SyncedDatabase の 350 行目から始め、pendingRecordZoneChanges と stateUpdate イベントがどのように処理されているかを確認してください。issue で説明されているクラッシュの発生し得る期間と、提案されている非同期 API の変更を評価してください。データ損失または API 設計に関する懸念に対する、maintainer が確認した解決策が得られた時点で完了とします。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
swift
領域
cloud, databases
issue の種類
バグ
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。