Repository navigation
fix(sync): improve situation around false conflicts - #9542
Merged
Merged
Conversation
| * @param ?string $content Content just written to the context, to avoid reading it again | ||
| */ | ||
| public function updateDocument(Document $document): void; | ||
| public function updateDocument(Document $document, ?string $content = null): void; |
Contributor
There was a problem hiding this comment.
I wonder if this breaks the API for deck. It only implements
public function updateDocument(Document $document): void;
I suspect that's not enough for implementing IContext anymore.
Member
Author
There was a problem hiding this comment.
True. So let's not touch the API and instead store savedContent as an instance variable in FileContext.php to be reused. I'll adjust.
A save request loads the document before checking for outside changes. If another save by Text finished in between, the file checksum no longer matched the loaded document and the save was rejected with 409, which now shows the conflict dialog. Before reporting a conflict, reload the document and only treat the change as outside if the stored checksum still differs from the file. Continue with the reloaded document so the following checks see the version saved in the meantime. Signed-off-by: Jonas <jonas@freesources.org> Assisted-by: ClaudeCode:claude-opus-5-5
After writing the file, the checksum was computed by reading the file again and stored only after the document state. A lock on the file or a failure while writing the state left the previous checksum behind, so every following save was rejected as a conflict. Reading the file again could also pick up an outside change written right after the save and hide the conflict. Compute the checksum from the content Text just wrote and store it right after writing the file. Signed-off-by: Jonas <jonas@freesources.org> Assisted-by: ClaudeCode:claude-opus-5-5
The conflict check reads the whole file to compute its checksum, also for autosaves that are then dropped because the last save was less than AUTOSAVE_MINIMUM_DELAY seconds ago. Return early for those autosaves before checking for conflicts. They do not write anything, so skipping the check cannot overwrite outside changes. Manual saves are not throttled and are still checked. Signed-off-by: Jonas <jonas@freesources.org> Assisted-by: ClaudeCode:claude-opus-5-5
This was referenced Nov 4, 2026
max-nextcloud
approved these changes
Nov 4, 2026
Member
Author
|
/backport to stable35 |
Member
Author
|
/backport to stable34 |
3 tasks done
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.
📝 Summary
See commit messages for details.
🏁 Checklist
npm run lint/npm run stylelint/composer run cs:check)🤖 AI (if applicable)