Page MenuHomePhabricator

Add testing for Special:UserRights's interwiki mode
Open, Needs TriagePublic

Description

Split from T342747: Special:UserRights in interwiki mode: Wikimedia\Assert\PreconditionException: Expected MediaWiki\User\UserIdentityValue to belong to the local wiki, but it belongs to 'metawiki'.

Special:UserRights has an interwiki mode, in which it allows users to change rights on a different wiki than they access the wiki on. This is a critical workflow in Wikimedia environemnt, as it is used by Stewards to self-promote themselves to other roles in case a quick response from them is needed.

Unfortunately, this functionality of Special:UserRights was broken two weeks in a row (T342747, T342322). This definitely signals we should test this functionality in CI, to decrease the chance of similar breakages happening in the future. Quoting related comments from T342747:

We apparently need better tests for interwiki Special:Userrights, as this is the second week in a row in which this feature of Special:Userrights caused a train blocker.

Interwiki Userrights means CentralAuth [...]

Not necessarily. AFAIK we only need to have two MediaWiki databases provisioned while CI runs our (integration) tests and the following three lines in LocalSettings.php:

$wgGroupPermissions['bureaucrat']['userrights-interwiki'] = true;
$wgLocalDatabases = ['awiki', 'bwiki'];
$wgConf->wikis = $wgLocalDatabases;

This should be sufficient to enable the interwiki functionality of Special:Userrights (this works locally in MediaWiki-Docker, w/o CentralAuth installed). From there, it should be fairly trivial to test it (at least sufficiently enough to avoid "it throws a fatal" kind of errors).

I haven't examined closely how CI works in our setup, but plugging in a database clonning sequence after install.php runs seems fairly trivial. We should probably ensure the second database resets itself in a similar way like the main test database does (which is definitely less trivial), but we shouldn't need to plug CentralAuth in.

Event Timeline

hashar subscribed.

Moving task out of Continuous-Integration-Config (which is for the Jenkins/Zuul configs) in favor of MediaWiki-Core-Tests since Special:UserRights is part of MediaWiki core :)

Moving task out of Continuous-Integration-Config (which is for the Jenkins/Zuul configs) in favor of MediaWiki-Core-Tests since Special:UserRights is part of MediaWiki core :)

Thanks, but I think we would need some Jenkins changes to make introducing those tests possible (namely, figure a way how to have two installed MediaWiki databases). Or is that possible from the core end of things, without touching CI config?

Change 949986 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[integration/quibble@master] Provide a secondary database

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

I didn't manage to run Quibble locally (README advises to docker build --tag quibble ., but there is no Dockerfile in the repository since https://gerrit.wikimedia.org/r/c/integration/quibble/+/757888's by @kostajh), so the patch above is untested. But, hopefully the idea of clonning a fully provisioned database is clear from the code.

Next step: Figure out how to run Quibble and test the patch.

Change 950029 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/core@master] SpecialUserRightsTest: Add basic coverage for interwiki functionality

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

Involves a Quibble change (to provision two databases per wiki). Patch uploaded, needs CR.

Change 950029 merged by jenkins-bot:

[mediawiki/core@master] SpecialUserRightsTest: Add basic coverage for interwiki functionality

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

Change 949986 abandoned by Hashar:

[integration/quibble@master] Provide a secondary database

Reason:

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

Urbanecm added a subscriber: EMill-WMF.

Special:UserRights in interwiki mode broke again in the last two trains:

Can we somehow increase the urgency of this? I believe this is mostly related to PSI efforts, given the most significant impact of the breakage is "Stewards are unable to perform time-sensitive user rights manipulation". I'm tagging the team's tag.

Also, FYI @EMill-WMF for awareness.