element-hq / element-hq/element-ios
Reduce iCloud backup to zero and cover with tests
- Dominant language
- Swift
- Stars
- 1.8k
- Forks
- 544
- PR merge metrics
- PR metrics pending
Description
# iCloud backup
A [previous issue](https://github.com/vector-im/element-ios/issues/5498) noticed that some data was being backed up, both to iCloud as well as to manual iTunes backups. Whilst the local side have been [resolved](https://github.com/vector-im/element-ios/pull/5557) so that no data is backed up at all, iCloud still reports 200-300kb of data, not present in the local backup.
From the application and API perspective, there is no difference between local and iCloud backups, meaning the difference in size is likely some undocumented disparity on Apple's side. It could for example be the size of empty directories for SiriIntents, extensions etc, but it isn't any of the application data.
One possible way to find out what is being backed up in iCloud is to restore a device from that backup and then manually backup via iTunes to observe the content.
# Tests
We would like to ensure there are no future regressions with files being backed up to iCloud. Writing tests item-by-item is not robust enough, because future items that are not excluded will clearly not have any tests written either.
A better approach might be to launch the application inside a newly setup UI tests and itterate through the entire file structure (or top level directories) via `FileManager`. For each of these items, we can use `resourceValues` method to check that `.isExcludedFromBackupKey` value is set to false.
Contributor guide
Research direction
Start by reviewing the backup-exclusion behavior changed in PR #5557 and the existing iCloud-related application configuration, then launch the app in a newly set up UI-test environment. Traverse the file structure or top-level directories with FileManager and inspect each item's resourceValues for isExcludedFromBackupKey. Done means the test covers the discovered structure and catches any item not excluded from backup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, swift
- Domain
- mobile-dev, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100