Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bookmark CRDT is not total #16

Closed
calpaterson opened this issue Apr 26, 2020 · 4 comments
Closed

Bookmark CRDT is not total #16

calpaterson opened this issue Apr 26, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@calpaterson
Copy link
Owner

Description

Bookmark CRDT covers nearly all cases but not everything - sometimes merges are not commutative.

Steps to reproduce

  1. Two bookmarks A and B with same updated time but other differing features
  2. Merge A with B to create C
  3. Merge B with A to create D

Expected result

C == D

Actual result

C != D

Additional details

The problem occurs in this code:

        more_recent: "Bookmark" = sorted(
            (self, other),
            # The below lambda should include all fields for which more_recent is consulted
            # ie, everything other than created and updated
            key=lambda b: (
                b.updated,
                len(b.title),
                len(b.description),
                b.title,
                b.description,
            ),
            reverse=True,
    
        return Bookmark(
            url=self.url,
            created=min((self.created, other.created)),
            updated=max((self.updated, other.updated)),
            title=more_recent.title,
            description=more_recent.description,
            unread=more_recent.unread,
            deleted=more_recent.deleted,
        )    )[0]
@calpaterson
Copy link
Owner Author

Fixed in 11a9300

@calpaterson
Copy link
Owner Author

Reopening as it's not been fixed in the extension

@calpaterson calpaterson reopened this May 2, 2020
@calpaterson
Copy link
Owner Author

Pretty sure this issue is fixed but need to confirm it

@calpaterson calpaterson added the bug Something isn't working label Dec 8, 2020
@calpaterson
Copy link
Owner Author

Review the code, extension differs slightly and needs to be brought into line: #57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant