Earlier today I was helping a coworker with a question about data related to block messages on mobile, like this:

I did not anticipate my investigation to become what I might best describe as “git forensics”. First, let’s introduce our dramatis personae:

When you browse the mobile (“m.” subdomain) version of Wikipedia in a browser, what you see rendered is largely due to the MobileFrontend extension for MediaWiki (the software that powers Wikipedia, Wikimedia Commons, and Wikimedia projects).
Git is a free and open source system for version control.
Phabricator is an open source toolkit for code review, repository hosting, bug tracking, and project management. If you’re familiar with Jira it’s kind of like that.

The story begins with the Phabricator task T260218 to “Add logging for measuring impact of our work on improving the mobile block messages.” The task mentions that this has been done in the past and links to a task from August 2018: T201719. What happened to that tracking? Is that data still available?

When submitting patches for code review to Gerrit, you can tag which Phabricator task the patch addresses. This is how I obtained my first clue: the tracking was added in an October 2018 patch to MobileFrontend via this code in resources/mobile.editor.overlay/BlockMessage.js:

if ( mw.config.get( 'wgMFTrackBlockNotices' ) ) {
  mw.track( 'counter.MediaWiki.BlockNotices.' + wiki + '.MobileFrontend.shown', 1 );

mw.track() has a variety of uses, but the one relevant here is using it to send simple events to Graphite time series data store for dashboarding with Grafana as documented here. Here are those counts of block notices shown in the MobileFrontend:

Screenshot of block notice counts in Grafana

git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/MobileFrontend"

I had a pretty good idea of what the answer would be but I still thought I’d check what’s in resources/mobile.editor.overlay today. Not BlockMessages.js that’s for sure!

So…I needed to know what happened to it. Thanks to this StackOverflow answer I was able to find the commit that last touched this file:

git log --all --full-history -- resources/mobile.editor.overlay/BlockMessage.js

In this January 2019 commit this file was moved to src/mobile.editor.overlay/BlockMessage.js

But that file doesn’t exist anymore either. Okay, let’s use the same methodology to figure out what happened to it:

git log --all --full-history -- src/mobile.editor.overlay/BlockMessage.js

Had to scroll past a few irrelevant commits to the relevant one from August 2019 where this file was deleted. However, at that point the tracking code was missing. So I navigated to the state of the repository right before that file was deleted:

git checkut ba85b6ed54629f2e1ae6779cbc3e947eb1a45ce4

And thanks to this StackOverflow answer for showing how to locate when a line was deleted:

git log -c -S'mw.track' src/mobile.editor.overlay/BlockMessage.js

BINGO. I’ve found the April 2019 commit which removed the tracking code.

Not bad sleuthing, even if I do say so myself!