Page MenuHomePhabricator

HomepageModuleRegistry shouldn't have MediaWikiServices as a parameter
Open, MediumPublic

Description

HomepageModuleRegistry gets an entire MediaWikiServices object injected into it, which goes against the documentation and can lead to stale reference. Per Injection.md documentation: "Do not however inject the MediaWikiServices object!"

The new MentorDashboardModuleRegistry in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/GrowthExperiments/+/685111/ (T278971) is doing this too, pointing to HomepageModuleRegistry as precedent.

Both should probably use ObjectFactory instead.

Event Timeline

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

The purpose of registries is to do open-ended object instantiation, so it's only natural they hold an instance of MediaWikiServices. I don't see what the benefit of holding it indirectly via ObjectFactory would be.

kostajh added subscribers: daniel, kostajh.

@daniel I see you've put this as medium priority and tagged Platform Team Workboards (MW Expedition), does that signify that Platform Engineering may look at this?