Skip to content

fix(backup): file-coordinated container I/O so iCloud actually uploads (build 12) - #22

Merged
markm39 merged 1 commit into
mainfrom
fix/icloud-coordinated-writes
Aug 30, 2026
Merged

fix(backup): file-coordinated container I/O so iCloud actually uploads (build 12)#22
markm39 merged 1 commit into
mainfrom
fix/icloud-coordinated-writes

Conversation

@markm39

@markm39 markm39 commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Live evidence (Mac on the same Apple ID watching the real container): directories synced, but a 30-minute watch during a forced device re-mirror recorded zero file uploads — uncoordinated writes, especially atomic rename-into-place, are invisible to the iCloud daemon. All container mutations are now NSFileCoordinator-coordinated, and a new uploadStatus probe (NSMetadataUbiquitousItemIsUploadedKey) drives an honest status line ('Backing up — N files still uploading to iCloud', localized ×13) so 'backed up' is only claimed when Apple's servers hold the data.

48/48 tests, typecheck, sim smoke (coordinated mirror byte-identical). Real upload validated post-merge via the live Mac-container watch during a TestFlight re-mirror.

https://claude.ai/code/session_01Y9r9L2vDPQwyEEV61qWyfp

…s (build 12)

Live observation from a second device on the same Apple ID proved the
container's directory skeleton synced but no file ever reached the
server - a 30-minute watch during a forced full re-mirror recorded zero
arrivals. Uncoordinated writes (atomic rename-into-place in particular)
are not reliably seen by the iCloud sync daemon.

- All container mutations now run under NSFileCoordinator (.forReplacing
  / .forDeleting); the catalog/manifest write is a coordinated in-place
  data write instead of String.write(atomically:), whose rename is what
  left files invisible to the daemon.
- New uploadStatus (NSMetadataUbiquitousItemIsUploadedKey) reports how
  much of the backup Apple's servers actually hold; the support-sheet
  status line now says 'Backing up - N files still uploading to iCloud'
  (localized in all 13 languages) until everything is durable, instead
  of implying safety while data sits only in the local replica.

Simulator smoke: the coordinated paths produce a byte-identical mirror.
Real-iCloud validation: live Mac-side container watch during a device
re-mirror, which previously recorded zero uploads.

Claude-Session: https://claude.ai/code/session_01Y9r9L2vDPQwyEEV61qWyfp
@markm39
markm39 merged commit c8e7695 into main Aug 30, 2026
@markm39
markm39 deleted the fix/icloud-coordinated-writes branch August 30, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant