⚓ T356922 Deprecate unnecessary GlobalBlocking hooks
Page MenuHomePhabricator

Deprecate unnecessary GlobalBlocking hooks
Closed, ResolvedPublic1 Estimated Story Points

Description

When an IP is globally blocked and tries to perform an action, a error message is shown to the caller. The specific message is customisable via specific hooks and which hook is called depends on the type of target for the block. For example, GlobalBlockingBlockedIpMsg hook is run when the target is an IP address and GlobalBlockingBlockedIpRangeMsg is run when the target is an IP address range.

However, the only usage of any of these hooks (based on a codesearch search) is to provide Wikimedia specific message overrides in the WikimediaMessages extension. This can instead be done by specifying the message keys in Hooks::onMessageCacheFetchOverrides of the WikimediaMessages extension.

As such these hooks can be deprecated and also prevents the need to add a new hook for global blocks on accounts.

Acceptance criteria
  • Deprecate GlobalBlockingBlockedIp, GlobalBlockingBlockedIpRange, and GlobalBlockingBlockedIpXff hooks
  • Update the existing usages of these hooks in WikimediaMessages to use the Hooks::onMessageCacheFetchOverrides method and therefore remove the GlobalBlocking hook handler methods.

Related Objects

StatusSubtypeAssignedTask
Resolvedkostajh
DeclinedNone
In ProgressNiharika
OpenNone
OpenDreamy_Jazz
ResolvedDreamy_Jazz
DeclinedNone
DuplicateNone
ResolvedFeatureDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedTchanders
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedMarostegui
ResolvedMarostegui
ResolvedDreamy_Jazz
ResolvedUrbanecm
ResolvedBUG REPORTDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz

Event Timeline

Change 999847 had a related patch set uploaded (by Dreamy Jazz; author: Skizzerz):

[mediawiki/extensions/GlobalBlocking@master] Add GlobalBlockingBlockedUserMsg hook

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

Dreamy_Jazz changed the point value for this task from 2 to 1.

Change 999865 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/WikimediaMessages@master] Update GlobalBlocking hooks to just be message overrides

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

Dreamy_Jazz changed the point value for this task from 1 to 2.Feb 9 2024, 3:03 PM
Dreamy_Jazz renamed this task from Add GlobalBlockingBlockedUserMsgHook to Deprecate unnecessary GlobalBlocking hooks.Feb 9 2024, 3:07 PM
Dreamy_Jazz updated the task description. (Show Details)
Dreamy_Jazz changed the point value for this task from 2 to 1.

Change 999847 abandoned by Dreamy Jazz:

[mediawiki/extensions/GlobalBlocking@master] Add GlobalBlockingBlockedUserMsg hook

Reason:

Marking the other hooks as deprecated per T356922, so no need for this change.

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

Change 999893 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/GlobalBlocking@master] Deprecate 'GlobalBlockingBlockedIP.*' hooks

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

Change 999970 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/GlobalBlocking@master] Hard deprecate GlobalBlockingBlockedIp.* hooks

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

@Dreamy_Jazz Were you able to find where these messages being used anywhere?

From a (non-exhaustive) cursory look, I was finding that the block tended to be used as a bool, or the block message was overridden via onGetBlockErrorMessageKey.

I'm wondering how easy it is to do T332401: Remove old block error messages from GlobalBlocking extension.

Change 999893 merged by jenkins-bot:

[mediawiki/extensions/GlobalBlocking@master] Deprecate GlobalBlockingBlockedIp.* hooks

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

Change 999865 merged by jenkins-bot:

[mediawiki/extensions/WikimediaMessages@master] Update GlobalBlocking hooks to just be message overrides

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

@Dreamy_Jazz Were you able to find where these messages being used anywhere?

From a (non-exhaustive) cursory look, I was finding that the block tended to be used as a bool, or the block message was overridden via onGetBlockErrorMessageKey.

I'm wondering how easy it is to do T332401: Remove old block error messages from GlobalBlocking extension.

I had not noticed that this task exists and it also seems to me that these messages are not used anywhere.

However, to comply with the deprecation process we need to wait until the next release version per:

Obsolete behavior MAY be removed after it has been hard deprecated for three months in the development version (the master branch) as well as in one major release

As such T332401: Remove old block error messages from GlobalBlocking extension will need to wait until 1.42 has been split and at least 3 months from today if we follow the process. This is because the behaviour of the hooks would be broken if those messages were removed (along with the related code).

I could argue that as this was un-used the deprecation does not break anything, but it depends if we want to go down that line.

We can ignore this and not add a message that is specific to user blocks to avoid removing it later on.

Change 999970 merged by jenkins-bot:

[mediawiki/extensions/GlobalBlocking@master] Hard deprecate GlobalBlockingBlockedIp.* hooks

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

I can see no easy way to QA this ticket because:

  • Marking a hook as deprecated and the change to WikimediaMessages should not have produced any visible on-wiki change, so QA probably can only test that no visual changes were made by this ticket
  • Per T332401, the messages that were modified by these hooks are probably unused. As such there is probably no way to verify that these changes made no visual difference on-wiki (as there is no place on-wiki where they are used)

As such I would propose that QA is skipped. Alternatively QA could search the codebase using https://codesearch.wmcloud.org/search/ to ensure that there are no remaining handlers for the deprecated hooks

We can ignore this and not add a message that is specific to user blocks to avoid removing it later on.

Sounds good to me.

Agree we can skip QA (I did the code search during code review).