Page MenuHomePhabricator

MediaWiki-namespace .js and .css action=raw URLs are no longer purged on edit
Closed, ResolvedPublic

Description

I edited MediaWiki:AnonymousI18N.js on Commons, which is loaded from MediaWiki:Common.js using the canonical, long-cached, supposed-to-be-purged URL:

https://commons.wikimedia.org/w/index.php?title=MediaWiki:AnonymousI18N.js&action=raw&ctype=text/javascript

However, neither on edit, nor on the dozens of purge attempts later, it's not getting purged from the CDN.

Looking into the code, where this is supposed to be, I see that there is a pretty obvious bug: It checks for isUserJsConfigPage() which is limited to NS_USER. This code is now in HtmlCacheUpdater service class, but used to be in Title::getCdnUrls.

The code was changed in change 410085, which removed the confusingly-ambigiously named isJsSubpage() method to isUserJsConfigPage(), based on the inline comment which gave this further false confidence that it wasn't a bug, when in fact it was:

// If we are looking at a css/js user subpage, purge the action=raw
if ( $this->isJsSubpage() ) {

Event Timeline

The bug has been there from the start in a 2014 patch merged by yours truly: change 95095 (T58874).

Unfortunately, despite it explicitly saying "user subpages" and me having merged this, I have in the years since documented, preached, and actively removed use of "smaxage=" hacks and other cache busting params for MediaWiki-namespace URLs wrongly thinking that these are "now" purged. Oops!

Krinkle triaged this task as Medium priority.

Change 623096 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] cache: Add purges from HtmlCacheUpdater for NS_MEDIAWIKI js/css pages

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

Change 623096 merged by jenkins-bot:
[mediawiki/core@master] cache: Add purges from HtmlCacheUpdater for NS_MEDIAWIKI js/css pages

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