Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Page MenuHomePhabricator

WikibaseQualityConstraints suggestions feature can show suggestions out-of-order
Closed, ResolvedPublic

Description

As a Wikidata editor I want to see the suggestions on the sex or gender property in the order in which the community defined them, in order to see the most common values first.

Problem:
P21 currently has more than 50 suggested values in its one-of constraint, which means that WikibaseQualityConstraints’ suggestions module (modules/suggestions/EntitySelectorHookHandlerFactory.js) has to make more than one API request to get all the labels and descriptions for the values. Currently, it makes those requests in parallel, then appends the results to the suggestions in whichever order the API requests resolve; since the second request has fewer items in it, it often resolves first and those last few items are therefore shown at the top of the suggestion list. We should fix this to make sure the list is in the right order, either by making sure the parallelized results are concatenated order, or by not parallelizing the requests at all (which would also be more in line with the API etiquette).

Example/Screenshots/mockups:

image.png (535×1 px, 109 KB)

BDD
GIVEN I am on an item page
WHEN I add a new “sex or gender” statement
THEN the suggestions are in the right order

Acceptance criteria:

  • WikibaseQualityConstraints doesn’t reorder the results.

Event Timeline

Change 992467 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/WikibaseQualityConstraints@master] Make suggestions API requests sequentially

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

Putting this up for review directly because I confirmed by hypothesis about the problem was correct by implementing a fix for what I thought the problem was, so I might as well put that up directly.

Thank you for investigating, that might explain why https://www.wikidata.org/wiki/Property:P39 showed wrongly ordered qualifiers on initial load as well.

Probably, yeah. And the reason that non-initial load (e.g. clicking elsewhere and then in the input again) doesn’t have the issue is that we cache the API responses, so once the network timing is eliminated, the (cached) results are put together in the right order again.

(which would also be more in line with the API etiquette).

While the etiquette doesn’t state this (nor the contrary), I think we should be strict about the request limit only in non-interactive scenarios – yes, many concurrent requests put strain on the API, but on the other hand sequential requests worsen the user experience.

Change 992467 merged by jenkins-bot:

[mediawiki/extensions/WikibaseQualityConstraints@master] Make suggestions API requests sequentially

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

Can confirm this is fixed, the loading delay is okayish.

Arian_Bozorg claimed this task.
Arian_Bozorg subscribed.

Looks good to me! Thanks so much :)