Interwiki order recently changed
Closed, ResolvedPublic

Description

Tostarpadius and Paracel63 at svwiki report that the order in which interwiki links appear has recently changed (https://sv.wikipedia.org/wiki/Wikipedia:Bybrunnen#Interwikin_igen) and I can confirm what they say.

It's not on all articles, and a purge fixes the order. For example, the order in https://sv.wikipedia.org/wiki/Benfiskar was previously what Paracel63 posted (https://sv.wikipedia.org/w/index.php?diff=39370148), starting with 中文, Polski and Euskara. After my purge, the order is correct, starting with Afrikaans, Alemannisch and so on.

Nirmos created this task.Mar 14 2017, 8:43 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 14 2017, 8:43 PM
Lydia_Pintscher triaged this task as "Unbreak Now!" priority.Mar 14 2017, 9:29 PM

Bah. Sorry @Nirmos. Thank you for the report. It shouldn't have changed. We'll look into it.

Restricted Application added subscribers: Jay8g, TerraCodes. · View Herald TranscriptMar 14 2017, 9:29 PM
Mathglot added a subscriber: Mathglot.EditedMar 14 2017, 10:34 PM

(sorry for slight O/T, this is my first Phab comment after just registering):
@Lydia_Pintscher
Hi, Lydia! That was me who reported it at en:Village pump, where Nirmos picked it up. We just met at WikiSalon BayArea where I helped catalyze your mini-talk, didn't think we'd be crossing paths so soon again, and here of all places, but schön dich noch ein mal zu »sehen« ! --Peter

So, it looks like the sort order is now correct (without us doing anything).
Subsequent purges also leave the list in the correct order, so I'm not sure there is anything actionable in terms of on wiki sort orders.

Looking at the deployment again there should not have been a gap between the Wikibase sorting switching off and in the InterwikiSorting sorting switching on.
If for some reason there was then the parser cache could easily cache an unsorted list.

Ok so we assume it is fine and there is just an intermittently cashed problematic version that will go away with the next manual or automatic purge?

@Mathglot It's a small world! ;-)

Ok so we assume it is fine and there is just an intermittently cashed problematic version that will go away with the next manual or automatic purge?

Yes, unless we get more reports.

Lydia_Pintscher lowered the priority of this task from "Unbreak Now!" to "High".Mar 15 2017, 10:48 AM

Ok thanks. Lowering priority. I'll keep it open for a few more days and then we'll close it.

Change 342853 had a related patch set uploaded (by Addshore):
[operations/mediawiki-config] wmgUseInterwikiSorting false everywhere

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

I believe the interwikisorting code is not being loaded hen requests are made to api.php
Thus if something gets cached during one of these requests the wrong sort order will be cached.
Switching back to the sorting in the Wikibase codebase before doing a bit more further investigation & patching.

Addshore claimed this task.Mar 15 2017, 4:45 PM
Addshore added a project: User-Addshore.
Addshore moved this task from Backlog to In Progress on the User-Addshore board.
Addshore added a project: Regression.

Change 342853 merged by jenkins-bot:
[operations/mediawiki-config] wmgUseInterwikiSorting false everywhere

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

Addshore added a comment.EditedMar 15 2017, 6:21 PM

So, I have managed to confirm that when using api.php the interwiki sorting does not happen.
Currently visible @ https://de.wikipedia.beta.wmflabs.org/wiki/Spezial:ApiSandbox#action=parse&format=json&page=Benutzer%3AAddshore%2Fsandbox&prop=text%7Clanglinks%7Ccategories%7Clinks%7Ctemplates%7Cimages%7Cexternallinks%7Csections%7Crevid%7Cdisplaytitle%7Ciwlinks%7Cproperties & https://de.wikipedia.beta.wmflabs.org/wiki/Spezial:ApiSandbox#action=parse&format=json&text=%5B%5Ben%3AFoo%5D%5D%0A%5B%5Baa%3AFoo%5D%5D%0A%5B%5Bzh%3AFoo%5D%5D&prop=text%7Clanglinks%7Ccategories%7Clinks%7Ctemplates%7Cimages%7Cexternallinks%7Csections%7Crevid%7Cdisplaytitle%7Ciwlinks%7Cproperties

This has been caused by one of the few changed to the code when being extracted from Wikibase.
In order to make sure the InterwikiSorting hook is the last hook registered (as other hooks my add / fiddle with interwiki links) the hook is registered in the BeforeInitialize hook.
The BeforeInitialize hook is not run for entry through api.php (and possible maintenance scripts)

It would make sense that something in the api or the jobqueue (which uses maint scripts) was thus causing the issues, although hard to be 100% sure of this currently.

Change 342911 had a related patch set uploaded (by Addshore):
[mediawiki/extensions/InterwikiSorting] Use ExtensionFunctions instead of BeforeInitialize hook

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

Change 342911 merged by jenkins-bot:
[mediawiki/extensions/InterwikiSorting] Use ExtensionFunctions instead of BeforeInitialize hook

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

Addshore moved this task from Review to Done on the WMDE-QWERTY-Team-Board board.Mar 16 2017, 11:19 AM

Change 343031 had a related patch set uploaded (by Addshore):
[mediawiki/extensions/InterwikiSorting] Use ExtensionFunctions instead of BeforeInitialize hook

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

Change 343032 had a related patch set uploaded (by Addshore):
[mediawiki/extensions/InterwikiSorting] Use ExtensionFunctions instead of BeforeInitialize hook

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

Change 343033 had a related patch set uploaded (by Addshore):
[operations/mediawiki-config] wmgUseInterwikiSorting true for wikidataclients

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

Change 343031 merged by jenkins-bot:
[mediawiki/extensions/InterwikiSorting] Use ExtensionFunctions instead of BeforeInitialize hook

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

Change 343032 merged by jenkins-bot:
[mediawiki/extensions/InterwikiSorting] Use ExtensionFunctions instead of BeforeInitialize hook

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

Mentioned in SAL (#wikimedia-operations) [2017-03-16T12:17:47Z] <addshore@tin> Synchronized php-1.29.0-wmf.15/extensions/InterwikiSorting: [[gerrit:343031|Use ExtensionFunctions instead of BeforeInitialize hook]] T160465 (duration: 00m 43s)

Mentioned in SAL (#wikimedia-operations) [2017-03-16T12:31:29Z] <addshore@tin> Synchronized php-1.29.0-wmf.16/extensions/InterwikiSorting: [[gerrit:343032|Use ExtensionFunctions instead of BeforeInitialize hook]] T160465 (duration: 00m 43s)

Mentioned in SAL (#wikimedia-operations) [2017-03-16T12:38:27Z] <addshore@tin> Synchronized php-1.29.0-wmf.16/extensions/InterwikiSorting: [[gerrit:343032|Use ExtensionFunctions instead of BeforeInitialize hook]] T160465 (duration: 00m 44s)

Change 343033 merged by jenkins-bot:
[operations/mediawiki-config] wmgUseInterwikiSorting true for wikidataclients

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

Mentioned in SAL (#wikimedia-operations) [2017-03-16T12:49:04Z] <addshore@tin> Synchronized wmf-config/InitialiseSettings.php: [[gerrit:343033|wmgUseInterwikiSorting true for wikidataclients]] T160465 T150183 (duration: 00m 42s)

Addshore closed this task as "Resolved".Mar 16 2017, 12:50 PM

Marking as resolved as per the above diagnosis this should now be fixed.
If we / anyone sees anything else like this occurring please reopen.

Johan moved this task from To Triage to In current Tech/News draft on the User-notice board.