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.