Page MenuHomePhabricator

Renaming a user still doubles their edit count (December 2025)
Closed, ResolvedPublicBUG REPORT

Description

Renaming a user apparently still doubles their edit count. It was supposed to be fixed in August in T313900 by https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CentralAuth/+/1173993. Either that patch didn't work, or the issue has regressed.

I learned about this today when folks from The-Wikipedia-Library reported that a user complained that they had a negative recent edit count (their edit count decreased).
They currently have 62,363 edits (https://meta.wikimedia.org/wiki/Special:CentralAuth/Juwan). Their edit count was recalculated as a result of Toki Pona Wikipedia import (T411187#11481534).
In October, they had "Total edit count: 113,642, Sum of local edit counts: 58,282" (https://web.archive.org/web/20251003001926/https://meta.wikimedia.org/wiki/Special:CentralAuth/Juwan).
They were renamed in September (https://meta.wikimedia.org/wiki/Special:Log?type=gblrename&page=Special:CentralAuth/Juwan).

This is also affecting renames occurring today. The latest global rename was https://meta.wikimedia.org/wiki/Special:Log?type=gblrename&page=Special:CentralAuth/Outrecu1dant and https://meta.wikimedia.org/wiki/Special:CentralAuth/Outrecu1dant reports "Total edit count: 364, Sum of local edit counts: 182".

Event Timeline

Izno changed the subtype of this task from "Task" to "Bug Report".Dec 23 2025, 9:55 AM
• matmarex renamed this task from Renaming a user *still* doubles their edit count (December 2025) to Renaming a user still doubles their edit count (December 2025).Jan 5 2026, 7:25 PM

Change #1241052 had a related patch set uploaded (by SomeRandomDeveloper; author: SomeRandomDeveloper):

[mediawiki/extensions/CentralAuth@master] Fix global edit count not being cleared when a user is renamed

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

Change #1241052 merged by jenkins-bot:

[mediawiki/extensions/CentralAuth@master] Fix global edit count not being cleared when a user is renamed

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

Unassigning myself as I assume FixRenamedUserGlobalEditCount has to be run after the fix is deployed through the train.

Change #1242512 had a related patch set uploaded (by SomeRandomDeveloper; author: SomeRandomDeveloper):

[mediawiki/extensions/CentralAuth@REL1_45] Fix global edit count not being cleared when a user is renamed

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

I've created a cherry pick for 1.45; 1.44 and below would require https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CentralAuth/+/1173993 to be backported as well.

Change #1242512 merged by jenkins-bot:

[mediawiki/extensions/CentralAuth@REL1_45] Fix global edit count not being cleared when a user is renamed

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

Unassigning myself as I assume FixRenamedUserGlobalEditCount has to be run after the fix is deployed through the train.

Yes. I will take care of that, after the patch is deployed and after I let The-Wikipedia-Library folks know that I will be adjusting the edit counts again (see T313900#11184553).

Thank you for finding the bug!

Unassigning myself as I assume FixRenamedUserGlobalEditCount has to be run after the fix is deployed through the train.

Yes. I will take care of that, after the patch is deployed and after I let The-Wikipedia-Library folks know that I will be adjusting the edit counts again (see T313900#11184553).

Thank you for finding the bug!

Did this get resolved? Just tracking whether to close the related T325961.

It didn't get resolved yet, sorry about that :/

What I did just today:

  • Tested the script on the beta cluster by running mwscript CentralAuth:FixRenamedUserGlobalEditCount --wiki=metawiki --since=20250901000000 --until=20260301000000. Output:
Edit count already correct for 'XXBlackburnXx'
Dry run done, would correct 0 edit counts

What needs to be done:

  • Running the script in production with something like mwscript-k8s --comment="T413390" -- CentralAuth:FixRenamedUserGlobalEditCount --wiki=metawiki --since=20250901000000 --until=20260301000000
  • Sharing the list of users it outputs with you, @Samwalton9-WMF :) These will be the users whose edit counts will be adjusted, and who may temporarily lose access to TWL due to their recent edit count going negative. I don't know if you can do something about that, but I assume having the list would be useful anyway just to be aware.
  • Once you give us the green light: Running the script again with --fix to actually adjust the edit counts

I will be away on leave for a bit, but I'll ask someone to do the needful.

The results are at P96206. 7738 users would have their edit count changed; for 4463 it would be halved, for 3164 it would result in less then half of their edits removed (I guess these have edited after the rename), for 111 it would remove more than half of their edits - probably renamed more than once? I checked a few and those have been vanished then unvanished.

@Samwalton9-WMF the list of affected users, sorted by edit count, is in P96207 (in TSV format).

The results are at P96206. 7738 users would have their edit count changed; for 4463 it would be halved, for 3164 it would result in less then half of their edits removed (I guess these have edited after the rename), for 111 it would remove more than half of their edits - probably renamed more than once? I checked a few and those have been vanished then unvanished.

@Samwalton9-WMF the list of affected users, sorted by edit count, is in P96207 (in TSV format).

Thanks. I had a quick look and of that list, only 23 accessed any TWL content in July. Given this was a small number I went in and manually exempted each of them against the TWL criteria. I'll remove that exemption 30 days after the script has been run, when the issue should have passed through our system. Other users will, I'm sure, still be caught, but this seems like the lowest effort quick win to address issues preemptively.

Mentioned in SAL (#wikimedia-operations) [2026-08-20T12:08:13Z] <tgr_> T413390 running CentralAuth:FixRenamedUserGlobalEditCount --wiki=metawiki --since=20250901000000 --until=20260301000000 --fix

Logs: