Wikibase
MediaWiki Wikibase extension
|
Date of submission: 2019-06-21
Last updated: 2019-07-04
Discussion Deadline: 2019-07-09
accepted
wbeditentity
summary message for Wikibase Items and Properties provides very little information on what have been changed on the entity, with the main message in the summary being "Item Changed".
In T220696, we want to update those summary messages generated for Wikibase Items and Properties when using wbeditentity
to be more detailed and informative.
Wikibase Lexeme achieved generating detailed summary messages by:
We considered doing the same thing for Wikibase, but that seemed a little off with regards to clean design.
The main two places where this off-feeling came from are:
currently ChangeOp is concerned with:
a. representing a change that can be applied to an entity
b. applying that change to an entity
c. generating summary messages as a result of applying it to an entity
We then considered:
This solution comes with some cost of initial implementation and refactoring of current ChangeOp design and relevant implementations within Wikibase and WikibaseLexeme.
The benefits of this solution is that it:
We decided to go with the second option, the visitor pattern design.
In order to achieve that, we will make ChangeOp::apply() return ChangeOpResult that is defined by the following IDL:
Provide needed implementations of ChangeOpResult that can capture the result of applying the different ChangeOp implementations.
Example:
ChangeOpLabel will probably return something like ChangeOpLabelResult that is defined as:
There is one consequence of going with visitor pattern design. Wikibase and WikibaseLexeme will have two separate ways to achieve similar requirements.
This should be treated as short-term inconsistency of design and should be mitigated by a follow-up refactoring task that changes Lexeme implementation into reusing the visitor pattern similar to Wikibase.
Changing ChangeOp interface in Wikibase will result in failing CI jobs due to the fact that Wikibase CI will also run WikibaseLexeme tests as part of its pipeline. This creates a circular situation for implementations of ChangeOp interface.
The way to go around it is to go in this order:
Although this situation is not good enough as a reason, but it slightly hints that ChangeOp concepts might better be moved out into a separate library that can then be versioned and depended on as per proper mechanisms from Wikibase and WikibaseLexeme.