Page MenuHomePhabricator

How can we enable Automoderator's username to be localisable?
Closed, ResolvedPublicSpike

Description

User story: As an interface administrator, I want to configure the username shown to users when Automoderator reverts an edit, so that it is localised and understandable to users on my wiki.


We want each Wikimedia project to be able to configure their own username for Automoderator, and we want the username to be localised. This spike is to help us understand if and how this might be possible.

Wikidata has localisable edit summaries, which can be translated via TranslateWiki - this might be a sensible place to start the investigation.

Questions

  • Can we have Automoderator's username be configurable? If so, how?
  • Can we have Automoderator's username be localised? If so, how?
  • Is it possible for us to prevent other users from registering a new account with the local username, to avoid confusion?
  • Are there any drawbacks we should be aware of?

Answers

Can we have Automoderator's username be localised? If so, how?

Yes, but it's messy.

We could copy abusefilter's approach exactly and put the username in the localization system (explored in gerrit:1000038) . That has the consequence of managing username changes in translatewiki. The username would vary by wiki content language + translatewiki translation rather than being directly changeable.

Can we have Automoderator's username be configurable? If so, how?

Yes.

  1. We could put the username in extension config only (explored in gerrit:1000038 ). That has the consequence of managing username changes via backports. Or, we could:
  2. Put the username in the extension config and manage it with community config. That has the consequence of managing username changes along side other CC options we expose.

The main difference is the amount of friction for username changes.

Changing the username in any of these places has the consequence of a new automoderator username being used moving forward. All of the options should include a step (manual or automated) of checking for availability of the new name.

Is it possible for us to prevent other users from registering a new account with the local username, to avoid confusion?

Yes.
As @Umherirrender pointed out, we can add to the reserved usernames list via UserGetReservedNames hook.

  • This is really straightforward with the localization approach, as we just add the message label into the reserved names list via that hook.
  • I didn't have success when I experimented with pulling an AutoModerator username from config and adding it to the reserved names list. Since that is itself managed by configuration, there may be a lifecycle or dependency reason that this doesn't work, but I've not investigated further.

Since the code as written "steals" accounts via MediaWiki\User\User\newSystemUser, it may be enough to simply register the desired username as soon as it's decided upon. Once Automoderator uses the account to revert edits, it should be disabled for future login. Perhaps the account could be added to the $wgReservedUsernames config after the fact.

Are there any drawbacks we should be aware of?

Once username changes are made the consequences/pitfalls are:

  • no single source of truth in special:contributions for AutoModerator activity on a given project
  • old talk page still in place; new account won't have a talk page unless someone makes a new one / moves the existing one
  • possibility of user confusion over which account is actually AutoModerator
  • multiple sources of echo notifications if that's implemented down the road (not a problem for the pilot)

I suggest that we start by putting the username in the extension config for now while we explore our options for mitigating the downsides listed. It will not preclude implementing option 3 down the road and is in fact a prerequisite for option 3. From my research so far, I believe that if we include rename or account merge in the process for AutoModerator username changes (manual or automated), we can address all of those downsides.

Event Timeline

Restricted Application changed the subtype of this task from "Task" to "Spike". · View Herald TranscriptDec 4 2023, 3:10 PM

$wgReservedUsernames supports messages to store the name in and prevent that someone can log in according to the current message content.
Just needs a message call for the content language before the User::newSystemUser call to use it.

In the context of global user accounts this could be problematic to view the activity of the extension across the wikis or when the name is used in another language, for example see T160666, see T214722 for other ideas.

Experimentation so far:

Is it possible for us to prevent other users from registering a new account with the now-localised username, to avoid confusion?

As @Umherirrender pointed out, we can add to the reserved usernames list via UserGetReservedNames hook

Are there any drawbacks we should be aware of?

Allowing the account name to change after the extension has already been enabled will lead to cases that need to be covered. We can either try to do a name change (may not be possible if we're using reserved user names, works differently with and without central auth, desired name may be taken), or just create a new user account or possibly steal an existing user account (I assume we don't want this last option). If we create user new accounts on name change, then tracking the extensions activities through existing interfaces will be difficult.

eg. screenshot where I was playing around with the username. 3 different translated names, 3 different accounts with separate contribs:

image.png (271×696 px, 55 KB)

Change 1000038 had a related patch set uploaded (by Jsn.sherman; author: Jsn.sherman):

[mediawiki/extensions/AutoModerator@master] [DNM] exploring localizable AutoModerator username

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

Discussed this in a meeting today and determined that:

  • local accounts would be an acceptable tradeoff for simplicity
  • account renames would be required to avoid chaos and confusion
  • handling renames well is too large of an engineering lift for mvp

Since we're going with local accounts, we still want them to be defined per-project, which we can set in config (but not expose via community config). We should not change the account name for a project after deployment.

I still need to investigate the order of operations for

  • checking that a desired username is available
  • reserving username
  • creating system account
  • creating talk page for account

Wikidata has localisable edit summaries

We discussed this briefly too today and decided this isn't the right approach for a username, as it appears in a number of places and would be confusing to users - they would need to learn both the localised and software-defined name of Automoderator, and newer users may find themselves confused when clicking, for example, Special:Contributions - would we display the localised or software-defined name? It also opens us up to weird situations like the localised name being the same as an existing account, without clearer mechanisms for reserving the name.

Update:

Since we're going with local accounts, we still want them to be defined per-project, which we can set in config (but not expose via community config). We should not change the account name for a project after deployment.

I still need to investigate the order of operations for

  • checking that a desired username is available

this is step 1 and can simply be done by searching Special:ListUsers

  • reserving username

This is step 2. There are two ways to do this in wmf-config (both require a backport)

  • add the desired username to $wgReservedUsernames directly. this works whether we have the extension deployed yet or not
  • in my WIP patch, set the desired username in $wgAutoModeratorUsername. This variable is handy because it lets us set a default, though the extension needs to be deployed for it to have an impact
  • creating system account

This will be automatically done at runtime

  • creating talk page for account
  • This is step 3. This can be done as soon as the account is reserved. It doesn't have to wait for the account to actually exist. You simply get a warning about it on page creation.

Change 1007345 had a related patch set uploaded (by Jsn.sherman; author: Jsn.sherman):

[mediawiki/extensions/AutoModerator@master] [WIP] Reserve automoderator username

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

  • reserving username

This is step 2. There are two ways to do this in wmf-config (both require a backport)

  • add the desired username to $wgReservedUsernames directly. this works whether we have the extension deployed yet or not
  • in my WIP patch, set the desired username in $wgAutoModeratorUsername. This variable is handy because it lets us set a default, though the extension needs to be deployed for it to have an impact

Does this rule out our vision of having Automoderator's username be something that can be updated on the fly by communities? It sounds like we would need to deliberately (i.e. someone makes a request to us) name it per project.

  • reserving username

This is step 2. There are two ways to do this in wmf-config (both require a backport)

  • add the desired username to $wgReservedUsernames directly. this works whether we have the extension deployed yet or not
  • in my WIP patch, set the desired username in $wgAutoModeratorUsername. This variable is handy because it lets us set a default, though the extension needs to be deployed for it to have an impact

Does this rule out our vision of having Automoderator's username be something that can be updated on the fly by communities? It sounds like we would need to deliberately (i.e. someone makes a request to us) name it per project.

Not necessarily, but it avoids dealing with it for now. We determined earlier in the process that updating on the fly requires either:

  • leaving a trail of multiple automoderator accounts (which *I think* we would want to keep reserved) or
    • This could be left to manual rename/merge cleanup, but renames could be missed
  • implementing automatic local account renames or merges, which are pretty complex sets of actions to tie to a community config page edit
    • Note that you can't rename an account to a reserved name or a name attached to a central auth account (without calling central auth's rename)

Spitballing:

What if we allowed admins to make username changes, but only if automoderator is stopped/disabled. That would be a clear indicator that things need to happen in conjunction with a name change. We could direct the admins to the appropriate workflows for performing manual account rename/merge without needing to reinvent all of the user feedback, validation, documentation for those processes. I'm not sure how we could actually enforce that with community config, though.

  • reserving username

This is step 2. There are two ways to do this in wmf-config (both require a backport)

  • add the desired username to $wgReservedUsernames directly. this works whether we have the extension deployed yet or not
  • in my WIP patch, set the desired username in $wgAutoModeratorUsername. This variable is handy because it lets us set a default, though the extension needs to be deployed for it to have an impact

Does this rule out our vision of having Automoderator's username be something that can be updated on the fly by communities? It sounds like we would need to deliberately (i.e. someone makes a request to us) name it per project.

Not necessarily, but it avoids dealing with it for now. We determined earlier in the process that updating on the fly requires either:

  • leaving a trail of multiple automoderator accounts (which *I think* we would want to keep reserved) or
    • This could be left to manual rename/merge cleanup, but renames could be missed

This is one of the issues AbuseFilter has, though from what I've seen renames are very rare for it after the initial configuration, so perhaps it's more of a conceptual issue than a real one?

Spitballing:

What if we allowed admins to make username changes, but only if automoderator is stopped/disabled. That would be a clear indicator that things need to happen in conjunction with a name change.

I think this could definitely work - we could make clear at the outset that the username should have some thought put into it because of this, to encourage this action to be an uncommon one.

We could direct the admins to the appropriate workflows for performing manual account rename/merge without needing to reinvent all of the user feedback, validation, documentation for those processes. I'm not sure how we could actually enforce that with community config, though.

I don't hate the idea but directing towards manual community processes is something we'd need to give more thought to I think.

I think we've reached the point of knowing what our choices are, and what the consequences are of making them. I'm going to try to condense it all down to a single comment for team discussion.

Here's how I see it:

Options to allow usernames to vary per project:

  1. Copy abusefilter exactly and put the username in the localization system (explored in gerrit:1000038) . That has the consequence of managing username changes in translatewiki.
  2. Put the username in extension config only (explored in gerrit:1000038 ). That has the consequence of managing username changes via backports.
  3. Put the username in the extension config and let it be set by community config. That has the consequence of managing username changes along side other CC options we expose.

The main difference between is amount of friction for username changes. Changing the username in any of these places has the consequence of a new automoderator username being used moving forward. All of the options should include a step (manual or automated) of checking for availability of the new name.

If we leave it at that, once username changes are made the consequences/pitfalls are:

  • no single source of truth in special:contributions for AutoModerator activity on a given project
  • old talk page still in place; new account won't have a talk page unless someone makes a new one / moves the existing one
  • possibility of user confusion over which account is actually AutoModerator
  • multiple sources of echo notifications if that's implemented down the road (not a problem for the pilot)

I'm suggesting that we start with option 2 for now while we explore our options for mitigating the downsides listed. It will not preclude implementing option 3 down the road and is in fact a prerequisite for option 3. From my research so far, I believe that if we include rename or account merge in the process for AutoModerator username changes (manual or automated), we can address all of those downsides.

jsn.sherman changed the task status from Open to In Progress.Feb 29 2024, 7:11 PM
jsn.sherman triaged this task as Medium priority.
jsn.sherman updated the task description. (Show Details)
jsn.sherman added a subscriber: Umherirrender.
jsn.sherman removed a subscriber: Umherirrender.

Change 1000038 abandoned by Jsn.sherman:

[mediawiki/extensions/AutoModerator@master] [DNM] exploring localizable AutoModerator username

Reason:

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

Change 1007345 merged by jenkins-bot:

[mediawiki/extensions/AutoModerator@master] Configurable automoderator username

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