Skip to content

Data Loss Scenario with DiffMatchPatch #201

Description

@roundhill

If you follow the reproduction steps at Automattic/simplenote-android#560 (comment) in Simplenote, you'll get data loss for the last line that you added.

I think this is an issue with the way we are transforming a diff to apply local and remote changes at once to an object here: https://github.com/Simperium/simperium-android/blob/develop/Simperium/src/main/java/com/simperium/client/Bucket.java#L966

I tried a test where I added the text One and Two while offline around a paragraph that was deleted remotely. The incoming patch was:

{"content":{"o":"d","v":"=683\t-815\t+DELETED!"},"modificationDate":{"o":"r","v":1.537995756631E9}}

The local patch was:

{"content":{"o":"d","v":"=685\t+e%0A%0AOn\t=813\t+%0A%0ATwo"},"modificationDate":{"o":"r","v":1537995767}}

But the resulting transformed diff was:

{"modificationDate":{"o":"r","v":1537995767}}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions