Page MenuHomePhabricator

[REPO][CLIENT][SW] Wikibase: Fire postEdit hook after making an edit
Open, Needs TriagePublic

Description

For the http-client-hints project, CheckUser listens to the postEdit hook to obtain the newly created revision ID, and it sends this information along with user agent client hints to a CheckUser REST endpoint for storage (see https://www.mediawiki.org/wiki/Extension:CheckUser/Client_Hints and https://wikitech.wikimedia.org/wiki/User-agent_client_hints for more information.)

Wikibase does not fire the postEdit hook, and this task proposes that it starts doing so, so that we can receive client hint data alongside Wikibase edits. (Doing so would also provide more consistency in having JS editing interfaces use a common hook for signaling that they've made an edit, although, see T330831: Make postEdit hook reliably support user interaction for critiques of postEdit and an alternative proposal.)

Event Timeline

Which arguments is the hook supposed to be fired with? Is there documentation for it anywhere?

Which arguments is the hook supposed to be fired with? Is there documentation for it anywhere?

AIUI, it is acceptable to fire without any arguments, from resources/src/mediawiki.action/mediawiki.action.view.postEdit.js:

/**
 * Fired after an edit was successfully saved.
 *
 * Does not fire for null edits.
 *
 * Code that fires the postEdit hook should first set `wgRevisionId` and `wgCurRevisionId`
 * to the revision associated with the edit that triggered the postEdit hook, then fire
 * the postEdit hook, e.g.:
 *
 *     mw.config.set( {
 *        wgCurRevisionId: data.newrevid,
 *        wgRevisionId: data.newrevid
 *     } );
 *     // Now fire the hook.
 *     mw.hook( 'postEdit' ).fire();	 
 */
Michael subscribed.

I think this is to the largest degree about the Edits as they made on Wikidata, right? There is some impact on WikibaseClient(=Wikibase code that runs on Wikipedias, Wikisource, Wikivoyage, Wiktionary,...) especially around WikiData-Bridge and maybe the Link-Item widget, but that's not the primary focus, right?

I think this is to the largest degree about the Edits as they made on Wikidata, right? There is some impact on WikibaseClient(=Wikibase code that runs on Wikipedias, Wikisource, Wikivoyage, Wiktionary,...) especially around WikiData-Bridge and maybe the Link-Item widget, but that's not the primary focus, right?

If this primarily affects WikibaseRepo: @Ifrahkhanyaree_WMDE is this a task you could consider for the Wikibase Product Platform Team WPP backlog?

Also just talked about this in our call but for documentation's sake: For the moment, it's not on our radar

I think this is to the largest degree about the Edits as they made on Wikidata, right? There is some impact on WikibaseClient(=Wikibase code that runs on Wikipedias, Wikisource, Wikivoyage, Wiktionary,...) especially around WikiData-Bridge and maybe the Link-Item widget, but that's not the primary focus, right?

Is there a list somewhere of the types of edits made on Wikidata?

On the Wikipedias, editing a page (source editor or VisualEditor) or using DiscussionTools will fire the postEdit hook, which CheckUser extension listens to in order to collect and store client hint data.

Ideally, any interface used on Wikidata for creating a revision would also fire the postEdit hook, so that CheckUser can collect and store client hint data.

Is there a list somewhere of the types of edits made on Wikidata?

Not sure if such a list exists anywhere, but it is bound to be long. Just the things from the top of my head:

  • editing Item/Property terms via the legacy desktop Termbox
  • editing Item/Property terms via the mobile Vue Termbox
    • soon™️ that Vue Termbox will also be used to edit EntitySchema terms on desktop
  • editing statements via the Wikibase UI
  • editing sitelinks on Items via the Wikibase UI
  • Restoring a previous good revisions via the history
  • undoing specific previous edits on Items/Properties/Lexemes via the history (I think this is a home-grown Wikibase functionality)
  • Editing the Lemmas, Forms and Senses via the WikibaseLexeme vue-based UI
  • undoing specific previous edits on EntitySchema via the history (Reimplementation of the Wikibase thing)
  • Editing a EntitySchema text via the edit action

This does not include edits from Special pages, because based on https://wikitech.wikimedia.org/wiki/User-agent_client_hints Client Hints seem to not be enabled there?
Also, I probably forgot a bunch of places, and also did not yet consider whether we have any popular Gadgets for editing.
Further, as mentioned above, there are edits made on Wikidata from other WMF wikis via the Link-Item widget for Sitelinks and (in practice for now disabled) Wikidata Bridge.
Finally, it is worth noting that majority of edits on Wikidata are not made by humans via the UI but by bots or somewhat external tools like quickstatements (https://www.wikidata.org/wiki/Help:QuickStatements).

Is there a list somewhere of the types of edits made on Wikidata?

Not sure if such a list exists anywhere, but it is bound to be long. Just the things from the top of my head:

  • editing Item/Property terms via the legacy desktop Termbox
  • editing Item/Property terms via the mobile Vue Termbox
    • soon™️ that Vue Termbox will also be used to edit EntitySchema terms on desktop
  • editing statements via the Wikibase UI
  • editing sitelinks on Items via the Wikibase UI
  • Restoring a previous good revisions via the history
  • undoing specific previous edits on Items/Properties/Lexemes via the history (I think this is a home-grown Wikibase functionality)
  • Editing the Lemmas, Forms and Senses via the WikibaseLexeme vue-based UI
  • undoing specific previous edits on EntitySchema via the history (Reimplementation of the Wikibase thing)
  • Editing a EntitySchema text via the edit action

This does not include edits from Special pages, because based on https://wikitech.wikimedia.org/wiki/User-agent_client_hints Client Hints seem to not be enabled there?

Currently the only supported method to collect Client Hints data is via the REST API which is called by the postEdit JS hook. Ideally we would want to use the REST API method over using HTTP headers due to the need to set the headers in a previous response. Using the REST API method allows us to collect the data once the edit has actually been made without having to predict whether the user is likely to be making an edit on a page load before the edit was performed.

We had not worked on storing data for any action that used a Special page so the relevant docs and code were not updated.

Also, I probably forgot a bunch of places, and also did not yet consider whether we have any popular Gadgets for editing.
Further, as mentioned above, there are edits made on Wikidata from other WMF wikis via the Link-Item widget for Sitelinks and (in practice for now disabled) Wikidata Bridge.
Finally, it is worth noting that majority of edits on Wikidata are not made by humans via the UI but by bots or somewhat external tools like quickstatements (https://www.wikidata.org/wiki/Help:QuickStatements).

Is there a list somewhere of the types of edits made on Wikidata?

Not sure if such a list exists anywhere, but it is bound to be long. Just the things from the top of my head:

  • editing Item/Property terms via the legacy desktop Termbox
  • editing Item/Property terms via the mobile Vue Termbox
    • soon™️ that Vue Termbox will also be used to edit EntitySchema terms on desktop
  • editing statements via the Wikibase UI
  • editing sitelinks on Items via the Wikibase UI
  • Restoring a previous good revisions via the history
  • undoing specific previous edits on Items/Properties/Lexemes via the history (I think this is a home-grown Wikibase functionality)
  • Editing the Lemmas, Forms and Senses via the WikibaseLexeme vue-based UI
  • undoing specific previous edits on EntitySchema via the history (Reimplementation of the Wikibase thing)
  • Editing a EntitySchema text via the edit action

This does not include edits from Special pages, because based on https://wikitech.wikimedia.org/wiki/User-agent_client_hints Client Hints seem to not be enabled there?
Also, I probably forgot a bunch of places, and also did not yet consider whether we have any popular Gadgets for editing.
Further, as mentioned above, there are edits made on Wikidata from other WMF wikis via the Link-Item widget for Sitelinks and (in practice for now disabled) Wikidata Bridge.
Finally, it is worth noting that majority of edits on Wikidata are not made by humans via the UI but by bots or somewhat external tools like quickstatements (https://www.wikidata.org/wiki/Help:QuickStatements).

Thanks for this list! I suppose this is a question for checkuser users on Wikidata--which of these is most important for collecting signals when doing sock puppet investigations? Then focus on an implementation for just that editing entrypoint, rather than trying to deal with all of them.

Michael added a subscriber: Lydia_Pintscher.

Thanks for this list! I suppose this is a question for checkuser users on Wikidata--which of these is most important for collecting signals when doing sock puppet investigations? Then focus on an implementation for just that editing entrypoint, rather than trying to deal with all of them.

That is a valid point. I do not have enough insight to guess which editing patterns tend to trigger check-user requests, given that they might be different from your random vandalism. Not sure if there is already research on that, but I'm adding Wikidata data quality and trust as this relates to fighting (somewhat more) sophisticated abuse. Also, to me this now enters Product territory, and so @Lydia_Pintscher might have thoughts on the next steps.

Also, I wonder how this in practice interacts with the creation of temporary accounts (and associated redirects) that are currently being added in context of T354730#9516706?

That is a valid point. I do not have enough insight to guess which editing patterns tend to trigger check-user requests, given that they might be different from your random vandalism. Not sure if there is already research on that, but I'm adding Wikidata data quality and trust as this relates to fighting (somewhat more) sophisticated abuse. Also, to me this now enters Product territory, and so @Lydia_Pintscher might have thoughts on the next steps.

I don't think there is any research on this. I'm adding @Jasper, one of the people with check-user rights on Wikidata for some input.

Lucas_Werkmeister_WMDE renamed this task from Wikibase: Fire postEdit hook after making an edit to [REPO][CLIENT][SW] Wikibase: Fire postEdit hook after making an edit.Apr 12 2024, 12:36 PM