$ PYWIKIBOT2_TEST_WRITE=1 python2.7 -m unittest -v tests.wikibase_edit_tests.TestWikibaseWriteGeneral.test_add_claim_with_qualifier .. WARNING: API warning (wbcreateclaim) of unknown format: {u'messages': [{u'html': {u'*': u'Your edit was patched into the latest version.'}, u'name': u'wikibase-conflict-patched', u'parameters': []}]}
Description
Related Objects
Event Timeline
To reproduce just add a bunch of claims in a row. I made a simple script to reproduce:
{'labels': {'en': {'value': u'Tester de test for T104522', 'language': u'en'}}} Creating new itemu The current revision id is 25369 The current revision id is 25369 at the start of 0 Adding P508->Q207 to [[wikidata:test:Q2122]] {u'bot': 1, 'baserevid': 25369, u'value': '{"entity-type": "item", "numeric-id": 207}', 'entity': u'Q2122', u'token': u'6cc9153385c47a3f18c70bda645563215696c3f8+\\', 'snaktype': u'value', 'action': u'wbcreateclaim', 'property': u'P508'} {u'claim': {u'type': u'statement', u'mainsnak': {u'datatype': u'wikibase-item',u'datavalue': {u'type': u'wikibase-entityid', u'value': {u'entity-type': u'item', u'numeric-id': 207}}, u'property': u'P508', u'snaktype': u'value'}, u'id': u'Q2122$6D2C0E2A-9B25-40C4-A71E-2A937EB657A1', u'rank': u'normal'}, u'pageinfo': {u'lastrevid': 25370}, u'success': 1} The current revision id is 25370 after adding a claim The current revision id is 25370 at the start of 1
All is fine. We added a claim and the current revision id got increased. Let's do another:
Adding P508->Q207 to [[wikidata:test:Q2122]] {u'bot': 1, 'baserevid': 25369, u'value': '{"entity-type": "item", "numeric-id": 207}', 'entity': u'Q2122', u'token': u'6cc9153385c47a3f18c70bda645563215696c3f8+\\', 'snaktype': u'value', 'action': u'wbcreateclaim', 'property': u'P508'}
Huh? 25369? That's the old revision id! Where did you get that from?
WARNING: API warning (wbcreateclaim) of unknown format: {u'messages': [{u'html': {u'*': u'Your edit was patched into the latest version.'}, u'name': u'wikibase-conflict-patched', u'parameters': []}]}
Somewhere in https://phabricator.wikimedia.org/diffusion/PWBC/browse/master/pywikibot/site.py;a8539a78ff659e71c4fb011b6797f20e6c369edc$6954 this seems to be going wrong (or https://phabricator.wikimedia.org/diffusion/PWBC/browse/master/pywikibot/page.py;a8539a78ff659e71c4fb011b6797f20e6c369edc$3900 ?) but where? I don't see it.
Simple python script to reproduce:
def addItemStatement(repo, item, pid, qid, url, i): ''' Helper function to add a statement ''' if not qid: return False claims = item.get().get('claims') if pid in claims: return newclaim = pywikibot.Claim(repo, pid) destitem = pywikibot.ItemPage(repo, qid) if destitem.isRedirectPage(): destitem = destitem.getRedirectTarget() newclaim.setTarget(destitem) pywikibot.output(u'Adding %s->%s to %s' % (pid, qid, item)) item.addClaim(newclaim) pywikibot.output(u'The current revision id is %s after adding a claim' % (item.latest_revision_id,)) def main(): ''' ''' repo = pywikibot.Site(u'test', u'wikidata').data_repository() data = {'labels': { 'en' : {'language': u'en', 'value': u'Tester de test for T104522'} }, } print data identification = {} summary = u'Creating new itemu' pywikibot.output(summary) result = repo.editEntity(identification, data, summary=summary) itemTitle = result.get(u'entity').get('id') # Wikidata is sometimes lagging. Wait for 10 seconds before trying to actually use the item #time.sleep(10) item = pywikibot.ItemPage(repo, title=itemTitle) pywikibot.output(u'The current revision id is %s' % (item.latest_revision_id,)) pid = u'P508' qid = u'Q207' url = u'https://www.google.com/' for i in range(0,4): pywikibot.output(u'The current revision id is %s at the start of %s' % (item.latest_revision_id,i)) addItemStatement(repo, item, pid, qid, url, i) if __name__ == "__main__": main()
At https://phabricator.wikimedia.org/diffusion/PWBC/browse/master/pywikibot/site.py;a8539a78ff659e71c4fb011b6797f20e6c369edc$6981 you want to dump params and data.
Eww, changing of the revision id is a serious problem.
It might be a master only problem (try 2.0?), and the most recent related commit on master is my 39bd4702. :/
This is just annoying for some time, not actually breaking anything so "Unbreak Now!" might be a bit too much.
I was basing the increased priority on this part of T104522#1932994, which sounds like the revision id isnt being managed correctly inside Pywikibot:
Huh? 25369? That's the old revision id! Where did you get that from?
I needed to add import pywikibot to the top of @Multichill's T104522#1933026 sample code ,
Using master, I do not see a problem with the revision id. However it does very clearly show the warning described in this bug.
$ python pwb.py multichill_wd_T104522.py No handlers could be found for logger "pywiki" {'labels': {'en': {'value': u'Tester de test for T104522', 'language': u'en'}}} Creating new itemu Logging in to wikidata:test as JVbot-test The current revision id is 25418 The current revision id is 25418 at the start of 0 Adding P508->Q207 to [[wikidata:test:Q2145]] Sleeping for 7.3 seconds, 2016-01-16 07:37:49 The current revision id is 25419 after adding a claim The current revision id is 25419 at the start of 1 Adding P508->Q207 to [[wikidata:test:Q2145]] Sleeping for 7.5 seconds, 2016-01-16 07:37:59 WARNING: API warning (wbcreateclaim) of unknown format: {u'messages': [{u'html': {u'*': u'Your edit was patched into the latest version.'}, u'name': u'wikibase-conflict-patched', u'parameters': []}]} The current revision id is 25420 after adding a claim The current revision id is 25420 at the start of 2 Adding P508->Q207 to [[wikidata:test:Q2145]] Sleeping for 8.6 seconds, 2016-01-16 07:38:08 WARNING: API warning (wbcreateclaim) of unknown format: {u'messages': [{u'html': {u'*': u'Your edit was patched into the latest version.'}, u'name': u'wikibase-conflict-patched', u'parameters': []}]} The current revision id is 25421 after adding a claim The current revision id is 25421 at the start of 3 Adding P508->Q207 to [[wikidata:test:Q2145]] Sleeping for 8.9 seconds, 2016-01-16 07:38:18 WARNING: API warning (wbcreateclaim) of unknown format: {u'messages': [{u'html': {u'*': u'Your edit was patched into the latest version.'}, u'name': u'wikibase-conflict-patched', u'parameters': []}]} The current revision id is 25422 after adding a claim {'labels': {'en': {'value': u'Tester de test for T104522', 'language': u'en'}}} Creating new itemu Sleeping for 9.2 seconds, 2016-01-16 07:38:28 Sleeping for 5.0 seconds, 2016-01-16 07:38:37 Sleeping for 4.7 seconds, 2016-01-16 07:38:42 The current revision id is 25423 The current revision id is 25423 at the start of 0 Adding P508->Q207 to [[wikidata:test:Q2146]] Sleeping for 8.1 seconds, 2016-01-16 07:38:49 The current revision id is 25424 after adding a claim The current revision id is 25424 at the start of 1 Adding P508->Q207 to [[wikidata:test:Q2146]] Sleeping for 9.2 seconds, 2016-01-16 07:38:58 WARNING: API warning (wbcreateclaim) of unknown format: {u'messages': [{u'html': {u'*': u'Your edit was patched into the latest version.'}, u'name': u'wikibase-conflict-patched', u'parameters': []}]} The current revision id is 25425 after adding a claim The current revision id is 25425 at the start of 2 Adding P508->Q207 to [[wikidata:test:Q2146]] Sleeping for 9.1 seconds, 2016-01-16 07:39:08 WARNING: API warning (wbcreateclaim) of unknown format: {u'messages': [{u'html': {u'*': u'Your edit was patched into the latest version.'}, u'name': u'wikibase-conflict-patched', u'parameters': []}]} The current revision id is 25426 after adding a claim The current revision id is 25426 at the start of 3 Sleeping for 5.0 seconds, 2016-01-16 07:39:20 Adding P508->Q207 to [[wikidata:test:Q2146]] WARNING: API warning (wbcreateclaim) of unknown format: {u'messages': [{u'html': {u'*': u'Your edit was patched into the latest version.'}, u'name': u'wikibase-conflict-patched', u'parameters': []}]} The current revision id is 25427 after adding a claim
I also ran it on the 2.0 branch, with the same results.