Skip to content

fix(sync): stop re-uploading the deleted-documents manifest on every sync - #736

Merged
farfromrefug merged 1 commit into
ossappscollective:mainfrom
Arthur031221:fix-tombstone-hasChanged
Oct 1, 2026
Merged

farfromrefug merged 1 commit into
ossappscollective:mainfrom
Arthur031221:fix-tombstone-hasChanged

Conversation

@Arthur031221

Copy link
Copy Markdown
Contributor

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.

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.
@farfromrefug
farfromrefug merged commit e08248e into ossappscollective:main Oct 1, 2026
1 check passed
@farfromrefug

Copy link
Copy Markdown
Collaborator

@Arthur031221 awesome thank you!

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.

2 participants