Page MenuHomePhabricator

Structured mentor list: Migrate mentor status to GrowthMentors.json
Open, MediumPublic

Description

The "Mentor is away" functionality was created as part of the initial Mentor dashboard (T280307), which was done before we had a sign up page and more importantly, GrowthMentors.json as the central mentor storage (T264343). For this reason, the mentor's status is stored in the growthexperiments-mentor-away-timestamp user property, instead of the central JSON file.

This is both confusing and unintuitive technically-speaking. It also forces us to open a non-standard way for admins to edit preferences of other users (Special:ManageMentors). We should migrate the mentor status to GrowthMentors.json.

Checklist
  • (1) Ensure the mentor list API and the ManageMentors form write the data to GrowthMentors.json, in addition to changing the user preference, but keeps the user preference as the primary source.
  • (2) Write and merge a maintenance script, which would migrate data from user properties into GrowthMentors.json (affects users that did not alter their mentor preferences manually).
  • (3) Write & review (but don't merge) a change that changes the primary source from user preference to GrowthMentors.json
  • (4) Run the maintenance script from step 2; merge & backport the change from step 3.
Things to not forget cleaning up as part of this task once the above migration is done:
  • includes/Config/Validation/StatusAwayValidationTrait.php should be merged into StructuredMentorListValida
  • MentorStatusManager::canChangeStatus should no longer be needed because blocked/locked mentors should not be able to edit config anyway, but other Admins should still be able to edit them.

Related Objects

Event Timeline

DMburugu set the point value for this task to 1.Oct 17 2023, 3:33 PM
DMburugu removed the point value 1 for this task.
DMburugu lowered the priority of this task from High to Medium.

Change #1168157 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/GrowthExperiments@master] migration: start writing away status timestamp in config

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

Change #1169113 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/GrowthExperiments@master] GrowthMentorsList: add maintenance script to migrate mentor status away

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

Change #1170140 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/GrowthExperiments@master] [DNM][WIP] migration: start reading away status timestamp from config

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

Change #1170290 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/GrowthExperiments@master] [DNM][WIP] GrowthMentorList: stop writing status away in user option

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

  • (1) Ensure the mentor list API and the ManageMentors form write the data to GrowthMentors.json, in addition to changing the user preference, but keeps the user preference as the primary source.
  • (2) Write and merge a maintenance script, which would migrate data from user properties into GrowthMentors.json (affects users that did not alter their mentor preferences manually).
  • (3) Write & review (but don't merge) a change that changes the primary source from user preference to GrowthMentors.json
  • (4) Run the maintenance script from step 2; merge & backport the change from step 3.

About that checklist currently in the description: wouldn't it be better to separate those steps a bit more?

  1. (keep as is)
  2. (keep as is)
  3. run the maintenance script to migrate data from user properties into GrowthMentors.json
  4. write a change that changes the primary source from user preference to GrowthMentors.json, based on a config switch
  5. after a while (2 weeks?) run the maintenance script again on all wikis to ensure that the config is actually in sync (=it should say "no change" everywhere)
  6. flip the config switch
  7. cleanup (remove the write both and all the legacy code)

That being said, are 3rd party wikis using the Mentorship functionality? If so, then we should probably wait with the cleanup step till the next release is cut.

Change #1172024 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/GrowthExperiments@master] GrowthMentorList: purge expired away timestamps from config

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

About that checklist currently in the description: wouldn't it be better to separate those steps a bit more?

  1. (keep as is)
  2. (keep as is)
  3. run the maintenance script to migrate data from user properties into GrowthMentors.json
  4. write a change that changes the primary source from user preference to GrowthMentors.json, based on a config switch
  5. after a while (2 weeks?) run the maintenance script again on all wikis to ensure that the config is actually in sync (=it should say "no change" everywhere)
  6. flip the config switch
  7. cleanup (remove the write both and all the legacy code)

I don't find the config switch strictly necessary here unless we want to deploy this on a per-wiki basis. We can deploy (4) after (5) and that should do it?

That being said, are 3rd party wikis using the Mentorship functionality? If so, then we should probably wait with the cleanup step till the next release is cut.

I don't think we have that information available, we don't even know how many are out there (T373809), but maybe @Urbanecm_WMF knows of some Mentorship usage cases?

Change #1168157 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] GrowthMentorList: start writing away status timestamp in config

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

Change #1172024 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] GrowthMentorList: purge expired away timestamps from config

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