Page MenuHomePhabricator

Decide how to handle redirects in Wikidata Bridge
Open, Needs TriagePublic

Description

As a Wikipedia editor, when I click a Wikidata Bridge edit link whose target item is a redirect, I want… what to happen?

Problem:
We currently don’t handle redirected items very well: since the response contains a different entity ID (the redirect target) than we expected, we’ll throw an error “Result does not contain relevant entity.”

Example:
https://wikidata.beta.wmflabs.org/wiki/Talk:Q368240 is one example case, though the Bridge doesn’t seem to auto-load for some reason (I ran mw.loader.using( 'wikibase.client.data-bridge.init' ) in the console to overcome this).

Screenshots/mockups:

BDD
GIVEN
AND
WHEN
AND
THEN
AND

Acceptance criteria:

Open questions:

  • Is this something we need to handle at all? I would assume that if a client wiki has an edit link for some statement, then it has read the statement from the target entity, and it can’t be a redirect. (Unless it was just merged and the edit hasn’t been dispatched yet, I guess.) But I don’t know how the Lua code handles redirects – maybe it’s possible that you read Item A → Property X → Item B → Property Y → Value C, where Item B is a redirect to Item B' but Item A was not updated and still points to Item B, and you add an edit link for Item B’s Value C statement, because you never even noticed that the statement really came from Item B'.

Event Timeline

I think we should just make this transparent for the editor. They should just edit the value on the redirect target and not be made aware of the redirect being there. But I think we can leave this for after step 1.

They should just edit the value on the redirect target and not be made aware of the redirect being there

Making the status quo explicit: While this sounds intuitive it is not what we currently witness - bridge shows an error on load instead.

We added a case like it to the beta playground: https://en.wikipedia.beta.wmflabs.org/wiki/Data_bridge ("redirected link (item used to exist, but now redirects)")

Technical background: there is no major hurdle to allow for the described behavior to happen, but our code as of writing this checks and complains if the "Result does not contain relevant entity." - which it does not, if the response yields a different id than requested. There is a redirects property on wbgetentities responses which could be used to tell these scenarios apart.

Making the status quo explicit: While this sounds intuitive it is not what we currently witness - bridge shows an error on load instead.

This is no longer true, T240223: Step 1: Ensure that Wikidata Bridge uses fresh entity data (impact: high) changed that behavior.
Instead, loading behaves as usual, the user is presented with the value, can edit it, and only on save an error occurs.

Technical background: "Revision with ID not found." on save, as the baserevid sent does not correspond to the entity identified by id, because the bridge app tries to save it using the entity id it received from the bridge-enabled link instead of the id to which this entity was redirected to.

IMO this is now weird behavior, first somehow functioning but then breaking with no indication as to why.