Preserve dirty user data on domain removal#9436
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses a macOS Virtual Files data-loss scenario by preserving “dirty” (locally modified but not yet uploaded) File Provider content when a File Provider domain is removed, and adds user-facing notification/diagnostics to reduce the chance of silent loss.
Changes:
- Switch File Provider domain removal to preserve dirty user data and add a helper to locate the domain’s user-visible root URL.
- Add XPC plumbing + extension implementation to detect whether the File Provider has dirty user data.
- Add a new
DirtyUserDataObserverplus Swift Testing coverage, and document testing conventions inAGENTS.md.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/gui/macOS/fileproviderxpc_mac.mm | Adds synchronous XPC call to query dirty user data state. |
| src/gui/macOS/fileproviderxpc.h | Exposes dirty-user-data query on the XPC wrapper. |
| src/gui/macOS/fileprovidersettingscontroller_mac.mm | Warns users and opens Finder when dirty data is detected before domain removal. |
| src/gui/macOS/fileproviderdomainmanager.mm | Uses preserve-dirty removal mode and adds user-visible URL lookup for a domain. |
| src/gui/macOS/fileproviderdomainmanager.h | Declares userVisibleUrlForDomainIdentifier. |
| shell_integration/.../ClientCommunicationProtocol.h | Extends XPC protocol with dirty-user-data query method. |
| shell_integration/.../FileProviderExtension+ClientCommunicationProtocol.swift | Implements dirty-user-data check in the extension via materialized item enumeration. |
| shell_integration/.../DirtyUserDataObserver.swift | Adds enumeration observer that detects unuploaded items. |
| shell_integration/.../DirtyUserDataObserverTests.swift | Adds Swift Testing suite for the observer. |
| shell_integration/.../FileProviderItemMock.swift | Adds a minimal mock item for observer tests. |
| AGENTS.md | Adds Swift Testing conventions and guidance for mocks/tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...ProviderKit/Tests/NextcloudFileProviderKitTests/Enumeration/DirtyUserDataObserverTests.swift
Show resolved
Hide resolved
...loudFileProviderKit/Sources/NextcloudFileProviderKit/Enumeration/DirtyUserDataObserver.swift
Show resolved
Hide resolved
...NextcloudIntegration/FileProviderExt/FileProviderExtension+ClientCommunicationProtocol.swift
Outdated
Show resolved
Hide resolved
3a71f89 to
617edca
Compare
Signed-off-by: Iva Horn <[email protected]>
617edca to
4107f3c
Compare
|
Artifact containing the AppImage: nextcloud-appimage-pr-9436.zip Digest: To test this change/fix you can download the above artifact file, unzip it, and run it. Please make sure to quit your existing Nextcloud app and backup your data. |
|



Summary: Closes #9417 because client-side data loss of unsynchronized items on file provider domain removal is prevented.
This also matches the behavior of iCloud Drive when it is disabled on a Mac.
In case of "dirty user data" a timestamped folder in
~/Library/CloudStoragewill be created by macOS which contains all unsynchronized items. This avoids data loss on the client side when removing the file provider domain for a Nextcloud client account and does not conflict when the account possibly is set up anew.The client reveals that folder on removal.
Also, this pull request disables the checkbox for the duration of setup or cleanup of a file provider domain, so race conditions and so on can be avoided by waiting for the transactions to complete.