fix(file-provider): prevent data loss when parent folder moves during sync.#10134
Draft
camilasan wants to merge 2 commits into
Draft
fix(file-provider): prevent data loss when parent folder moves during sync.#10134camilasan wants to merge 2 commits into
camilasan wants to merge 2 commits into
Conversation
… sync. When a parent directory returns 404, children are no longer eagerly marked deleted — they may have moved with the parent. The deconfliction pass now includes newly discovered items, and items with pending uploads are protected from deletion in both the enumerator and recursive directory delete paths. Assisted-by: Claude:claude-sonnet-4-5 Signed-off-by: Camila Ayres <hello@camilasan.com>
Assisted-by: Claude:claude-sonnet-4-5
Member
Author
|
/backport to stable-33.0 |
Member
Author
|
/backport to stable-4.0 |
10 tasks
4 tasks
Contributor
|
Artifact containing the AppImage: nextcloud-appimage-pr-10134.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. |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Resolves
This PR is related to #10130, better to merge it afterwards.
Moving a folder on another client could silently wipe its contents from the device. An in-flight upload through a deleted parent would lose data permanently. Reporting children before the parent causes macOS to create a duplicate folder.
Summary
Items found at a new location are not deleted; pending uploads and open lock files are protected — the enumerator now waits until the full sync pass completes before deciding what is deleted, using a survivingOcIds set to spare anything found at a new path. Items mid-upload and local-origin lock files are excluded from deletion even when their parent is removed. Items are also sorted parent-before-child before being reported to macOS to prevent duplicate folders caused by ordering.
Steps to test it
Scenario A Move:
✅ doc.txt must appear inside FolderB in Finder.
✅ doc.txt must not appear as deleted anywhere.
Scenario B — Upload protection:
✅ The upload must complete and the file must appear on the server.
✅ The uploading file must not be silently lost.
Scenario C — No duplicate folder on rename:
✅ Only FolderA-renamed must appear in Finder — no duplicate FolderA.
Checklist
AI (if applicable)