Page MenuHomePhabricator

Mentees assigned to others mentors are visible in my recent changes list
Closed, ResolvedPublicBUG REPORT

Description

This issue has been reported by NGC at ro.wp, and I also have encountered the issue at fr.wp: some of the mentees that appear in the list of recent changes under the "my mentees" filters aren't mentees assigned to the mentor's account.

  • Filters used by NGC 54 at ro.wp
  • Some mentees that are visible using the filters but who aren't assigned to them: Tudorrares111, AlexB15l, Constantin Dutchevici.
  • My filter at fr.wp
  • Some mentees that are visible using the filters but who aren't assigned to me: Lokotoro, Aayc03, LaMotte514
    • I checked the 10 first mentees I have in my recent changes.

These users should only be visible to their mentors, not to other random mentors.

Event Timeline

Restricted Application added subscribers: Strainu, Aklapper. · View Herald Transcript

I can reproduce at cswiki. I'll investigate how this happens -- I suspect cache pollution might be happening somehow?

CC @Tgr as the code author.

Sophonauta is a mentee I see at (filtered) cswiki RC, who isn't assigned to me.

[urbanecm@mwmaint1002 ~]$ mwscript shell.php cswiki
Psy Shell v0.10.8 (PHP 7.2.34-18+0~20210223.60+debian10~1.gbpb21322+wmf3 — cli) by Justin Hileman
>>> use MediaWiki\MediaWikiServices;
>>> $config = MediaWikiServices::getInstance()->getMainConfig()
=> GlobalVarConfig {#511}
>>> $mentorStore = MediaWikiServices::getInstance()->get('GrowthExperimentsMentorStore')
=> GrowthExperiments\Mentorship\Store\DatabaseMentorStore {#5818}
>>> $starredMenteesStore = MediaWikiServices::getInstance()->get('GrowthExperimentsStarredMenteesStore')
=> GrowthExperiments\MentorDashboard\MenteeOverview\StarredMenteesStore {#3313}
>>> $mentorManager = MediaWikiServices::getInstance()->get('GrowthExperimentsMentorManager')
=> GrowthExperiments\Mentorship\MentorPageMentorManager {#5793}
>>> $hookHandler = new \GrowthExperiments\Mentorship\Hooks\MentorFilterHooks($config, $mentorStore, $starredMenteesStore, $mentorManager)
=> GrowthExperiments\Mentorship\Hooks\MentorFilterHooks {#6097}
>>> sudo $ids = $hookHandler->getUnstarredMenteeIds(User::newFromName('Martin Urbanec'))
[...]
>>> in_array(User::newFromName('Sophonauta')->getId(), $ids)
=> true
>>>

So, it's MentorFilterHooks::getUnstarredMenteeIds itself that's broken.

Sophonauta is a mentee I see at (filtered) cswiki RC, who isn't assigned to me.
[...]
So, it's MentorFilterHooks::getUnstarredMenteeIds itself that's broken.

Or also not:

wikiadmin@10.64.32.11(cswiki)> select * from growthexperiments_mentor_mentee where gemm_mentee_id=557979;
+----------------+------------------+----------------+
| gemm_mentee_id | gemm_mentor_role | gemm_mentor_id |
+----------------+------------------+----------------+
|         557979 | backup           |         275298 |
|         557979 | primary          |          44751 |
+----------------+------------------+----------------+
2 rows in set (0.001 sec)

wikiadmin@10.64.32.11(cswiki)>

275298 is my user ID.

Root cause seems to be that the filtering code includes backup mentors in the game. That's not the expected behavior, and fortunately, easy to fix. Patch incoming.

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

[mediawiki/extensions/GrowthExperiments@master] MentorFilterHooks: Include only primary mentors

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

Change 748829 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] MentorFilterHooks: Include only primary mentors

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

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

[mediawiki/extensions/GrowthExperiments@wmf/1.38.0-wmf.13] MentorFilterHooks: Include only primary mentors

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

Change 750807 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@wmf/1.38.0-wmf.13] MentorFilterHooks: Include only primary mentors

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

Mentioned in SAL (#wikimedia-operations) [2022-01-05T09:53:54Z] <urbanecm@deploy1002> Synchronized php-1.38.0-wmf.13/extensions/GrowthExperiments/includes/Mentorship/Hooks/MentorFilterHooks.php: 24e15e1fd5c7feb2377974ee666c61aef8f82da5: MentorFilterHooks: Include only primary mentors (T298031) (duration: 01m 07s)

Should be now fixed in production (wmf.13). FYI @Trizek-WMF, @Etonkovidova.

Using my volunteer account, I checked in recent changes and I only have my mentees being displayed there.

Checked in my cswiki mentor role, works as expected. Closing.