Page MenuHomePhabricator

New wikidata claims ignored by itemPage.editEntity
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • Have an ItemPage with an existing array of claims for a given property
  • Create a new claim for the given property
  • Append the new claim to the array of existing claims
  • Invoke editEntity on the ItemPage

What happens?:
The new claim is not included in the updated ItemPage.

What should have happened instead?:

The new claim should appear on the updated ItemPage.

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:
Encountered while running a script against Wikidata on Toolserver Kubernetes:
*python: 3.9.2
*pywikibot: 7.2.1

I can reproduce by adding a test case to wikibase_edit_tests.py running on
*python: 3.10.4
*pywikibot: 7.3.0.dev0

Diagnosis
The method ClaimCollection.toJSON() is ignoring new claims because they have no id immediately after being created. (See _collections.py line 279)

I can commit the test case and a one-line fix to _collections.py.

Event Timeline

Xqt subscribed.

I can reproduce by adding a test case to wikibase_edit_tests.py running on

I can commit the test case and a one-line fix to _collections.py.

That would be fine!

Xqt triaged this task as High priority.May 12 2022, 2:37 PM

Change 791428 had a related patch set uploaded (by William Avery; author: William Avery):

[pywikibot/core@master] Changes for T308245

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

Change 791428 had a related patch set uploaded (by William Avery; author: William Avery):

[pywikibot/core@master] ClaimCollection.toJSON() should not ignore new claims

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

Change 791428 merged by jenkins-bot:

[pywikibot/core@master] [bugfix] ClaimCollection.toJSON() should not ignore new claims

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

Xqt claimed this task.

Thank you @William_Avery. Please add yourself to the AUTHORS.rst file.

Change 791712 had a related patch set uploaded (by William Avery; author: William Avery):

[pywikibot/core@master] Add myself to AUTHORS.rst

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

Change 791712 merged by Xqt:

[pywikibot/core@master] Add myself to AUTHORS.rst

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