Page MenuHomePhabricator

View an item containing a statement using a local property when federation is enabled
Closed, ResolvedPublic8 Estimated Story Points

Description

As a Wikibase reader in a wiki with Federated Properties v2 enabled, I want to be able to view statements on my local entities that were made with local properties.

Currently, when a statement is added containing a local property, it is saved but cannot be re-rendered.

image.png (362×1 px, 76 KB)

BDD Scenario: On an item page in a Wikibase with Federated Properties enabled
GIVEN I have added a statement to a local item using a local property
WHEN I load the item page
THEN The page is rendered successfully
AND I can view the statements made on the item

Note:
It is surprising that this very core feature of Wikibase, saving statements using local properties on local entities, is broken and did not result in any tests failing. Therefore, there is likely some additional testing complexity involved in making sure that this does not happen again.

Note: this issue would theoretically apply to any "entity" but in this story we are focused on item pages only.

Event Timeline

As far as I know saving currently works fine:
e.g. from the test system:

{"entities":{"Q2":{"pageid":5,"ns":120,"title":"Item:Q2","lastrevid":7,"modified":"2021-08-11T08:10:30Z","type":"item","id":"Q2","labels":{"en":{"language":"en","value":"foo cat"}},"descriptions":{},"aliases":{},"claims":{"P1":[{"mainsnak":{"snaktype":"value","property":"P1","hash":"874d19e6a8080831f530365565a57dc9dd3ba463","datavalue":{"value":"cat","type":"string"},"datatype":"string"},"type":"statement","id":"Q2$158446eb-4a66-c356-6a79-3cd1e66bf622","rank":"normal"}]},"sitelinks":{}}}}

however right now these pages cannot subsequently be rerendered.

We might also want to write some test cases to ensure that this functionality continues.

Samantha_Alipio_WMDE renamed this task from Save a statement with a local property when federation is enabled to View a saved statement containing a local property when federation is enabled.Aug 11 2021, 8:27 AM
Samantha_Alipio_WMDE updated the task description. (Show Details)
Tarrow renamed this task from View a saved statement containing a local property when federation is enabled to View an entity containing a statement using a local property when federation is enabled.Aug 11 2021, 8:36 AM
Samantha_Alipio_WMDE renamed this task from View an entity containing a statement using a local property when federation is enabled to View an item containing a statement using a local property when federation is enabled.Aug 18 2021, 9:55 AM
Samantha_Alipio_WMDE updated the task description. (Show Details)

Task breakdown notes:

  • Start at extensions/Wikibase/repo/includes/FederatedProperties/FederatedPropertiesEntityParserOutputGenerator.php
  • Consider if we should introduce a new method to build a list of just FederatedPropertyIDs and only prefetch those
    • We could build this by iterating over the PropertyIds and passing them to a EntitySourceLookup and then checking the source type (or have a method in URIPropertyId and NumericPropertyId that returns the type of source)
  • Write a test to ensure an error like this doesn't happen again
  • Alternatively we might want to consider if we want to have a separate FederatedPropertiesEntityParserOutputGenerator and instead put the logic in some part of the FullEntityParserOutputGenerator

Just solving this might not be sufficient to make this work.

Change 714019 had a related patch set uploaded (by Tonina Zhelyazkova; author: Tonina Zhelyazkova):

[mediawiki/extensions/Wikibase@master] FP: Prefetch only federated properties in FederatedPropertiesEntityParserOutputGenerator

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

Change 714019 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] FP: Prefetch only federated properties in FederatedPropertiesEntityParserOutputGenerator

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

To verify take a look at https://wikidata-federated-properties.wmflabs.org/wiki/Item:Q3 which contains a statement with a local property. The page renders normally and no error is shown like the one in the task description.

T289667 fell out of the solution for this