Page MenuHomePhabricator

Implement wrapper WritingEntityRepository removing redundant parts
Closed, ResolvedPublic

Description

This implementation will wrap an ApiWritingRepository and diff the old and new data to remove any parts that didn’t change and therefore don’t need to be sent.

In practice, we expect this diffing to be most relevant at the statement group level (as in, we can completely remove statement groups other than the one property ID that the bridge is editing). Diffing within individual statement groups should only make a difference for the “update” edit decision, and then only if the previous statement had “normal” rank; in general, if the statement group contained statements that didn’t change and statements that did, then it would have been ambiguous and we would have bailed out instead. Diffing within individual statements may be useful to skip sending qualifiers and references, but that might not be necessary.

Note that this implementation cannot wrap any WritingEntityRepository – other implementations might interpret the removal of parts of the data as a request to actually remove it server-side. That is, we consider the fact that wbeditentity allows you to omit part of the data to be an implementation detail of that API, not an intrinsic property of any service that allows you to edit entity data.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 25 2020, 1:57 PM

Since we don’t yet support removing statements (see T230343#5998405 for the problems that brings), this differ should probably throw an exception if it detects that any statement has been removed between the old and new version.

Change 584033 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] WIP: bridge: add DiffingWritingRepository

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

Note: unless I did the test in my local wiki wrong, you can’t omit the qualifiers or references of an individual statement to leave them untouched. If you’re editing a statement, it looks like you need to send the whole statement, or your edit will remove qualifiers/references.

Edit: you can’t omit the rank either, if you do it gets reset to “normal” even if the statement used to have “preferred” rank.

Change 584033 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] bridge: add TrimmingWritingRepository

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

Lucas_Werkmeister_WMDE closed this task as Resolved.Mar 31 2020, 3:52 PM