Page MenuHomePhabricator

Investigate "PseudoEntityId-interface" approach for extending Wikibase in a type-safe way
Closed, DeclinedPublic1 Estimated Story Points


We may wish to leverage the PHP type system for additional safety when breaking the long-standing fundamental assumption that wikibase-entityid refers to things that have been registered with the Wikibase Entity registration mechanism.

This task is about creating a proof of concept for that direction and outline its major aspects.

Event Timeline

Michael set the point value for this task to 1.
Michael removed Michael as the assignee of this task.EditedNov 10 2023, 3:47 PM

The result of this investigation can now be found at:

The commits are not yet very meaningful, except that the last commit in each branch deals with Lua/ParserFunction access and usage tracking, as it is needed for MS 3. For now, it is assumed that only access to labels, descriptions, etc., on the repository wiki is required, so cross-wiki access, usage tracking and change dispatching has not been implemented yet.

  • I note that the output of repo/maintenance/dumpRdf.php is broken due to EntitySchema, though I did not yet look closer into why that is.
  • The Lua method getLabelByLang still results in an internal error, probably need to inject a DispatchingPseudoTermLookup (to be created)
  • The SidebarBeforeOutput hook that we use to add the concept link to the sidebar on EntitySchema pages needs to be reworked when EntitySchema is enabled on the client (currently it is just deleted)
  • Special:EntityUsage does not yet work
  • mw.wikibase.getEntityUrl('E123') does not yet result in a working link (Special:EntityPage/E123 support still needed)

This complements the investigation in T349686

I think it looks pretty good to me so far… I haven’t looked at all the changes in detail, but overall I certainly get the impression that IndeterminateEntityId is effective at flagging up all the places that need to be changed to accommodate pseudo-entity IDs.

As the EntitySchemas project is in a short hiatus, I am removing the relevant tickets from the board

We ended up deciding against this approach; instead, we’re working together with Wikibase Product Platform Team WPP to make the data value deserialization dependent on the data type, so that the values can have "type": "wikibase-entityid" in JSON but deserialize to a DataValue that is not an EntityIdValue. Some further investigation happened in T355144 and T360601.