fix(sync): stop re-uploading the deleted-documents manifest on every sync - #736
Merged
farfromrefug merged 1 commit intoOct 1, 2026
Merged
Conversation
mergeTombstones rebuilt its map from the stored entries into a Map that starts empty, so every pre-existing tombstone looked "new" and set hasChanged = true even when the ids list passed in for this sync pass was empty. SyncWorker gates putDeletedDocumentsManifest and putDeletedFoldersManifest on that flag, so any user who had ever deleted a document or folder got the manifest rewritten to the remote on every sync pass, not just when something was actually deleted. Only mark a change when an entry is genuinely superseded by a newer date, not when it is simply being copied forward unchanged.
Collaborator
|
@Arthur031221 awesome thank you! |
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.
Anyone syncing documents to WebDAV, Nextcloud, OneDrive or Google Drive who has ever deleted a document or folder gets the deleted-documents/deleted-folders manifest file rewritten and re-uploaded on every single sync pass, even when nothing new was deleted that cycle.
mergeTombstones in app/services/sync/deletedDocuments.ts rebuilds its result into a Map that starts empty on every call. Copying forward an existing tombstone always finds "no existing entry yet" in that fresh map, so the loop sets hasChanged = true for every stored tombstone, whether or not anything new was deleted this pass. SyncWorker gates putDeletedDocumentsManifest and putDeletedFoldersManifest directly on that flag, so the manifest gets written to the remote on every sync once a user has any prior deletion.
The fix only flags a change when an entry is genuinely superseded by a newer date. Copying forward an unchanged entry no longer trips hasChanged; the ids loop that handles real new deletions is untouched.
Tested with
yarn test(18 files, 308 tests passing). The added test in app/services/sync/deletedDocuments.test.ts fails on main at 0155762 with "expected true to be false" and passes with this change.I found this by reading the sync code, not from a filed issue. No open issue or PR covers it.