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

bzimport added a subscriber: Unknown Object (MLST).
bzimport set Reference to bz57754.
liangent created this task.Via LegacyNov 29 2013, 6:23 PM
liangent added a comment.Via ConduitNov 29 2013, 6:42 PM

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

}

liangent added a comment.Via ConduitNov 29 2013, 6:46 PM

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

gerritbot added a comment.Via ConduitJan 9 2014, 4:26 AM

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

gerritbot added a comment.Via ConduitJan 20 2014, 1:56 PM

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

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

liangent reopened this task as "Open".Via WebDec 1 2014, 10:33 AM

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

Lydia_Pintscher added a project: Wikidata.Via WebDec 1 2014, 2:23 PM
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).
Lydia_Pintscher triaged this task as "Normal" priority.Via WebDec 3 2014, 12:22 PM
Lydia_Pintscher added subscribers: aude, daniel, JanZerebecki.
Lydia_Pintscher removed a project: Verified.
Lydia_Pintscher set Security to None.
Liuxinyu970226 added a subscriber: Liuxinyu970226.Via WebMay 12 2015, 6:11 AM
Addshore closed this task as "Resolved".Via WebMay 12 2015, 9:50 AM
Addshore claimed this task.
Liuxinyu970226 removed a subscriber: Liuxinyu970226.Via WebMay 12 2015, 9:59 AM

Add Comment