Page MenuHomePhabricator

MediaWiki core selenium test "Special:RecentChanges shows page creation" fails consistently when CentralAuth loaded in CI
Closed, ResolvedPublic

Description

I've seen a change in AbuseFilter ( https://integration.wikimedia.org/ci/job/quibble-vendor-mysql-php74-selenium/73133/console ) and CheckUser ( https://integration.wikimedia.org/ci/job/quibble-vendor-mysql-php74-selenium/73134/console#console-section-13 ) fail the "Special:RecentChanges shows page creation" selenium test.

18:13:19 [Chrome 90.0.4430.212 linux #0-7] » /tests/selenium/specs/recentchanges.js
18:13:19 [Chrome 90.0.4430.212 linux #0-7] Special:RecentChanges
18:13:19 [Chrome 90.0.4430.212 linux #0-7]    ✖ shows page creation
18:13:19 [Chrome 90.0.4430.212 linux #0-7]
18:13:19 [Chrome 90.0.4430.212 linux #0-7] 1 failing (8.8s)
18:13:19 [Chrome 90.0.4430.212 linux #0-7]
18:13:19 [Chrome 90.0.4430.212 linux #0-7] 1) Special:RecentChanges shows page creation
18:13:19 [Chrome 90.0.4430.212 linux #0-7] Can't call click on element with selector ".mw-rcfilters-ui-liveUpdateButtonWidget" because element wasn't found
18:13:19 [Chrome 90.0.4430.212 linux #0-7] Error: Can't call click on element with selector ".mw-rcfilters-ui-liveUpdateButtonWidget" because element wasn't found
18:13:19 [Chrome 90.0.4430.212 linux #0-7]     at async Context.<anonymous> (/workspace/src/tests/selenium/specs/recentchanges.js:41:3)

This happens when MediaWiki-extensions-CentralAuth is installed.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Daimona triaged this task as Unbreak Now! priority.Feb 24 2025, 6:21 PM
Daimona subscribed.

The png shows errors in CentralAuth that are also in mw-error.log:

2025-02-24 18:16:48 30493d2124a9 wikidb: [a52cb30fa1dc4c7c78d8d337] /index.php?hidebots=0&title=Special%3ARecentChanges   PHP Notice: Undefined property: MediaWiki\Extension\CentralAuth\User\CentralAuthUserArrayFromResult::$current
#0 /workspace/src/extensions/CentralAuth/includes/User/CentralAuthUserArrayFromResult.php(94): MWExceptionHandler::handleError(int, string, string, int, array)
#1 /workspace/src/includes/user/UserArrayFromResult.php(68): MediaWiki\Extension\CentralAuth\User\CentralAuthUserArrayFromResult->setCurrent(stdClass)
#2 /workspace/src/includes/user/UserArrayFromResult.php(37): MediaWiki\User\UserArrayFromResult->rewind()
#3 /workspace/src/extensions/CentralAuth/includes/User/CentralAuthUserArrayFromResult.php(38): MediaWiki\User\UserArrayFromResult->__construct(Wikimedia\Rdbms\MysqliResultWrapper)
#4 /workspace/src/extensions/CentralAuth/includes/CentralAuthHooks.php(390): MediaWiki\Extension\CentralAuth\User\CentralAuthUserArrayFromResult->__construct(Wikimedia\Rdbms\MysqliResultWrapper)
#5 /workspace/src/includes/HookContainer/HookContainer.php(155): MediaWiki\Extension\CentralAuth\CentralAuthHooks->onUserArrayFromResult(null, Wikimedia\Rdbms\MysqliResultWrapper)
#6 /workspace/src/includes/HookContainer/HookRunner.php(4264): MediaWiki\HookContainer\HookContainer->run(string, array)
#7 /workspace/src/includes/user/UserArray.php(46): MediaWiki\HookContainer\HookRunner->onUserArrayFromResult(null, Wikimedia\Rdbms\MysqliResultWrapper)
#8 /workspace/src/includes/user/UserArray.php(96): MediaWiki\User\UserArray::newFromResult(Wikimedia\Rdbms\MysqliResultWrapper)
#9 /workspace/src/includes/specialpage/ChangesListSpecialPage.php(721): MediaWiki\User\UserArray::newFromNames(array)
#10 /workspace/src/includes/specials/SpecialRecentChanges.php(217): MediaWiki\SpecialPage\ChangesListSpecialPage->execute(null)
#11 /workspace/src/includes/specialpage/SpecialPage.php(729): MediaWiki\Specials\SpecialRecentChanges->execute(null)
#12 /workspace/src/includes/specialpage/SpecialPageFactory.php(1737): MediaWiki\SpecialPage\SpecialPage->run(null)
#13 /workspace/src/includes/actions/ActionEntryPoint.php(503): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, MediaWiki\Context\RequestContext)
#14 /workspace/src/includes/actions/ActionEntryPoint.php(145): MediaWiki\Actions\ActionEntryPoint->performRequest()
#15 /workspace/src/includes/MediaWikiEntryPoint.php(202): MediaWiki\Actions\ActionEntryPoint->execute()
#16 /workspace/src/index.php(58): MediaWiki\MediaWikiEntryPoint->run()
#17 {main}
2025-02-24 18:16:48 30493d2124a9 wikidb: [a52cb30fa1dc4c7c78d8d337] /index.php?hidebots=0&title=Special%3ARecentChanges   TypeError: Argument 1 passed to MediaWiki\Extension\CentralAuth\User\CentralAuthUser::setInstance() must implement interface MediaWiki\User\UserIdentity, null given, called in /workspace/src/extensions/CentralAuth/includes/User/CentralAuthUserArrayFromResult.php on line 94
#0 /workspace/src/extensions/CentralAuth/includes/User/CentralAuthUserArrayFromResult.php(94): MediaWiki\Extension\CentralAuth\User\CentralAuthUser::setInstance(null, MediaWiki\Extension\CentralAuth\User\CentralAuthUser)
#1 /workspace/src/includes/user/UserArrayFromResult.php(68): MediaWiki\Extension\CentralAuth\User\CentralAuthUserArrayFromResult->setCurrent(stdClass)
#2 /workspace/src/includes/user/UserArrayFromResult.php(37): MediaWiki\User\UserArrayFromResult->rewind()
#3 /workspace/src/extensions/CentralAuth/includes/User/CentralAuthUserArrayFromResult.php(38): MediaWiki\User\UserArrayFromResult->__construct(Wikimedia\Rdbms\MysqliResultWrapper)
#4 /workspace/src/extensions/CentralAuth/includes/CentralAuthHooks.php(390): MediaWiki\Extension\CentralAuth\User\CentralAuthUserArrayFromResult->__construct(Wikimedia\Rdbms\MysqliResultWrapper)
#5 /workspace/src/includes/HookContainer/HookContainer.php(155): MediaWiki\Extension\CentralAuth\CentralAuthHooks->onUserArrayFromResult(null, Wikimedia\Rdbms\MysqliResultWrapper)
#6 /workspace/src/includes/HookContainer/HookRunner.php(4264): MediaWiki\HookContainer\HookContainer->run(string, array)
#7 /workspace/src/includes/user/UserArray.php(46): MediaWiki\HookContainer\HookRunner->onUserArrayFromResult(null, Wikimedia\Rdbms\MysqliResultWrapper)
#8 /workspace/src/includes/user/UserArray.php(96): MediaWiki\User\UserArray::newFromResult(Wikimedia\Rdbms\MysqliResultWrapper)
#9 /workspace/src/includes/specialpage/ChangesListSpecialPage.php(721): MediaWiki\User\UserArray::newFromNames(array)
#10 /workspace/src/includes/specials/SpecialRecentChanges.php(217): MediaWiki\SpecialPage\ChangesListSpecialPage->execute(null)
#11 /workspace/src/includes/specialpage/SpecialPage.php(729): MediaWiki\Specials\SpecialRecentChanges->execute(null)
#12 /workspace/src/includes/specialpage/SpecialPageFactory.php(1737): MediaWiki\SpecialPage\SpecialPage->run(null)
#13 /workspace/src/includes/actions/ActionEntryPoint.php(503): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, MediaWiki\Context\RequestContext)
#14 /workspace/src/includes/actions/ActionEntryPoint.php(145): MediaWiki\Actions\ActionEntryPoint->performRequest()
#15 /workspace/src/includes/MediaWikiEntryPoint.php(202): MediaWiki\Actions\ActionEntryPoint->execute()
#16 /workspace/src/index.php(58): MediaWiki\MediaWikiEntryPoint->run()
#17 {main}
Dreamy_Jazz renamed this task from MediaWiki core selenium test "Special:RecentChanges shows page creation" fails consistently to MediaWiki core selenium test "Special:RecentChanges shows page creation" fails consistently when CentralAuth loaded in CI.Feb 24 2025, 6:21 PM
Dreamy_Jazz lowered the priority of this task from Unbreak Now! to Needs Triage.
Dreamy_Jazz triaged this task as Unbreak Now! priority.
Dreamy_Jazz updated the task description. (Show Details)

Merge conflict in Phabricator. Undoing the UBN change

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

[mediawiki/core@master] Revert "Code cleanup in UserArray & UserArrayFromResult"

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

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

[mediawiki/extensions/CentralAuth@master] Revert "Let CentralAuthUserArrayFromResult::setCurrent accept null"

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

Created reverts which can be merged if a fix is not made.

Making the UserArrayFromResult::$current property protected (it was public, and made private in r1119051) works for me locally. Maybe if CentralAuth didn't extend a core class that isn't marked as @stable to extend...

Change #1122219 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/core@master] user: Make UserArrayFromResult::$current protected

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

https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1119051/2/includes/user/UserArrayFromResult.php made this property (and others) pirvate instead of public. I didn't notice that when reviewing (sorry), and I'm not sure if it was intentional. I think we just need to undo that.

Change #1122214 abandoned by Dreamy Jazz:

[mediawiki/core@master] Revert "Code cleanup in UserArray & UserArrayFromResult"

Reason:

No longer needed as fix made at https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1122219

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

(I guess protected is enough, and the class wasn't supposed to be a public API, so it's not a breaking change? I didn't see your comment before posting mine.)

Change #1122210 abandoned by Dreamy Jazz:

[mediawiki/extensions/CentralAuth@master] Revert "Let CentralAuthUserArrayFromResult::setCurrent accept null"

Reason:

No longer needed as fix made at https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1122219

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

(I guess protected is enough, and the class wasn't supposed to be a public API, so it's not a breaking change? I didn't see your comment before posting mine.)

Yeah, not a breaking change. CentralAuth is at fault here. I don't think it's reasonable to expect committers or reviewers to verify that changes to internal core classes don't break extensions. Here it's really unfortunate because CentralAuth is not gated and so this wasn't caught earlier.

Also, one thing for sure, when tasks like this happen I really wish phab had edit conflict detection.

(I guess protected is enough, and the class wasn't supposed to be a public API, so it's not a breaking change? I didn't see your comment before posting mine.)

Yeah, not a breaking change. CentralAuth is at fault here.

Agreed. This is even more the case given that the class is marked as internal.

For posterity and cross-linking:

because CentralAuth is not gated

Tracked in T333541.

wish phab had edit conflict detection.

Tracked in T78236, upstreamed as https://secure.phabricator.com/T4768, a solid 0% chance of happening.

Change #1122219 merged by jenkins-bot:

[mediawiki/core@master] user: Make UserArrayFromResult::$current protected

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

Daimona claimed this task.

Change #1122521 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/CentralAuth@master] Fix CentralAuthUserArrayFromResult reaching into internals

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

Change #1122522 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/core@master] Revert "user: Make UserArrayFromResult::$current protected"

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

Change #1122521 merged by jenkins-bot:

[mediawiki/extensions/CentralAuth@master] Fix CentralAuthUserArrayFromResult reaching into internals

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

Change #1122522 merged by jenkins-bot:

[mediawiki/core@master] Revert "user: Make UserArrayFromResult::$current protected"

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