Page MenuHomePhabricator

[Regression] JS error on page load on create account page
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:
Error in JS console

load.php?lang=en&modules=startup&only=scripts&raw=1&safemode=1&skin=minerva:3 Error: Cannot require undefined file includes/Skins/ToggleList/ToggleList.js
    at require (load.php?lang=en&modules=startup&only=scripts&raw=1&safemode=1&skin=minerva:8:700)
    at Toolbar.js (Toolbar.js:3:15)
    at require (load.php?lang=en&modules=startup&only=scripts&raw=1&safemode=1&skin=minerva:8:864)
    at module.exports (initMobile.js:18:13)
    at init (setup.js:28:31)
    at setup.js (setup.js:50:2)
    at runScript (load.php?lang=en&modules=startup&only=scripts&raw=1&safemode=1&skin=minerva:11:821)
    at Array.<anonymous> (load.php?lang=en&modules=startup&only=scripts&raw=1&safemode=1&skin=minerva:12:576)
    at flushCssBuffer (load.php?lang=en&modules=startup&only=scripts&raw=1&safemode=1&skin=minerva:4:399)

What should have happened instead?:
No error.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Requirement

The Special:CreateAccount page on the Minerva skin should load without any JavaScript errors in the console.

BDD

Feature: Ensure No JavaScript Errors on Create Account Page

  Scenario: No JS error on page load in Minerva skin
    Given the user visits the Special:CreateAccount page on mobile
    When the page loads
    Then no JavaScript errors should appear in the console

Test Steps

Test Case 1: Verify No JavaScript Errors on Create Account Page

  1. Visit Special:CreateAccount on Beta using the Minerva skin.
  2. Open the browser's developer console.
  3. AC1: Confirm that no JavaScript errors are logged in the console.

QA Results - Beta

ACStatusDetails
1T373482#10098566

QA Results - PROD

ACStatusDetails
1T373482#10135809

Event Timeline

Jdlrobson renamed this task from JS error on page load on create account page to [Regression] JS error on page load on create account page.Aug 27 2024, 8:04 PM
Jdlrobson triaged this task as High priority.
Jdlrobson added a project: Regression.

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

[mediawiki/skins/MinervaNeue@master] Revert "tests: Adopt private require() for skins.minerva.scripts"

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

Jdlrobson raised the priority of this task from High to Unbreak Now!.Aug 27 2024, 8:21 PM

Apparently this made it into production, so cautiously marking as deployment blocker until we can assess impact more.

Change #1067417 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@master] Revert "tests: Adopt private require() for skins.minerva.scripts"

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

Jdlrobson lowered the priority of this task from Unbreak Now! to Low.Aug 27 2024, 9:59 PM
Jdlrobson moved this task from Doing to QA on the Web-Team-Backlog (FY2024-25 Q1 Sprint 4) board.

There as a a bit of a mix up on our part, and luckily this didn't make it into 1.43.0-wmf.20.
Noting that this week there is a similar open bug to this (T373481) which suggests some kind of CI test for this might be helpful.

Edtadros subscribed.

Test Result - Beta

Status: ✅ PASS
Environment: Beta
OS: macOS
Browser: Chrome
Device: MS
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Verify No JavaScript Errors on Create Account Page

  1. Visit Special:CreateAccount on Beta using the Minerva skin.
  2. Open the browser's developer console.
  3. AC1: Confirm that no JavaScript errors are logged in the console.

screenshot 41.png (968×1 px, 175 KB)

Change #1068119 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/skins/MinervaNeue@master] tests: Adopt private require() for skins.minerva.scripts (take 2)

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

Sorry about this. After fixing T373065, I went to look for path inclusion workarounds like the ones in Minerva, and assumed CI would validate the file references. It did, kind of. Our structure tests validate that all included files exist and can be referenced. It is still up to individual tests to load the code, and thus validate how they're referenced. I made sure the QUnit tests covers all references that my patch changes. In this case, though, the patch indirectly revealed a pre-existing bug in MediaWiki core, triggered by a Minerva file (Toolbar.js) that my patch didn't change, and was not loaded during any of the existing QUnit or Selenium tests.

It may be worth adding a basic test for Toolbar.js at some point, even if only to require the file and assert that it returns an object. That would have sufficed to execute the file and catch the import error.

In any event, great to have uncovered this bug in mw.loader. Now, we can all use ../../ in require() calls.

ResourceLoader patch has been landed at https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1068064.
I've re-submited the test modernisation at https://gerrit.wikimedia.org/r/c/mediawiki/skins/MinervaNeue/+/1068119.

Change #1068119 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@master] tests: Adopt private require() for skins.minerva.scripts (take 2)

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

Test Result - PROD

Status: ✅ PASS
Environment: PROD
OS: macOS 14.6.1
Browser: Chrome 128
Device: MS
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Verify No JavaScript Errors on Create Account Page

  1. Visit Special:CreateAccount on PROD using the Minerva skin.
  2. Open the browser's developer console.
  3. AC1: Confirm that no JavaScript errors are logged in the console.

2024-09-10_13-45-46.png (1×3 px, 302 KB)