Page MenuHomePhabricator

Don't submit authentication requests prior to autocomplete search requests
Closed, ResolvedPublic

Description

All autocomplete requests are proceded by token & centralauth requests.
Not authentication is needed for the autocomplete search requests, so we shouldn't be sending those requests.

Acceptance criteria:

  • Every keystroke in the autocomplete field makes at most 1 API request (the actual search)

Event Timeline

Change 650140 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[wikibase/javascript-api@master] Let getLocationAgnosticMwApi accept API options

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

Change 650145 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/extensions/WikibaseMediaInfo@master] Don't submit token requests for requests that don't need auth

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

Moving this to "Verify on Production" since the code has been reviewed for the patch in MediaInfo, but it won't merge until an underlying Wikibase patch also gets merged.

Change 650140 merged by jenkins-bot:
[wikibase/javascript-api@master] Let getLocationAgnosticMwApi accept API options

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

@egardner - https://gerrit.wikimedia.org/r/650145 need some additional action to be Merged? I see that you +2ed it, but the patch has 'Ready to submit' and 'Merge if Necessary' status.

Looks like this depended on a Wikibase patch that was merged at a later time. I’m rebasing and will submit once the tests pass.

Change 650145 merged by Eric Gardner:
[mediawiki/extensions/WikibaseMediaInfo@master] Don't submit token requests for requests that don't need auth

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

Tested on commons wmf.32
@egardner, @Matthias - please confirm that the following is the expected behavior.

On commons wmf.32 typing one letter in the search box on Special:MediaSearch will sent three api requests, e.g. in the screenshots below there are three requests for typing tand three requests for typing y. And on of those three requests will be centralauthtoken.

Screen Shot 2021-02-24 at 4.26.34 PM.png (640×1 px, 256 KB)

Yeah, that's not the expected behavior.
This ticket required a change in 2 places.
The other part is T274252, in the wikibase/javascript-api repo, which follows a different rollout schedule.
I've inquired about when (if any) upcoming release is scheduled here: T274252#6859705

Update: in T274252, we copied the relevant code from said wikibase repo into the mediasearch extension. Once the mediasearch extension gets into production (a few weeks from now), this should be resolved.

Yes! Tested and confirmed working.