57 tests in 7 groups
57 ways sync breaks, tested.
Each test will run on every mix of devices, hundreds of times a night with different timing, and end by checking what has to be true afterwards. How iCloud behaves in each one will be recorded from real iCloud on real devices, and recorded again on every iOS release. It's built first on Pikos, a notes, tasks and calendar app whose iCloud sync is in testing now.
The list is public on purpose. Give it to an agent and you get tests that agree with its own idea of iCloud; what makes these worth running is the simulated iCloud behind them, held to how the real one behaves.
Many devices
Not two test phones: every mix of devices a real user owns, making changes at once.
| Test | What must hold afterwards |
|---|---|
| Two to eight devices editing at once | Every device ends with the same data |
| iPhone, iPad, Mac, Watch and Vision Pro together | Each platform's quirks, like background limits, still converge |
| A device offline for a week, then back | It catches up, and sends what it held |
| A brand-new device joining an old account | It downloads everything, and the time it takes is measured |
| Clocks that disagree by minutes | The order of edits comes from sync, not from a wrong clock |
| The app deleted and reinstalled | Everything comes back from iCloud, and nothing is uploaded twice |
| A device restored from an old backup | Its stale copy and change token are noticed, and it refetches instead of overwriting newer data |
| A device that hasn't opened the app in months | It catches up in full, and its old pending changes don't win over newer ones |
Conflicts
The same data changed in two places before either heard about the other.
| Test | What must hold afterwards |
|---|---|
| Two devices edit the same record | Both edits merge, field by field, and neither is silently lost |
| Two devices edit the same field | One rule decides the winner, the same way on every device |
| One device deletes what another edits | Delete-or-keep is decided once, with no record coming back from the dead |
| Edits to an item that was moved or reordered | The edit follows the item, and the order converges |
| A parent deleted while a child is added | No orphan is left behind on any device |
| The same record created on two devices at once | One record survives, not two, for things like a default list or a settings record |
| A number changed on two devices at once | Both changes count, so neither device's change overwrites the other's |
| iCloud's copy changed since this device last saw it | The device merges the newer copy and saves again, instead of failing or overwriting it |
Shared data and multiple users
A record shared with other people, who edit it from their own Apple IDs.
| Test | What must hold afterwards |
|---|---|
| Owner and participant edit the same shared note | Both see both edits, from their own accounts |
| A participant's access is removed mid-edit | Their pending change is refused, and their copy is removed |
| A participant leaves the share | The owner keeps everything; the participant keeps nothing |
| A share accepted on a second device | It appears there too, without a duplicate |
| Read-only participants try to write | The write is refused on the device, before iCloud refuses it |
| The owner deletes the shared record | It disappears for every participant, and nobody's copy brings it back |
| Owner and participant on different app versions | Neither saves over fields the other's version doesn't know |
Accounts
The Apple ID under the app changes, or stops being there.
| Test | What must hold afterwards |
|---|---|
| Signed out in the middle of a sync | Nothing is sent to the wrong account, and the app says why sync stopped |
| Another Apple ID signed in | Nothing merges across accounts |
| iCloud switched off for the app | Local data is kept, and sync resumes cleanly when it's back |
| Advanced Data Protection keys resetCKSyncEngine | The encrypted zone is rebuilt from what the devices hold |
| Data made before signing in to iCloud | It merges into the account once, with no duplicates |
| The first device on an account that has never used the app | Its zone and subscription are created once, even when two devices start at the same moment |
| iCloud temporarily unavailable for the accountCKSyncEngine | Sync waits and says why, then resumes without losing anything |
| iCloud restricted by Screen Time or device managementCKSyncEngine | The app works locally and says sync is off, rather than failing quietly |
Network and iCloud limits
iCloud refusing, slowing or losing the connection, the ways it does in production.
| Test | What must hold afterwards |
|---|---|
| iCloud fullCKSyncEngine | Nothing is dropped, and sending resumes when space returns |
| Rate limited, with a retry-afterCKSyncEngine | Nothing is sent before the retry-after |
| A batch partly failsCKSyncEngine | Only the failed records are retried |
| A batch too large to send | It's split, and every record still arrives once |
| The network drops and returns, over and over | No change is lost, and none is sent twice |
| A record too big to save in one piece | It's stored as an asset or chunks, and arrives whole |
| A save that timed out, though iCloud kept itCKSyncEngine | The retry doesn't make a duplicate |
| iCloud unavailable, with a retry-afterCKSyncEngine | Sending waits for the retry-after, then resumes |
| An asset upload cut off halfwayCKSyncEngine | The record isn't saved pointing at a missing file, and the upload is retried |
| A record arrives before its assetCKSyncEngine | The app shows it's still downloading, and never treats the file as lost |
The app's own life
Things iOS and macOS do to an app while it's syncing.
| Test | What must hold afterwards |
|---|---|
| App killed mid-send | No change is lost, and none is sent twice |
| Suspended in the background for hours | It picks up where it left off |
| A silent push never arrives | The next fetch catches up anyway |
| The device's own storage is full | Sync pauses and says why, and nothing is half-written |
| A widget or extension writes while the app is closed | The change is sent the next time anything can send, and isn't lost or sent twice |
| Background App Refresh or Low Power Mode off | The app catches up when it opens, and says it was behind |
| Two windows of the app editing at once | Both windows' changes are sent, in order, once |
| Woken in the background by a push | It finishes in the time iOS allows, or saves where it stopped |
Schema and app versions
Different versions of your app, and a schema in Production that can only grow.
| Test | What must hold afterwards |
|---|---|
| A field the build saves isn't in Production | The schema check fails the build before it ships |
| An old app version meets data from a new one | It keeps what it doesn't understand, and saves nothing over it |
| A user skips three versions | Their data migrates, step by step, with nothing lost |
| Change token expiredCKSyncEngine | A full refetch, ending with the same data |
| A new install replays years of deletes | It converges, and the time it takes is measured |
| A zone deleted, purged or reset | Each reason is handled, and nothing comes back from the dead |
| A field dropped from the model but still in Production | Old versions can keep writing it without breaking new ones |
| A record type renamed in the model | Old records are carried over, not left behind under the old name |
What works with what
The fast runs will swap your app's sync engine for a simulated iCloud inside one test process. CKSyncEngine, and libraries built on it like SQLiteData, can be swapped. SwiftData and Core Data run their sync inside Apple's framework, which can't be, so the tests where iCloud itself has to misbehave are marked CKSyncEngine above. The rest run on simulators against your development container, which is too slow for a pull request, so they will run nightly or on your Mac, and pull requests get the schema check.
| CKSyncEngine | SwiftData, Core Data | |
|---|---|---|
| Schema check, inspector, compare | yes | yes |
| Devices, conflicts, sharing, accounts | fast, in one process | slower, on simulators |
| iCloud full, rate limits, expired tokens | yes | not possible |
How a run works
Simulated devices will make random edits through your app's own sync code, against a simulated iCloud that fails the way the real one does. Each run will have a seed, so any failure can be replayed exactly, step by step, in the inspector. A scripted check against your real staging container will catch what a simulation can't.
Want this for your app?
Two emails at most: when the free schema check ships, and when the app does.
Two emails at most: when the free schema check ships, and when the app does. Unsubscribe in one click.
You're on the list. You'll hear when the schema check ships, and when the app does.
Optional: what does your app sync with?