When a document being synchronized with the remote Cozy is moved on
the local filesystem, we fail to merge the move in PouchDB because we
fetch the source record before it is updated by Sync (i.e. to add the
remote info) and get a conflict error since we don't have the new
revision.
Fetching the source record (again) right before merging the move, when
Merge has the PouchDB lock, solves this problem.
This should not create new issues as Merge should be able to handle
potential situations where changes to the source record are more
substantial than adding remote metadata.
Please make sure the following boxes are checked:
[x] PR is not too big
[x] it improves UX & DX in some way
[ ] it includes unit tests matching the implementation changes
[x] it includes scenarios matching a new behaviour or has been manually tested
I could not figure out a way to build an automated test since it is very time sensitive and our test helpers do not give enough control here.
I tested it manually though.
When a document being synchronized with the remote Cozy is moved on the local filesystem, we fail to merge the move in PouchDB because we fetch the source record before it is updated by Sync (i.e. to add the remote info) and get a conflict error since we don't have the new revision.
Fetching the source record (again) right before merging the move, when Merge has the PouchDB lock, solves this problem.
This should not create new issues as Merge should be able to handle potential situations where changes to the source record are more substantial than adding remote metadata.
Please make sure the following boxes are checked: