Repository navigation
fix(files): keep confirmed desktop writes off the virtual-file lock - #522
Open
veryCrunchy wants to merge 5 commits into
Open
veryCrunchy wants to merge 5 commits into
veryCrunchy wants to merge 5 commits into
Conversation
Folder and text file creation, text saves, favorites, and version restores ran their local cache and virtual-file refresh inline after the server confirmed them. That refresh waits on the virtual-file provider monitor, which Windows Cloud Files can hold for a long time, so a confirmed write could hang. Folder sync uploads and Linux mount writes blocked their threads the same way. DesktopFileWrites now owns these writes and rename, move, copy, and delete. Each queues its refresh on DesktopFileMutationFollowUps when the server accepts it or its result becomes unknown, returns the server result after the bounded wait, and reports the local follow-up. Text saves, created files and folders, favorites, and restores show an incomplete follow-up with the shared copy. Background sync and mount writes queue without blocking and refresh on their own thread only when the queue is full. Android reports a failed cache invalidation for the same writes and now invalidates the read cache after a version restore. Advances #477
…follow-ups # Conflicts: # tools/kotlin-file-size-baseline.txt
obiente-cloud
Bot
temporarily deployed
to
Obiente Preview / PR #522 / NC Native
October 25, 2026 14:41
Destroyed
Obiente previewNC Native · Obiente updates this comment as the preview changes. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
obiente-cloud
Bot
temporarily deployed
to
Obiente Preview / PR #522 / NC Native
October 25, 2026 14:45
Destroyed
This branch was successfully deployed
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.
Outcome
Completes #477 for the remaining desktop file writes. After the server accepts a write, the caller gets the server result promptly. The local refresh (retained-folder refresh, virtual-file metadata and read-cache invalidation, hydration scheduling) runs in the background, and its result is reported as
localFollowUp, the same wayexecuteFileMutationhas worked since #498.Before this change, these writes refreshed local state inline and could wait on
virtualFileProviderLock, an uninterruptible lock that Windows Cloud Files and Linux mounts can hold for a long time:saveTextFile,createTextFileIfAbsent,createDirectoryIfAbsentsetFileFavoriteandrestoreFileVersionfileSyncEngine.onRemoteMutationCommitted) and Linux mount writes (afterMutationInvalidated)Changes:
DesktopFileWrites.kt(new): owns the desktop write operations behind a narrow transport interface. Each write uses the same reconcile-then-bounded-wait pattern, so these all carry over: account fencing and abandonment, first-result-wins, attaching to a queued or running refresh, a typedFailedon a full queue, and the dropped-reconciliation error for an unknown result that cannot be queued.DesktopFileMutationFollowUps.afterBackgroundMutation: used by sync uploads and mount writes, which have no waiting caller. It queues without blocking. On a full queue it refreshes on the calling thread and records a diagnostic instead of dropping the refresh, because no caller would see a failure.FileMutationLocalFollowUp.reportForcopy when the local follow-up is still running or failed. Uploads still report "uploaded" only after server confirmation.tryActivateVirtualFileResource). The follow-up queue's lock is never held while a refresh runs.DesktopNextcloudServices.ktshrinks from 6161 to 5987 lines, and its baseline is lowered. A new "Local follow-up after file writes" section inADAPTER_ARCHITECTURE.mddocuments the behavior.Out of scope: the
downloadFile404 refresh (a read) can still wait on the same lock. It is tracked in #523.Verification
Every check relevant to the changed scope passes, or each unrun check is listed below with a reason
bash tools/check-repository.shpassesA new
changes/unreleased/fragment records the changeNo credentials, private server data, machine-local paths, or generated output are included
New
DesktopFileWritesTest(6 tests) uses a test thread holding a stand-in provider lock that each refresh waits on:StillRunningand the shared copy;CancellationExceptionwhile the queued refresh still runs;DesktopFileMutationFollowUpsTest(+3): background refreshes never block, refresh inline on a full queue, and stop after teardown.TextEditorStateTestandFileVersionHistoryTest(+1 each): copy for each follow-up state.Full
:ui:desktopTest --rerun(4082 tests, 71 skipped, 0 failures) and:androidApp:testDebugUnitTest --rerun(1183 tests, 0 failures), on Windows with JDK 21.:ui:lintAnalyzeRelease,bash tools/check-kotlin-architecture.shandbash tools/check-repository.shpass.Limit: the lock tests target
DesktopFileWriteswith a stand-in lock, not the privatevirtualFileProviderLock, because constructingDesktopNextcloudServicesin a test needs real preferences and a real secret store. No manual run against a live Windows Cloud Files or Linux mount was done.Compatibility and risk
Desktop and Android. Return types changed for
createDirectoryIfAbsent(nowDirectoryCreation),setFileFavoriteandrestoreFileVersion(nowFileMutationLocalFollowUp).SavedTextFilegainedlocalFollowUp, which defaults to completed. Network failures in the newly routed desktop writes now surface as not-sent or outcome-unknown errors, matchingexecuteFileMutation.Visual changes
Not applicable. Only status copy changes when local follow-up is incomplete.