Page MenuHomePhabricator

Special:QuitMentorship reassigns another mentor's mentee
Closed, ResolvedPublicBUG REPORT


A mentor recently retired from mentorship. They followed the instructions on the Special:MentorDashboard to reassign mentees through Special:QuitMentorship. However, as you can see from the above log, Special:QuitMentorship reassigns not only the mentee of the retired mentor, but also the mentees of other mentors. (Not all mentees appear to be affected)

Event Timeline

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

Mentee reassignment of other mentors can also be found in the log mentioned in T304428.

kostajh edited projects, added Growth-Team (Current Sprint); removed Growth-Team.
kostajh added a subscriber: Urbanecm_WMF.

That's weird. I'll check this ASAP. Thanks for reporting!

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

[mediawiki/extensions/GrowthExperiments@master] QuitMentorship: Only process primary mentors

@Bluehill395 Thanks again for noticing this bug. The issue was caused by a bug in our code. I uploaded a patch to fix that.

To explain the issue my patch fixes, this is what happened here:

  1. GrowthExperiments assigns two mentors to each user: primary mentor (the one shown in the newcomer homepage) and a backup mentor (the one who is sent the questions if the primary mentor is away; backup mentor is not meant to be permanent, GrowthExperiments can change who the backup mentor is, for instance, if they are also away).
  2. QuitMentorship fetches all mentees assigned to a mentor, regardless of the role (ie. this step includes mentees the mentor had as a backup mentor). This is wrong, because backup mentor is updated by GrowthExperiments when the currently assigned one is not suitable (is away or not a mentor anymore), cf. MentorPageMentorManager::getMentorForUser.
  3. For each of the relationships fetched in step 2, it calls ChangeMentor to do the reassignment. ChangeMentor assumes a primary relationship needs to be changed, and changes a perfectly valid relationship.

My patch fixes that by only fetching primary assignments in the 2nd step.

Change 804554 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] QuitMentorship: Only process primary mentors

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

[mediawiki/extensions/GrowthExperiments@master] Add QuitMentorshipIntegrationTest

Change 805094 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Add QuitMentorshipIntegrationTest

Thanks for the message @Bluehill395. I'm glad it works now.