Conversation
Copilot
AI
changed the title
[WIP] Fix issue where adding claims deletes existing claims
Fix Claims.add() default to preserve existing claims instead of replacing them
Nov 10, 2025
Co-authored-by: LeMyst <1592048+LeMyst@users.noreply.github.com>
Co-authored-by: LeMyst <1592048+LeMyst@users.noreply.github.com>
Replace the standalone test file with regression tests in TestClaims and an offline write test against MockWikibase, and document the new default in the README "Modify an existing item" example. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
LeMyst
force-pushed
the
copilot/fix-claim-adding-issue
branch
from
September 19, 2026 15:53
5ed5f5a to
1c143f3
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claims.add()defaulted toActionIfExists.REPLACE_ALL: adding a claim to an entity fetched from the instance marked every existing claim with the same property for removal, so they were deleted onwrite()(#922).Changes
action_if_existsofClaims.add()is nowActionIfExists.APPEND_OR_REPLACE, the same default asBaseEntity.add_claims(): the new claim is appended, and an identical claim is not duplicated.test/test_models.py(TestClaims) and an offline write test intest/test_entity_item.pychecking that thewbeditentitypayload does not remove the existing claims.Scripts relying on
item.claims.add(...)replacing the existing claims of the property will now append instead, without any error. To keep the previous behavior, pass the action explicitly:This should be mentioned in the release notes.
Out of scope
Qualifiers.add(),References.add(),Reference.add(),Senses.add()andwrite_required()still default toREPLACE_ALLand are left unchanged here.Fixes #922
🤖 Generated with Claude Code