Page MenuHomePhabricator

Wikimedia\Assert\PreconditionException: Expected MediaWiki\User\UserIdentityValue to belong to the local wiki, but it belongs to 'wikidatawiki'
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
message
[ed07cfa5-cd66-4dbd-a1ae-0b48c1b3fbb7] /w/index.php?title=Special:Investigate/Account_information&token=yyy   Wikimedia\Assert\PreconditionException: Expected MediaWiki\User\UserIdentityValue to belong to the local wiki, but it belongs to 'wikidatawiki'
trace
from /srv/mediawiki/php-1.41.0-wmf.22/includes/dao/WikiAwareEntityTrait.php(59)
#0 /srv/mediawiki/php-1.41.0-wmf.22/includes/user/UserGroupManager.php(718): MediaWiki\User\UserIdentityValue->assertWiki(boolean)
#1 /srv/mediawiki/php-1.41.0-wmf.22/includes/user/UserGroupManager.php(703): MediaWiki\User\UserGroupManager->getUserGroupMemberships(MediaWiki\User\UserIdentityValue, integer)
#2 /srv/mediawiki/php-1.41.0-wmf.22/extensions/CheckUser/src/Investigate/Services/PreliminaryCheckService.php(179): MediaWiki\User\UserGroupManager->getUserGroups(MediaWiki\User\UserIdentityValue)
#3 /srv/mediawiki/php-1.41.0-wmf.22/extensions/CheckUser/src/Investigate/Services/PreliminaryCheckService.php(133): MediaWiki\CheckUser\Investigate\Services\PreliminaryCheckService->getAdditionalLocalData(stdClass, string)
#4 /srv/mediawiki/php-1.41.0-wmf.22/extensions/CheckUser/src/Investigate/Pagers/PreliminaryCheckPager.php(258): MediaWiki\CheckUser\Investigate\Services\PreliminaryCheckService->preprocessResults(Wikimedia\Rdbms\MysqliResultWrapper)
#5 /srv/mediawiki/php-1.41.0-wmf.22/includes/pager/IndexPager.php(291): MediaWiki\CheckUser\Investigate\Pagers\PreliminaryCheckPager->preprocessResults(Wikimedia\Rdbms\MysqliResultWrapper)
#6 /srv/mediawiki/php-1.41.0-wmf.22/includes/pager/IndexPager.php(733): IndexPager->doQuery()
#7 /srv/mediawiki/php-1.41.0-wmf.22/extensions/CheckUser/src/Investigate/SpecialInvestigate.php(342): IndexPager->getNumRows()
#8 /srv/mediawiki/php-1.41.0-wmf.22/extensions/CheckUser/src/Investigate/SpecialInvestigate.php(205): MediaWiki\CheckUser\Investigate\SpecialInvestigate->addTabContent(string)
#9 /srv/mediawiki/php-1.41.0-wmf.22/includes/specialpage/SpecialPage.php(701): MediaWiki\CheckUser\Investigate\SpecialInvestigate->execute(string)
#10 /srv/mediawiki/php-1.41.0-wmf.22/includes/specialpage/SpecialPageFactory.php(1565): SpecialPage->run(string)
#11 /srv/mediawiki/php-1.41.0-wmf.22/includes/MediaWiki.php(344): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
#12 /srv/mediawiki/php-1.41.0-wmf.22/includes/MediaWiki.php(942): MediaWiki->performRequest()
#13 /srv/mediawiki/php-1.41.0-wmf.22/includes/MediaWiki.php(591): MediaWiki->main()
#14 /srv/mediawiki/php-1.41.0-wmf.22/index.php(50): MediaWiki->run()
#15 /srv/mediawiki/php-1.41.0-wmf.22/index.php(46): wfIndexMain()
#16 /srv/mediawiki/w/index.php(3): require(string)
#17 {main}
Impact
Notes

Event Timeline

Re-producable on enwiki. Seems to be a reincarnation of T342655.

This isn't a train blocker, as I can re-produce it on a group2 wiki but otherwise breaks Special:Investigate.

This is the second time this has broken in a few weeks. Ideally some tests should be written.

Caused by WikiAwareEntity::LOCAL not being the same as the DB name of the local wiki. Will make a patch.

The tests do not catch this as they mock the UserGroupManager service. This means the parameters provided to getUserGroups are never validated to provide the expected groups without exception. To avoid re-writing the tests in a patch that would be backported, I will leave the tests as they are.

Change 949622 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/CheckUser@master] Use UserIdentity::LOCAL in PreliminaryCheckService when appropriate

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

Change 949573 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/CheckUser@wmf/1.41.0-wmf.22] Use UserIdentity::LOCAL in PreliminaryCheckService when appropriate

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

Change 949574 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/CheckUser@wmf/1.41.0-wmf.20] Use UserIdentity::LOCAL in PreliminaryCheckService when appropriate

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

Change 949622 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Use UserIdentity::LOCAL in PreliminaryCheckService when appropriate

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

Change 949574 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@wmf/1.41.0-wmf.20] Use UserIdentity::LOCAL in PreliminaryCheckService when appropriate

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

Change 949573 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@wmf/1.41.0-wmf.22] Use UserIdentity::LOCAL in PreliminaryCheckService when appropriate

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

Mentioned in SAL (#wikimedia-operations) [2023-08-17T07:33:00Z] <taavi@deploy1002> Started scap: Backport for [[gerrit:949573|Use UserIdentity::LOCAL in PreliminaryCheckService when appropriate (T344403)]], [[gerrit:949574|Use UserIdentity::LOCAL in PreliminaryCheckService when appropriate (T344403)]]

Mentioned in SAL (#wikimedia-operations) [2023-08-17T07:34:43Z] <taavi@deploy1002> dreamyjazz and taavi: Backport for [[gerrit:949573|Use UserIdentity::LOCAL in PreliminaryCheckService when appropriate (T344403)]], [[gerrit:949574|Use UserIdentity::LOCAL in PreliminaryCheckService when appropriate (T344403)]] synced to the testservers mwdebug2001.codfw.wmnet, mwdebug1001.eqiad.wmnet, mwdebug1002.eqiad.wmnet, mwdebug2002.codfw.wmnet, and mw-debug kubernetes deployment (accessible vi

Dreamy_Jazz claimed this task.

Fixed on production via a backport.

Mentioned in SAL (#wikimedia-operations) [2023-08-17T07:44:26Z] <taavi@deploy1002> Finished scap: Backport for [[gerrit:949573|Use UserIdentity::LOCAL in PreliminaryCheckService when appropriate (T344403)]], [[gerrit:949574|Use UserIdentity::LOCAL in PreliminaryCheckService when appropriate (T344403)]] (duration: 11m 25s)