Page MenuHomePhabricator

GrowthExperiments Selenium tests break with "Homepage Mentorship module: no mentor available for user ..."
Closed, ResolvedPublic

Description

Selenium calls the account creation API, HomepageHooks::onLocalUserCreated / onUserSaveOptions is invoked, which tries to set a mentor and logs an error due to no mentors being available, Selenium fails due to error logs being non-empty.

23:21:26 mw-error.log:2020-07-29 21:15:13 c754109020ca wikidb: [7723529a5eb4de2faf1d39d8] /api.php?format=json   MWException from line 114 of /workspace/src/extensions/GrowthExperiments/includes/Mentorship/Mentor.php: Homepage Mentorship module: no mentor available for user NewUser-0.9698587793119762-Iñtërnâtiônàlizætiøn
23:21:26 mw-error.log:#0 /workspace/src/extensions/GrowthExperiments/includes/Mentorship/Mentor.php(45): GrowthExperiments\Mentorship\Mentor::selectMentor(User)
23:21:26 mw-error.log:#1 /workspace/src/extensions/GrowthExperiments/includes/HomepageHooks.php(631): GrowthExperiments\Mentorship\Mentor::newFromMentee(User, boolean)
23:21:26 mw-error.log:#2 /workspace/src/includes/HookContainer/HookContainer.php(154): GrowthExperiments\HomepageHooks->onUserSaveOptions(User, array, array)
23:21:26 mw-error.log:#3 /workspace/src/includes/HookContainer/HookRunner.php(4490): MediaWiki\HookContainer\HookContainer->run(string, array)
23:21:26 mw-error.log:#4 /workspace/src/includes/user/UserOptionsManager.php(394): MediaWiki\HookContainer\HookRunner->onUserSaveOptions(User, array, array)
23:21:26 mw-error.log:#5 /workspace/src/includes/user/User.php(3443): MediaWiki\User\UserOptionsManager->saveOptions(User)
23:21:26 mw-error.log:#6 /workspace/src/includes/auth/AuthManager.php(1447): User->saveSettings()
23:21:26 mw-error.log:#7 /workspace/src/includes/auth/AuthManager.php(1163): MediaWiki\Auth\AuthManager->continueAccountCreation(array)
23:21:26 mw-error.log:#8 /workspace/src/includes/api/ApiAMCreateAccount.php(94): MediaWiki\Auth\AuthManager->beginAccountCreation(User, array, string)
23:21:26 mw-error.log:#9 /workspace/src/includes/api/ApiMain.php(1593): ApiAMCreateAccount->execute()
23:21:26 mw-error.log:#10 /workspace/src/includes/api/ApiMain.php(529): ApiMain->executeAction()
23:21:26 mw-error.log:#11 /workspace/src/includes/api/ApiMain.php(500): ApiMain->executeActionWithErrorHandling()
23:21:26 mw-error.log:#12 /workspace/src/api.php(90): ApiMain->execute()
23:21:26 mw-error.log:#13 /workspace/src/api.php(45): wfApiMain()
23:21:26 mw-error.log:#14 {main}

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 617272 had a related patch set uploaded (by Gergő Tisza; owner: Gergő Tisza):
[mediawiki/extensions/GrowthExperiments@master] Fix selenium test breakage due to error logging with no mentor page

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

I struggle to identify what caused this - both the hook code and the relevant logic in Mentor have been untouched for many months.

Anyway, c616339 will fix this, as it uses WikiConfigException instead of MWException. If a faster fix is required, c617272 should work.

Change 617272 abandoned by Catrope:
[mediawiki/extensions/GrowthExperiments@master] Fix selenium test breakage due to error logging with no mentor page

Reason:
Superseded by https://gerrit.wikimedia.org/r/c/mediawiki/extensions/GrowthExperiments/ /616339

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

Change 616339 had a related patch set uploaded (by Catrope; owner: Gergő Tisza):
[mediawiki/extensions/GrowthExperiments@master] Introduce MentorManager and virtually assign mentors to all users

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

Change 616339 merged by jenkins-bot:
[mediawiki/extensions/GrowthExperiments@master] Introduce MentorManager and virtually assign mentors to all users

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

Tgr claimed this task.

Change 617438 had a related patch set uploaded (by Gergő Tisza; owner: Gergő Tisza):
[mediawiki/extensions/GrowthExperiments@wmf/1.36.0-wmf.2] Fix selenium test breakage due to error logging with no mentor page

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

Change 617438 merged by jenkins-bot:
[mediawiki/extensions/GrowthExperiments@wmf/1.36.0-wmf.2] Fix selenium test breakage due to error logging with no mentor page

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