Skip to content

fix: sync folders whose space arrives after the account connected - #12770

Open
oc-tmueller wants to merge 4 commits into
masterfrom
fix/schedule-folder-on-space-available
Open

oc-tmueller wants to merge 4 commits into
masterfrom
fix/schedule-folder-on-space-available

Conversation

@oc-tmueller

Copy link
Copy Markdown
Contributor

A folder restored from the config starts out unavailable, because the spaces manager has no spaces yet. If the account connects before the /graph/v1.0/me/drives reply arrives, FolderMan::slotIsConnectedChanged() skips the folder (canSync() is false). When the space shows up, onSpacesAdded() only called setAvailable(true). Nothing enqueued the folder after that, so changes made while the client was down stayed unsynced until something changed on the server or on disk.

This is the intermittent GUI test failure in tst_syncing/test.feature:257 ("Verify pre existing folders in local (Desktop client) are copied over to the server"), for example in this run on #12762. In that client log the drives request was restarted once, and its reply came 8 ms after "connected, scheduling its folders". The client then sat idle for the full 60 s wait.

onSpacesAdded() now enqueues a folder when it goes from unavailable to available and can sync. Doing this only on that transition keeps loadSpacesAlone(), which calls onSpacesAdded() and then gets spacesAdded for the same spaces, from syncing twice.

TestFolderMan::testFolderIsScheduledWhenItsSpaceArrivesAfterConnect reproduces the order: the fake server answers /me/drives with 503 until the account is connected, then serves the space, and the test expects the pre-existing local Folder1 to be uploaded. It fails 5 of 5 runs without the change and passes 5 of 5 with it (macOS arm64, Release).

🤖 Generated with Claude Code

oc-tmueller and others added 3 commits December 3, 2026 15:02
A folder restored from the config stays unavailable until the spaces
manager has loaded its space. If the account connects before the drives
reply arrives, scheduling on connect skips the folder, and setting it
available later did not enqueue it. Nothing else triggers a sync, so
local changes made while the client was not running stayed unsynced
until something changed on the server or on disk.

Enqueue the folder in onSpacesAdded once it can sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
loadSpacesAlone calls onSpacesAdded and then gets spacesAdded for the same spaces, which synced the folder twice. Also capture the test's fake network state by value so a late request cannot read the test's dead locals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oc-tmueller
oc-tmueller requested a review from a team as a code owner December 3, 2026 14:07
FolderDefinition drops the trailing slash of the dav url, and Folder::webDavUrl() asserts that the space url matches it. Release builds compile the assert out, so the test passed locally and aborted in CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant