Page MenuHomePhabricator

API: action=wbeditentity&clear=true with baserevid set doesn't throw conflicts when the existing entity has been edited
Closed, ResolvedPublic

Description

action=wbeditentity&clear=true call with baserevid set should express that "I have looked at revision XXX and if now it's still like what I've seen, clear everything and use my data to replace the existing one". However, it's not the case in reality and even caused claims to be duplicated (it seems 'clear' is not performed): https://www.wikidata.org/w/index.php?title=Q1805224&diff=89778591&oldid=89777433


Version: unspecified
Severity: normal

Details

Reference
bz57754

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:30 AM
bzimport set Reference to bz57754.
bzimport added a subscriber: Unknown Object (MLST).

Repro:

Query 1: Create a new claim, at Q245

token=XXX&data=%7B%7D&new=item

{

"entity": {
    "labels": [],
    "descriptions": [],
    "aliases": [],
    "sitelinks": [],
    "claims": [],
    "id": "Q245",
    "type": "item",
    "lastrevid": 2588
},
"success": 1

}

Query 2: Create initial revision 2589

id=Q245&token=XXX&data=%7B%22labels%22%3A%5B%7B%22language%22%3A%22en%22%2C%22value%22%3A%22Foo%22%7D%5D%2C%22claims%22%3A%7B%22P55%22%3A%5B%7B%22mainsnak%22%3A%7B%22snaktype%22%3A%22value%22%2C%22property%22%3A%22P55%22%2C%22datavalue%22%3A%20%7B%22value%22%3A%20%22abc%22%2C%22type%22%3A%20%22string%22%7D%7D%2C%22type%22%3A%22statement%22%2C%22rank%22%3A%22normal%22%7D%5D%7D%7D

{

"entity": {
    "labels": {
        "en": {
            "language": "en",
            "value": "Foo"
        }
    },
    "descriptions": [],
    "aliases": [],
    "sitelinks": [],
    "claims": {
        "P55": [
            {
                "id": "Q245$0CF9E5D0-31CD-4019-86A8-CF5AAA1CD596",
                "mainsnak": {
                    "snaktype": "value",
                    "property": "P55",
                    "datavalue": {
                        "value": "abc",
                        "type": "string"
                    }
                },
                "type": "statement",
                "rank": "normal"
            }
        ]
    },
    "id": "Q245",
    "type": "item",
    "lastrevid": 2589
},
"success": 1

}

Query 3: Attempt to rewrite the item to something

id=Q245&baserevid=2589&token=XXX&data=%7B%22labels%22%3A%5B%7B%22language%22%3A%22de%22%2C%22value%22%3A%22Bar%22%7D%5D%2C%22claims%22%3A%7B%22P55%22%3A%5B%7B%22mainsnak%22%3A%7B%22snaktype%22%3A%22value%22%2C%22property%22%3A%22P55%22%2C%22datavalue%22%3A%20%7B%22value%22%3A%20%22def%22%2C%22type%22%3A%20%22string%22%7D%7D%2C%22type%22%3A%22statement%22%2C%22rank%22%3A%22normal%22%7D%5D%7D%7D&clear=

{

"entity": {
    "labels": {
        "de": {
            "language": "de",
            "value": "Bar"
        }
    },
    "descriptions": [],
    "aliases": [],
    "sitelinks": [],
    "claims": {
        "P55": [
            {
                "id": "Q245$8424C010-5151-44B3-B00C-6F2E6EEE436B",
                "mainsnak": {
                    "snaktype": "value",
                    "property": "P55",
                    "datavalue": {
                        "value": "def",
                        "type": "string"
                    }
                },
                "type": "statement",
                "rank": "normal"
            }
        ]
    },
    "id": "Q245",
    "type": "item",
    "lastrevid": 2590
},
"success": 1

}

Query 4: Simultaneous attempt to rewrite the item to something else based on revision 2589. This created https://test.wikidata.org/w/index.php?title=Q245&oldid=2591 as a mixed revision, and returned data contain "new" attempt only

id=Q245&baserevid=2589&token=XXX&data=%7B%22labels%22%3A%5B%7B%22language%22%3A%22nl%22%2C%22value%22%3A%22Bar%22%7D%5D%2C%22claims%22%3A%7B%22P55%22%3A%5B%7B%22mainsnak%22%3A%7B%22snaktype%22%3A%22value%22%2C%22property%22%3A%22P55%22%2C%22datavalue%22%3A%20%7B%22value%22%3A%20%22qwerty%22%2C%22type%22%3A%20%22string%22%7D%7D%2C%22type%22%3A%22statement%22%2C%22rank%22%3A%22normal%22%7D%5D%7D%7D&clear=

{

"entity": {
    "labels": {
        "nl": {
            "language": "nl",
            "value": "Bar"
        }
    },
    "descriptions": [],
    "aliases": [],
    "sitelinks": [],
    "claims": {
        "P55": [
            {
                "id": "Q245$31144320-3601-4B00-B733-7F1DC6245C65",
                "mainsnak": {
                    "snaktype": "value",
                    "property": "P55",
                    "datavalue": {
                        "value": "qwerty",
                        "type": "string"
                    }
                },
                "type": "statement",
                "rank": "normal"
            }
        ]
    },
    "id": "Q245",
    "type": "item",
    "lastrevid": 2591
},
"warnings": {
    "messages": {
        "0": {
            "name": "wikibase-self-conflict-patched",
            "type": "warning"
        },
        "html": {
            "*": "<p>Your edit was patched into the latest version, overriding some of your own intermediate changes.\n</p>"
        }
    }
},
"success": 1

}

The warning? I guess an action=wbeditentity&clear=true call can hardly be interpretted as a "patch".

Change 98795 had a related patch set uploaded by Legoktm:
Die if wbeditentity tries to clear from old revid

https://gerrit.wikimedia.org/r/98795

Change 98795 merged by jenkins-bot:
Die if wbeditentity tries to clear from old revid

https://gerrit.wikimedia.org/r/98795

I logged the attached data about https://www.wikidata.org/w/index.php?title=Q874074&action=history . It appears the behavior has regressed.

Files:

Lydia_Pintscher removed a subscriber: Unknown Object (MLST).
Lydia_Pintscher removed a project: Verified.
Lydia_Pintscher set Security to None.
Lydia_Pintscher added subscribers: aude, daniel, JanZerebecki.