Page MenuHomePhabricator

Handling failed requests to the federation source Wiki when saving statements
Closed, ResolvedPublic5 Estimated Story Points

Description

Currently, any failed request to the source Wiki will result in the target Wikibase entering an error state. One situation that needs to be handled is when saving an edit is attempted and fails because accessing the source wiki is impossible.

If looking up the property data type fails while adding/editing a statement, then we should display an error message when save is selected: "Your save failed due to a failed request to the federation source Wiki.."

BDD
Given I am adding or editing a statement with federated properties enabled
And the lookup of the property data type fails due to a failed call to the source Wiki
When I select save
Then an error message is displayed that indicates my save failed due to failed call to source Wiki

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

Event Timeline

Samantha_Alipio_WMDE set the point value for this task to 5.
Samantha_Alipio_WMDE updated the task description. (Show Details)
Samantha_Alipio_WMDE renamed this task from Handling failed requests when editing to Handling failed requests to the federation source Wiki when editing statements.Jun 9 2020, 3:38 PM

TODO we need to know exactly what message to display, perhaps something like "Save failed due to failed call to federated wiki"

Example exception that currently happens and bubbles up to the user.

Wikibase\\Repo\\FederatedProperties\\ApiRequestExecutionException at /var/www/html/extensions/Wikibase/repo/includes/FederatedProperties/GenericActionApiClient.php(48)
#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/extensions/Wikibase/repo/includes/Validators/SnakValidator.php(153): Wikibase\\Repo\\FederatedProperties\\ApiPropertyDataTypeLookup->getDataTypeIdForProperty(Wikibase\\DataModel\\Entity\\PropertyId)
#5 /var/www/html/extensions/Wikibase/repo/includes/Validators/SnakValidator.php(65): Wikibase\\Repo\\Validators\\SnakValidator->validate(Wikibase\\DataModel\\Snak\\PropertyValueSnak)
#6 /var/www/html/extensions/Wikibase/repo/includes/ChangeOp/ChangeOpStatement.php(228): Wikibase\\Repo\\Validators\\SnakValidator->validateClaimSnaks(Wikibase\\DataModel\\Statement\\Statement)
#7 /var/www/html/extensions/Wikibase/repo/includes/Api/StatementModificationHelper.php(174): Wikibase\\Repo\\ChangeOp\\ChangeOpStatement->validate(Wikibase\\DataModel\\Entity\\Item)
#8 /var/www/html/extensions/Wikibase/repo/includes/Api/SetClaim.php(141): Wikibase\\Repo\\Api\\StatementModificationHelper->applyChangeOp(Wikibase\\Repo\\ChangeOp\\ChangeOpStatement, Wikibase\\DataModel\\Entity\\Item, Wikibase\\Lib\\Summary)
#9 /var/www/html/includes/api/ApiMain.php(1585): Wikibase\\Repo\\Api\\SetClaim->execute()
#10 /var/www/html/includes/api/ApiMain.php(525): ApiMain->executeAction()
#11 /var/www/html/includes/api/ApiMain.php(496): ApiMain->executeActionWithErrorHandling()
#12 /var/www/html/api.php(84): ApiMain->execute()
#13 {main}"

Individual tasks:

  • Catch the ApiRequestExecutionException in SetClaim and throw a regular ApiUsageException so that the UI will display a nice error message.

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

During task breakdown we switched the hosts file on the test system to create a fake error, and that worked fairly well.
We could do a similar thing for validation of this story for @Samantha_Alipio_WMDE once merged.

Samantha_Alipio_WMDE renamed this task from Handling failed requests to the federation source Wiki when editing statements to Handling failed requests to the federation source Wiki when saving statements.Jun 17 2020, 2:07 PM
Samantha_Alipio_WMDE updated the task description. (Show Details)