Page MenuHomePhabricator

đŸĨ‘ī¸ Provide initial "automated summaries" to statement edits made with Wikibase REST API
Closed, ResolvedPublic8 Estimated Story Points

Description

As a Wikidata patroller I want statement edits made with REST API to have an "automated summary" provided so that I can have a quick overview on what the edit has been about.
As a Wikidata patroller I want statement edits made with REST API to have an "automated summary" provided so that I can consider edits made with the REST API in my regular workflows.

For the time being (July 2022), with no better alternative present, Wikibase REST API will mimic the "automated summaries" of Wikibase's Action API and other logic.

The following "automated summary" templates are suggested to use with edits made with specific REST methods and paths

POST /entities/items/{item_id}/statements/* wbsetclaim-create:1||1 */ [[Property:P123]]: VALUE_FORMATTED
PUT /entities/items/{item_id}/statements/{statement_id}
PUT /statements/{statement_id}
/* wbsetclaim-update:1||1 */ [[Property:P123]]: VALUE_FORMATTED
DELETE /entities/items/{item_id}/statements/{statement_id}
DELETE /statements/{statement_id}
/* wbremoveclaims-remove:1| */ [[Property:P123]]: VALUE_FORMATTED
PATCH /entities/items/{item_id}/statements/{statement_id}
PATCH /statements/{statement_id}
/* wbsetclaim-update:1||1 */ [[Property:P123]]: VALUE_FORMATTED

Notes to the above:

  • [[Property:P123]] should be replaced by the wiki-specific wikitext representation of the link to the property used in the statement (P123 in the examples)
  • VALUE_FORMATTED should be replaced by the wiki-specific wikitext representation of the value of the statement ("main snak")

No "smarter" automated summaries are intended to be provided for the time being.

Note: The MediaWiki framework will automatically truncate comments longer than the allowed limit of characters, so there is no need to change the comment length validation for this story.

Related Objects

StatusSubtypeAssignedTask
OpenNone
ResolvedLydia_Pintscher
InvalidNone
InvalidNone
ResolvedWMDE-leszek
ResolvedWMDE-leszek
ResolvedWMDE-leszek
ResolvedWMDE-leszek
ResolvedWMDE-leszek
ResolvedWMDE-leszek
ResolvedWMDE-leszek
ResolvedWMDE-leszek
ResolvedWMDE-leszek
ResolvedOllie.Shotton_WMDE
ResolvedWMDE-leszek
ResolvedWMDE-leszek
ResolvedJakob_WMDE
ResolvedWMDE-leszek
ResolvedWMDE-leszek
ResolvedOllie.Shotton_WMDE
ResolvedOllie.Shotton_WMDE
ResolvedJakob_WMDE
ResolvedJakob_WMDE
ResolvedWMDE-leszek
ResolvedSilvan_WMDE
ResolvedSilvan_WMDE
ResolvedSilvan_WMDE
ResolvedSilvan_WMDE
ResolvedWMDE-leszek
ResolvedJakob_WMDE
ResolvedJakob_WMDE
ResolvedSilvan_WMDE
ResolvedNone
ResolvedJakob_WMDE
ResolvedOllie.Shotton_WMDE
ResolvedSilvan_WMDE
ResolvedWMDE-leszek
ResolvedOllie.Shotton_WMDE
ResolvedJakob_WMDE
ResolvedOllie.Shotton_WMDE
ResolvedJakob_WMDE
ResolvedJakob_WMDE
ResolvedWMDE-leszek
ResolvedJakob_WMDE
ResolvedOllie.Shotton_WMDE
ResolvedOllie.Shotton_WMDE
ResolvedOllie.Shotton_WMDE
ResolvedJakob_WMDE
ResolvedSilvan_WMDE
ResolvedSilvan_WMDE

Event Timeline

WMDE-leszek added a subscriber: Lydia_Pintscher.

changed "modules" and "actions" to match existing i18n keys per suggestion from @Lydia_Pintscher

WMDE-leszek set the point value for this task to 8.Jul 25 2022, 10:38 AM

Notes from task breakdown:

  • include auto summary data in EditMetadata - @Jakob_WMDE
    • change EditMetadata
      • remove the getComment method
      • add a getSummary method which returns an EditSummary object
    • create an EditSummary interface and implement it in a StatementEditSummary class
      • EditSummary has two methods public function getUserComment(): ?string and public function getEditAction(): string and constants for all kinds of edit actions
      • StatementEditSummary has factory methods for all actions, and a public function getStatement(): Statement method
  • change all use cases to create the EditMetadata with the corresponding StatementEditSummary using the factory methods - @Silvan_WMDE
    • in MediaWikiEditEntityFactoryItemUpdater use the user comment from the EditSummary object
  • create a FormatableSummaryAdapter which creates a FormatableSummary from our EditSummary - @Ollie.Shotton_WMDE
    • maps the EditSummary::getEditAction to the FormatableSummary with the module name (wbsetclaim or wbremoveclaims), action name (create, update, remove)
    • gets the property id and mainsnak from StatementEditSummary::getStatement
  • change MediaWikiEditEntityFactoryItemUpdater - @Jakob_WMDE
    • inject the FormatableSummaryAdapter and SummaryFormatter
    • in the call $editEntity->attemptSave() do $this->summaryFormatter->format( $this->mediaWikiSummaryAdapter->newFromSummary( $editMetadata->getSummary() ) ),
    • e2e tests
Jakob_WMDE renamed this task from Provide initial "automated summaries" to statement edits made with Wikibase REST API to đŸĨ‘ī¸ Provide initial "automated summaries" to statement edits made with Wikibase REST API.Sep 14 2022, 2:46 PM

Change 833728 had a related patch set uploaded (by WMDE-leszek; author: WMDE-leszek):

[mediawiki/extensions/Wikibase@master] REST DNM exploration change for T312811

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

Due to @WMDE-leszek's failure the incorrect "autocomment" has been requested in the original description, leading to incorrect plural form message to be used in create/update summaries (accidentally working correctly for the removal summary), i.e. "Create claims", "Updated claims" where it should only mention a single "claim".
Description adjusted to cover the correct "pseudo code" to use.

WMDE-leszek claimed this task.

Change 833728 abandoned by WMDE-leszek:

[mediawiki/extensions/Wikibase@master] REST DNM exploration change for T312811

Reason:

was an exploration code only

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