Page MenuHomePhabricator

Handling failed requests to the federation source Wiki when loading an entity page
Closed, ResolvedPublic8 Estimated Story Points

Description

Currently, any failed request to the source Wiki will result in the target Wikibase entering an error state. This behavior is the case even in non-critical situations such as displaying property labels on the item page.

If displaying federated properties is not possible when loading the entity page due to a failed call to the source Wiki, we should display a partial version of the entity page and an error message explaining the situation to the user: "Statements about this item are temporarily unavailable due to a failed request to the federation source Wiki. Please refresh the page."

We've decided the entity ID and label in the current language should be displayed, in addition to the error message (just an error page, avoids page rendering complexity).

BDD
Given My connection to the source Wiki is unavailable
When I load an item page containing statements with federated properties
Then An error page is displayed containing the item ID, label in the current language, and an error message

Note: this needs to be made testable in the test system for product verification to take place

Event Timeline

Samantha_Alipio_WMDE renamed this task from Handling failed requests when loading the entity page to Handling failed requests to the federation source Wiki when loading an entity page.Jun 9 2020, 3:39 PM

Current behaviour when rendering an item when the connection is broken.

image.png (567×1 px, 169 KB)

[16c208ff25db0a43d0aa600b] /wiki/Item:Q2 Wikibase\Repo\FederatedProperties\ApiRequestExecutionException from line 48 of /var/www/html/extensions/Wikibase/repo/includes/FederatedProperties/GenericActionApiClient.php:

Backtrace:

#0 /var/www/html/extensions/Wikibase/repo/includes/FederatedProperties/ApiEntityLookup.php(65): Wikibase\Repo\FederatedProperties\GenericActionApiClient->get(array)
#1 /var/www/html/extensions/Wikibase/repo/includes/FederatedProperties/ApiEntityLookup.php(36): Wikibase\Repo\FederatedProperties\ApiEntityLookup->getEntities(array)
#2 /var/www/html/extensions/Wikibase/repo/includes/FederatedProperties/ApiEntityLookup.php(80): Wikibase\Repo\FederatedProperties\ApiEntityLookup->fetchEntities(array)
#3 /var/www/html/extensions/Wikibase/repo/includes/FederatedProperties/ApiPropertyDataTypeLookup.php(31): Wikibase\Repo\FederatedProperties\ApiEntityLookup->getResultPartForId(Wikibase\DataModel\Entity\PropertyId)
#4 /var/www/html/vendor/wikibase/data-model-services/src/Lookup/InProcessCachingDataTypeLookup.php(38): Wikibase\Repo\FederatedProperties\ApiPropertyDataTypeLookup->getDataTypeIdForProperty(Wikibase\DataModel\Entity\PropertyId)
#5 /var/www/html/vendor/wikibase/data-model-services/src/Entity/PropertyDataTypeMatcher.php(51): Wikibase\DataModel\Services\Lookup\InProcessCachingDataTypeLookup->getDataTypeIdForProperty(Wikibase\DataModel\Entity\PropertyId)
#6 /var/www/html/vendor/wikibase/data-model-services/src/Entity/PropertyDataTypeMatcher.php(38): Wikibase\DataModel\Services\Entity\PropertyDataTypeMatcher->findDataTypeIdForProperty(Wikibase\DataModel\Entity\PropertyId)
#7 /var/www/html/extensions/Wikibase/repo/includes/ParserOutput/ExternalLinksDataUpdater.php(54): Wikibase\DataModel\Services\Entity\PropertyDataTypeMatcher->isMatchingDataType(Wikibase\DataModel\Entity\PropertyId, string)
#8 /var/www/html/extensions/Wikibase/repo/includes/ParserOutput/ExternalLinksDataUpdater.php(44): Wikibase\Repo\ParserOutput\ExternalLinksDataUpdater->processSnak(Wikibase\DataModel\Snak\PropertyValueSnak)
#9 /var/www/html/extensions/Wikibase/repo/includes/ParserOutput/CompositeStatementDataUpdater.php(26): Wikibase\Repo\ParserOutput\ExternalLinksDataUpdater->processStatement(Wikibase\DataModel\Statement\Statement)
#10 /var/www/html/extensions/Wikibase/repo/includes/ParserOutput/ItemParserOutputUpdater.php(28): Wikibase\Repo\ParserOutput\CompositeStatementDataUpdater->processStatement(Wikibase\DataModel\Statement\Statement)
#11 /var/www/html/extensions/Wikibase/repo/includes/ParserOutput/ItemParserOutputUpdater.php(22): Wikibase\Repo\ParserOutput\ItemParserOutputUpdater->updateParserOutputForItem(ParserOutput, Wikibase\DataModel\Entity\Item)
#12 /var/www/html/extensions/Wikibase/repo/includes/ParserOutput/EntityParserOutputDataUpdaterCollection.php(44): Wikibase\Repo\ParserOutput\ItemParserOutputUpdater->updateParserOutput(ParserOutput, Wikibase\DataModel\Entity\Item)
#13 /var/www/html/extensions/Wikibase/repo/includes/ParserOutput/FullEntityParserOutputGenerator.php(148): Wikibase\Repo\ParserOutput\EntityParserOutputDataUpdaterCollection->updateParserOutput(Wikibase\DataModel\Entity\Item)
#14 /var/www/html/extensions/Wikibase/repo/includes/ParserOutput/StatsdTimeRecordingEntityParserOutputGenerator.php(48): Wikibase\Repo\ParserOutput\FullEntityParserOutputGenerator->getParserOutput(Wikibase\Lib\Store\EntityRevision, boolean)
#15 /var/www/html/extensions/Wikibase/repo/includes/Content/EntityContent.php(238): Wikibase\Repo\ParserOutput\StatsdTimeRecordingEntityParserOutputGenerator->getParserOutput(Wikibase\Lib\Store\EntityRevision, boolean)
#16 /var/www/html/extensions/Wikibase/repo/includes/Content/ItemContent.php(232): Wikibase\Repo\Content\EntityContent->getParserOutputFromEntityView(integer, ParserOptions, boolean)
#17 /var/www/html/extensions/Wikibase/repo/includes/Content/EntityContent.php(177): Wikibase\Repo\Content\ItemContent->getParserOutputFromEntityView(integer, ParserOptions, boolean)
#18 /var/www/html/includes/Revision/RenderedRevision.php(266): Wikibase\Repo\Content\EntityContent->getParserOutput(Title, integer, ParserOptions, boolean)
#19 /var/www/html/includes/Revision/RenderedRevision.php(235): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached(Wikibase\Repo\Content\ItemContent, boolean)
#20 /var/www/html/includes/Revision/RevisionRenderer.php(215): MediaWiki\Revision\RenderedRevision->getSlotParserOutput(string)
#21 /var/www/html/includes/Revision/RevisionRenderer.php(152): MediaWiki\Revision\RevisionRenderer->combineSlotOutput(MediaWiki\Revision\RenderedRevision, array)
#22 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}(MediaWiki\Revision\RenderedRevision, array)
#23 /var/www/html/includes/Revision/RenderedRevision.php(197): call_user_func(Closure, MediaWiki\Revision\RenderedRevision, array)
#24 /var/www/html/includes/poolcounter/PoolWorkArticleView.php(216): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#25 /var/www/html/includes/poolcounter/PoolCounterWork.php(162): PoolWorkArticleView->doWork()
#26 /var/www/html/includes/page/Article.php(806): PoolCounterWork->execute()
#27 /var/www/html/extensions/Wikibase/repo/includes/Actions/ViewEntityAction.php(79): Article->view()
#28 /var/www/html/extensions/Wikibase/repo/includes/Actions/ViewEntityAction.php(54): Wikibase\Repo\Actions\ViewEntityAction->showEntityPage()
#29 /var/www/html/includes/MediaWiki.php(527): Wikibase\Repo\Actions\ViewEntityAction->show()
#30 /var/www/html/includes/MediaWiki.php(313): MediaWiki->performAction(Article, Title)
#31 /var/www/html/includes/MediaWiki.php(986): MediaWiki->performRequest()
#32 /var/www/html/includes/MediaWiki.php(543): MediaWiki->main()
#33 /var/www/html/index.php(47): MediaWiki->run()
#34 {main}

The right place to catch the exception in this case might be in FullEntityParserOutputGenerator::getParserOutput (the exception will likely be the one from T255008)
Again catching the ApiRequestExecutionException from the fed props API client
Adding code such as:

		throw new ErrorPageError( 'some Title', 'foo' );

image.png (324×628 px, 45 KB)

Correctly shows an error page rather than the evil exception.

We would be able to get the label and ID for including using something like:

		if( $entity instanceof FingerprintProvider ) {
			$labelForErrorMessage = $entity->getFingerprint()->getLabel( $this->languageCode );
		}

Simple using an ErrorPageError doesn't appear to make the page follow the standard MediaWiki error page style, and perhaps either:

  • We need to look at some other error pages such as MWException and other things that extend ErrorPageError and see where the style comes from and match that
  • Have another style/look designed by UX or product.

We decided to do this all as 1 task

Change 604687 had a related patch set uploaded (by Tobias Andersson; owner: Tobias Andersson):
[mediawiki/extensions/Wikibase@master] FP: Handle api error on entity page

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