Page MenuHomePhabricator

Use ES6 classes inside MobileFrontend
Closed, ResolvedPublic1 Estimated Story Points

Assigned To
Authored By
Jdlrobson
Nov 19 2024, 6:29 PM
Referenced Files
F57798892: screenshot 51.mov.gif
Dec 11 2024, 11:59 AM
F57798874: screenshot 49.mov.gif
Dec 11 2024, 11:59 AM
F57798865: screenshot 48.mov.gif
Dec 11 2024, 11:59 AM
F57798864: screenshot 47.mov.gif
Dec 11 2024, 11:59 AM
F57798845: screenshot 46.mov.gif
Dec 11 2024, 11:59 AM
F57798842: screenshot 45.mov.gif
Dec 11 2024, 11:59 AM
F57798834: screenshot 44.mov.gif
Dec 11 2024, 11:59 AM
F57798824: screenshot 43.mov.gif
Dec 11 2024, 11:59 AM

Description

Background

One of the motivators of moving MobileFrontend off webpack is to make use of ES6 classes without Webpack transpiling that code to ES5. This would also allow us to remove the dependency on OOjs and the mfExtend utility function for class inheritance.

This will reduce the code we ship to end users and make the code easier to read and maintain.

User story

  • Add user story in the format: “As a [persona], I want to [X], so that [Y]”

Requirements

Replace the use of OOjs and the mfExtend utility function for class inheritance in MobileFrontend with ES6 classes. This change should reduce the code footprint shipped to end users and improve code readability and maintainability without relying on Webpack transpilation.

BDD

Feature: ES6 Class Implementation in MobileFrontend  

  Scenario: Verify MobileFrontend functionality after migration to ES6 classes  
    Given I am a user on the mobile site  
    When I perform key workflows  
    Then all workflows should function correctly without errors in the JS console

Test Steps

Test Case 1: Verify MobileFrontend Functionality with ES6 Classes

  1. Navigate to the mobile version of the site (e.g., https://en.m.wikipedia.org).
  2. Perform the following workflows:

• Edit a page.
• Select a language.
• Search for a term using the search bar.
• Collapse and expand sections on a page.
• Click on an image to view the Media Viewer.
• Click the watchstar (as both anonymous and logged-in users).
• View the Settings page.
• Check Notifications.

  1. Open the browser’s developer console during each workflow.
  2. AC1: Ensure no JavaScript errors are present in the console during any of the workflows.
  3. AC2: Verify all workflows function correctly without regressions.

Design

  • Add mockups and design requirements

Acceptance criteria

  • Migrate mobile.editor.overlay to ES6 classes
  • Migrate other modules to use ES6 classes
  • Make sure mfExtend method is removed from MobileFrontend.

Communication criteria - does this need an announcement or discussion?

  • Add communication criteria

Rollback plan

  • What is the rollback plan in production for this task if something goes wrong?

Potential impact to Growth, Minerva and ExternalGuidance. Given the extended testing period there should be unlikely to be any serious issues in production on key products, but if those are found there are two options

  1. Preferably patch the broken extension. Switching ES5 functions to ES6 classes should be relatively straightforward (VisualCodeStudio has a macro for this)
  2. If needed (e.g. issues of a similar nature to T381496) you can safely cherry pick https://gerrit.wikimedia.org/r/c/mediawiki/extensions/MobileFrontend/+/1100873 to wmf.8 until the broken feature is patched.

This task was created by Version 1.2.0 of the Web team task template using phabulous

Event Timeline

Change #1004296 had a related patch set uploaded (by Jdlrobson; author: Simon04):

[mediawiki/extensions/MobileFrontend@master] Use ES6 classes in MobileFrontend

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

Change #1092891 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/MobileFrontend@master] Use ES6 classes in mobile editor overlay

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

Jdlrobson triaged this task as Medium priority.Nov 19 2024, 10:41 PM
Jdlrobson added a project: Web-Team.
Jdlrobson lowered the priority of this task from Medium to Low.Dec 2 2024, 6:58 PM
Jdlrobson set the point value for this task to 1.
Jdlrobson moved this task from Incoming to Sprint Backlog on the Web-Team board.

Marking as 1 for remaining work and pulling in in case we have scope to work on this. We can revert the patch in event of any issues.

Change #1092891 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Use ES6 classes in mobile editor overlay

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

Change #1004296 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Use ES6 classes in MobileFrontend

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

Jdlrobson added a subscriber: bwang.

Hi Edward, this one can likely skip QA in production, so tag verified when you have taken a look.
For QA this would benefit from exploratory testing on mobile site only - go through all the workflows: editing a page, selecting a language, searching, collapsing sections, clicking an image, clicking watchstar (anon and logged in users) , viewing settings, notifications and and let us know if there are any errors in the JS console. You can timebox this, we can also rely on tooling to find these errors over the next week (logstash for example).

If you can pass back to me when you've done exploratory testing.

Change #1100446 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/MobileFrontend@master] Revert "Use ES6 classes in MobileFrontend"

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

Change #1100485 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/MobileFrontend@master] Add ES5 compatibility layer

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

Change #1100485 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Add ES5 compatibility layer

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

Change #1100564 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/MinervaNeue@master] Migrate page issue overlay to ES6 to fix display

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

Change #1100564 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@master] Migrate page issue overlay to ES6 to fix display

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

Jdlrobson updated the task description. (Show Details)

Change #1100874 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/MobileFrontend@master] tagName can be overriden by option

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

Change #1100446 abandoned by Urbanecm:

[mediawiki/extensions/MobileFrontend@master] Revert "Use ES6 classes in MobileFrontend"

Reason:

fixing rather than reverting is always good

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

Test Result - Beta

Status: ✅ PASS / ❌ FAIL
Environment:
OS: macOS
Browser: Chrome
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Verify MobileFrontend Functionality with ES6 Classes

  1. Navigate to the mobile version of the site (e.g., https://en.m.wikipedia.org).
  2. Perform the following workflows:
    • Edit a page.
    • Select a language.
    • Search for a term using the search bar.
    • Collapse and expand sections on a page.
    • Click on an image to view the Media Viewer.
    • Click the watchstar (as both anonymous and logged-in users).
    • View the Settings page.
    • Check Notifications.
  3. Open the browser’s developer console during each workflow.
  4. AC1: Ensure no JavaScript errors are present in the console during any of the workflows.
  5. AC2: Verify all workflows function correctly without regressions.
StatusWorkflowScreen Recording
Edit a page
screenshot 39.mov.gif (1,106×1,330 px, 1 MB)
Select a language
screenshot 41.mov.gif (1,106×1,330 px, 850 KB)
Search for a term using the search bar
screenshot 42.mov.gif (1,106×1,330 px, 1 MB)
Collapse and expand sections on a page
screenshot 43.mov.gif (1,106×1,330 px, 1 MB)
Click on an image to view the Media Viewer
screenshot 44.mov.gif (1,106×1,330 px, 1 MB)
Click the watchstar (as both anonymous and logged-in users)
screenshot 45.mov.gif (1,106×1,330 px, 963 KB)
screenshot 46.mov.gif (1,106×1,330 px, 1 MB)
View the Settings page
screenshot 47.mov.gif (1,106×1,330 px, 566 KB)
screenshot 48.mov.gif (1,106×1,330 px, 927 KB)
Check Notifications
screenshot 49.mov.gif (1,106×1,330 px, 2 MB)
Logging In
screenshot 51.mov.gif (1,106×1,330 px, 500 KB)

@Jdlrobson, I added logging in because during testing I noticed the error. It wasn't in your original list of workflows so I wasn't sure if it was in scope for this test. This is the error text for logging in:

Main_Page:452 Refused to load the image 'https://pl.m.wikivoyage.beta.wmcloud.org/wiki/Special:CentralAutoLogin/start?type=1x1&from=enwiki&usesul3=0' because it violates the following Content Security Policy directive: "default-src 'self' data: blob: https://upload.wikimedia.beta.wmflabs.org upload.wikimedia.beta.wmflabs.org https://commons.wikimedia.beta.wmflabs.org https://upload.wikimedia.org https://commons.wikimedia.org meta.wikimedia.beta.wmflabs.org *.wikimedia.beta.wmflabs.org *.wikipedia.beta.wmflabs.org *.wikinews.beta.wmflabs.org *.wiktionary.beta.wmflabs.org *.wikibooks.beta.wmflabs.org *.wikiversity.beta.wmflabs.org *.wikisource.beta.wmflabs.org *.wikiquote.beta.wmflabs.org wikidata.beta.wmflabs.org m.wikidata.beta.wmflabs.org *.wikivoyage.beta.wmflabs.org *.mediawiki.beta.wmflabs.org wikifunctions.beta.wmflabs.org m.wikifunctions.beta.wmflabs.org *.wikimedia.org *.wikipedia.org *.wikinews.org *.wiktionary.org *.wikibooks.org *.wikiversity.org *.wikisource.org wikisource.org *.wikiquote.org *.wikidata.org *.wikifunctions.org *.wikivoyage.org *.mediawiki.org ws://visualeditor-realtime.wmflabs.org cxserver-beta.wmcloud.org recommend.wmflabs.org *.wikipedia.beta.wmcloud.org wikimedia.org". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback.

@Jdlrobson, I added logging in because during testing I noticed the error. It wasn't in your original list of workflows so I wasn't sure if it was in scope for this test. This is the error text for logging in:

This one is not in scope. Probably worth create a new ticket for this as part of signoff tagged MediaWiki-extensions-CentralAuth

@Jdlrobson - which team would the follow-up ticket be for?

Change #1100874 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] tagName can be overriden by option

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

Check in with mediawiki-engineering for follow-up ticket. Start a thread.

Move to new year sprint.

@KSarabia-WMF - Make a note about this

The one issue is not part of the scope.

I looked a bit more closely at the error and it relates to beta cluster which has no owner. Don't think we need to open a ticket.