Page MenuHomePhabricator

Switch Hogan for Mustache
Closed, ResolvedPublic5 Estimated Story Points

Description

We will remove Hogan from MobileFrontend and make sure of Mustache in core. Mustache is smaller, uses the same syntax and available in MediaWiki. This will make it easier for template users working across mobile and desktop environments.

Acceptance criteria

  • A dependency is added to mediawiki.template.hogan to mediawiki.template.mustache
  • For compatibility with Minerva which cannot use inline templates (right now) , to avoid loading both Mustache and Hogan and to avoid this being a breaking change the Hogan compiler should remain but look like this:
// register hogan compiler with core
mw.template.registerCompiler( 'hogan', mw.template.getCompiler('mustache') );
  • Any webpack dependencies relating to Hogan are removed.
  • A deprecated flag is added to mediawiki.template.hogan to ensure existing users move to mediawiki.template.mustache

QA steps

Switching Hogan to Mustache will have implications on Minerva, which will still be using templates for rendering page issues, main menu, notifications and the back to top feature

  • In beta ensure the back to top feature is still rendering and matches production when opted into BETA (Android only)
  • Make sure the main menu rendering matches production
  • Make sure the page issues overlay rendering matches production. Use https://en.m.wikipedia.beta.wmflabs.org/wiki/Pharmacovigilance for testing this.
  • Make sure the notification badge (top right corner in LTR mode) is still rendering and matches production.

A general QA of the entire site (either by developer and/or test engineer) will also be needed to check different flows are rendering easily. (This would be much more straightforward if we had a Storybook)

Sign off steps

  • Record this on release timeline
  • Open a task to update Minerva to use mediawiki.template.mustache (already done)
  • Open a task to remove the mediawiki.template.hogan module completely (patch merged 3 weeks after, no task necessary)

QA Results

Event Timeline

Jdlrobson created this task.
Jdlrobson updated the task description. (Show Details)

Change 506337 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/MobileFrontend@master] Swap Hogan for Mustache

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

Change 506338 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/skins/MinervaNeue@master] Minerva is Hogan free

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

I downloaded both patches, on pretty clean MediaWiki instance I immediately get warning Use of "compile" is deprecated. Hogan compiler renders templates as Mustache. Use the mustache compiler directly and confirm your template is compatible.

I downloaded both patches, on pretty clean MediaWiki instance I immediately get warning Use of "compile" is deprecated. Hogan compiler renders templates as Mustache. Use the mustache compiler directly and confirm your template is compatible.

Fixed in https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/MobileFrontend/+/506337/5..6/src/mediawiki.template.hogan/mediawiki.template.hogan.js,unified

As discussed this is dead code (and removed in https://gerrit.wikimedia.org/r/507621). Not blocking this change.

Change 506337 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Swap Hogan for Mustache

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

Change 506338 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Minerva is Hogan free

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

Jdlrobson added a subscriber: alexhollender_WMF.

Please test on https://en.m.wikipedia.beta.wmflabs.org - specifically we're looking for any UI regressions compared with production (cc @alexhollender )

@Jdlrobson I think we've discussed potential issues with such broad QA asks like this in the past. Is there any way to provide some clues as to what might be off as a result of this change?

In T220620#5151605, @alexhollender wrote:

@Jdlrobson I think we've discussed potential issues with such broad QA asks like this in the past. Is there any way to provide some clues as to what might be off as a result of this change?

I think the risk of any issue is low and if there is an issue it should be obvious and visual (A made-up example might be "when I clicking search and search, the search results are not displaying!"). Templates are used in all our JavaScript based experiences, so we should test all workflows such as editing, viewing languages, talk, searching and checking they still work (which I've done myself). That should be sufficient. The browser tests have also already given us a strong indication that things are working.

Apologies for the delay here, not sure if this is still needed but everything looks good on both iOS and Android.

In beta ensure the back to top feature is still rendering and matches production
Make sure the main menu rendering matches production
Make sure the page issues overlay rendering matches production
Make sure the notification badge (top right corner in LTR mode) is still rendering and matches production.
Edtadros subscribed.

Test Result

Status: Not Complete
OS: macOS Mojave
Browser: Chrome
Device: BrowserStack - Galaxy S5

Test Artifact(s):

❓ AC1: In beta ensure the back to top feature is still rendering and matches production (Android only)
@alexhollender I was able to get the back to top overlay in beta but not in production.

Screen Shot 2019-05-08 at 2.13.02 AM.png (1×610 px, 556 KB)

✅ AC2: Make sure the main menu rendering matches production

Screen Shot 2019-05-08 at 2.14.26 AM.png (1×624 px, 457 KB)

Screen Shot 2019-05-08 at 2.25.23 AM.png (1×638 px, 526 KB)

❓ AC3: Make sure the page issues overlay rendering matches production
@alexhollender how do I get the page issues overlay to render?

✅ AC4: Make sure the notification badge (top right corner in LTR mode) is still rendering and matches production.

Screen Shot 2019-05-08 at 2.29.11 AM.png (1×633 px, 594 KB)

Screen Shot 2019-05-08 at 2.33.07 AM.png (1×620 px, 594 KB)

@Jdlrobson, that helped. And neat phab link!

Test Result

Status: ✅ PASS
OS: macOS Mojave
Browser: Chrome
Device: BrowserStack - Galaxy S5

Test Artifact(s):

✅ AC1: In beta ensure the back to top feature is still rendering and matches production (Android only)

Screen Shot 2019-05-08 at 2.13.02 AM.png (1×610 px, 556 KB)

Screen Shot 2019-05-08 at 4.00.14 PM.png (1×655 px, 682 KB)

✅ AC3: Make sure the page issues overlay rendering matches production

Screen Shot 2019-05-08 at 4.10.17 PM.png (1×666 px, 567 KB)

Screen Shot 2019-05-08 at 4.09.14 PM.png (1×645 px, 556 KB)

Hogan is no more 🦑🦑🦑🐳🎉🎉🎉