Page MenuHomePhabricator

Reference gets deleted during patch when edit conflicting with another user.
Open, MediumPublic

Description

Hello, I have noticed that when a reference is added, and another user also adds a reference at the same time and same property. The first one gets removed.

My edit: 1
The nexts edit: 2

Event Timeline

Reproducible on test:

Something is wrong with the edit conflict detection and merging..

Base revid is correctly passed to the API, so this is a backend issue.

The second api response (where the reference is overwritten) correctly says that the edit has been patched, but the patch results in the wrong final revision:

    "wbsetclaim":
    {
        "messages":
        [
            {
                "name": "wikibase-conflict-patched",
                "parameters": [],
                "html":
                {
                    "*": "Your edit was patched into the latest version."
                },
                "type": "warning"
            }
        ]
    }
},
Addshore renamed this task from Reference get deleted to Reference gets deleted during patch when edit conflicting with another user..Feb 6 2020, 11:24 AM
Addshore triaged this task as Medium priority.

@Lydia_Pintscher what would you say should happen in such a situation? Patch the edit and have both references or trigger an edit conflict?

Jakob and I sat down together last week to talk this through. Two take-aways:

  • I seem to remember having related discussions and tickets with Thiemo. Pinged him to see if he remembers more details.
  • The issue described here isn't just about references. Qualifiers are equally affected. And to make things worse the behavior is different for the main snak. We should probably align the behavior unless more insights turn up from Thiemo.
Jakob_WMDE subscribed.

Moving this back as it seems to need more work before it can be worked on

As discussed with @Lydia_Pintscher and @thiemowmde it should behave the following way:

  • if two users add a reference/qualifier at the same time (= edit with the same base revision), they should be merged, and both references/qualifiers get added
  • if two users edit the same reference/qualifier at the same time, it should get detected as a merge conflict

Technical Notes:
Edits made through the entity page UI via wbsetclaim do send a baserevid when making edits on statements. Looking into the SetClaim code I noticed that it currently deserializes the whole statement from the request and passes that into a ChangeOpStatement directly. I believe what it should instead be doing is to use a ChangeOpDeserializer to turn the requests into individual changes. Maybe that would already solve the problem.

Looks like it also happens if someone is changing the rank of the statement (example).