Page MenuHomePhabricator

GlobalContributions: Fetch correct byte count for each local wiki revision
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:
GlobalContributions reports that this edit was (+10,273), even though actually it was (-1). 10kB is the page size after the change. That's interesting especially that one entry below, the previous edit is listed, so that it's not an issue of going beyond a limit of edits selected by some database query.

What should have happened instead?:
The delta size should be the same on GlobalContributions and on local wiki

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):
The edits made on meta are reported with good edit size deltas.

image.png (286×975 px, 102 KB)

image.png (165×1 px, 62 KB)

(dates on the screenshot are in UTC+1)

Event Timeline

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

It needs previous revision of every edit but they are not get.
includes/pager/ContributionsPager.php:doBatchLookups from MediaWiki does not fill previd because tryCreatingRevisionRecord prevents doing this in this case. I think it is not necessary to do this way, because getting superior revisions don't need RevisionRecord created. So, this code can be changed or overwrite method GlobalContributionsPager with this part (getRevisionSizes).

kostajh subscribed.

This seems like an important bug to fix, so moving into the current sprint. We could move it into the next sprint if we don't have time.

kostajh renamed this task from Special:GlobalContributions reports wrong edit size delta to GlobalContributions: Fetch correct size for each local wiki revision.Mar 17 2025, 10:28 AM
mszabo changed the task status from Open to In Progress.Mar 18 2025, 12:43 PM
mszabo claimed this task.
kostajh renamed this task from GlobalContributions: Fetch correct size for each local wiki revision to GlobalContributions: Fetch correct byte count for each local wiki revision.Apr 4 2025, 12:41 PM

Indeed, it seems that for most (or all?) revisions, the absolute size is mistaken for the relative size difference.

This means a lot of attention is drawn to seemingly minor edits.

This cause makes sense in so far that this backed by a revision table query, and the revision only knows its own size. The "difference" in size, just like the diff in text, are purely runtime concepts, and may change over time (e.g. when revisions are imported/archived/restored; or when pages have their history merged/split).

In core, this works because ContributionsPager::doBatchLookups performs a second query that warms up mParentLens via a batched RevisionStore->getRevisionSizes() call.

https://meta.wikimedia.org/wiki/Special:GlobalContributions/Krinkle
https://www.mediawiki.org/wiki/Special:Contributions/Krinkle

Screenshot 2025-04-10 at 15.24.48.png (1×2 px, 1 MB)

Change #1145147 had a related patch set uploaded (by Máté Szabó; author: Máté Szabó):

[mediawiki/core@master] ContributionsPager: Allow customizing parent rev len fetching

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

Change #1145148 had a related patch set uploaded (by Máté Szabó; author: Máté Szabó):

[mediawiki/extensions/CheckUser@master] GlobalContributions: Fetch correct byte count for revisions

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

Change #1145147 merged by jenkins-bot:

[mediawiki/core@master] ContributionsPager: Allow customizing parent rev len fetching

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

Change #1145148 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] GlobalContributions: Fetch correct byte count for revisions

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

Djackson-ctr subscribed.

QA is completed, I have verified the new code has been implemented and is functioning as expected (The delta size is the same on GlobalContributions and on local wiki).