Page MenuHomePhabricator

Devise a smart deprecation process for hooks passing User or Title objects
Open, MediumPublic

Description

Many, many hooks in both MW core and extensions pass a User or Title objects, either because that was unavoidable when the hook was created, or because some functionality possibly relevant to the hook is still inside those classes. However, as we're moving away from those classes in favour of new lightweight interfaces (e.g. UserIdentity, LinkTarget, PageIdentity), more and more hooks shouldn't have the need to pass those objects anymore. Ideally, I believe that an ultimate goal might be to get rid of these classes entirely, and even if this is not the case, it would make sense for hooks to pass the lighter versions.

This leads to the question: how do we deal with these hooks? AFAIK, there's no specific way to mark a hook parameter as deprecated. Unless a hook is unused (and even then, it depends), the only sane solution would be to deprecate the old hook in favour of a new one with narrower types. However, this doesn't seem scalable, if we factor in the amount of hooks that would need such a change.

So what I'm proposing with this change is that we agree on a way to deprecate these parameters, without having to create dozens of new hooks.

Event Timeline

Also, random example of where such a change would be needed: T266409

AMooney moved this task from Inbox to Tech Planning Review on the Platform Engineering board.
AMooney added subscribers: daniel, AMooney.

@daniel please review next tech planning.

I expect that we will resolve this as part of T275847. Moving to "watching" for now, for lack of a better place.