Page MenuHomePhabricator

HTML versioning information needed in skins to be able to cleanly make incompatible CSS changes
Closed, DeclinedPublic

Description

In the Wikimedia setup generated page HTML is cached for ~30 days regardless of skin HTML changes, while CSS&JS is purged at most a few minutes after a change is deployed.

This is a highly suboptimal situation, as this means that in every change that modifies both the HTML and the CSS, the CSS must be backwards-compatible with old HTML. This requires a lot of care and additional awkward testing and causes major issues when not done carefully enough (e.g. bug 42452), and sometimes just isn't possible at all unless some transitional hacks are inserted (e.g. bug 46947).

Luckily this isn't an issue for most third-party wikis, as php update.php after upgrade purges the cache entirely.


I'm proposing adding another class to <body>, "skintimestamp-YYYYMMDD", where YYYYMMDD is the year, month and day of the time that given skin's HTML was last modified in an incompatible way. Day should be enough granularity to avoid conflicts while keeping the class name short enough.

This can be easily done using the addToBodyAttributes() method of the Skin class. The timestamp would be updated manually by whoever is making those changes, and the class could be used in the CSS to only apply new styles to newly generated HTML. Older styles could be simply left intact, and then removed after enough time has passed.

If multiple incompatible changes are ever done in overlapping time periods, the successive ones would include updates to the "old new" styles to use both the new and old class.

Thoughts?


Version: 1.22.0
Severity: normal
URL: http://lists.wikimedia.org/pipermail/wikitech-l/2013-April/068173.html

Details

Reference
bz46956

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:18 AM
bzimport set Reference to bz46956.

I don't believe this is a feasible or viable way to solve this problem.

It's certainly more feasible than reimplementing it every time we make incompatible changes. I agree it's a little unclean, but IMO it's the best we can do with the caching setup at WMF. Have you got any better ideas?

(In reply to comment #2)

I don't believe this is a feasible or viable way to solve this problem.

It seems reasonable to me. Could you be more specific about your objections? Right now this just reads as "No, and I won't tell you why, just no."

I think this idea has a lot of merit and although I'm not a 100% sure I think it could potentially. Although rather than using timestamp, I wonder if it would be better done as a version number of the skin itself.

This way if someone needs to make a change that supports something in an old skins they can do:

.skin-vector-v2 h2 {
// old skin styles
}

h2 {

// new skin styles

}

Krinkle would be interested in a reply to Roan..