Page MenuHomePhabricator

npm install run twice for core
Closed, ResolvedPublic

Description

Looking at https://integration.wikimedia.org/ci/job/quibble-for-mediawiki-core-browser-tests-only-vendor-mysql-php83/5642/console it seems like we run npm install twice for mediawiki/core:

npm install in /workspace/src
00:01:07.806 DEBUG:quibble.util:Waiting for Post-dependency install, pre-database dependent steps: 20s elapsed, 1/2 completed
00:01:10.135 INFO:quibble.commands:>>> Start: npm install in /workspace/src
...00:01:10.136 added 1718 packages, and audited 1720 packages in 22s
...
00:01:10.140 * npm install in /workspace/src, in 22.366 s

And then another time:

00:01:10.153 INFO:quibble.commands:>>> Start: Browser tests: mediawiki/core, mediawiki/skins/Vector, mediawiki/vendor
00:01:33.047 added 1718 packages, and audited 1720 packages in 23s

I wonder if it's a bug or a feature? Maybe there could be a way to avoid it and speed up the core job by 20 seconds?

Event Timeline

That is for a change in mediawiki/core which runs browser tests.

The first npm install is for running npm run test which runs the linter which don't even run since the job does quibble --run selenium.

The reason is Quibble runs the installation of MediaWiki and the npm install for linters in parallel as part of the same stage. https://gerrit.wikimedia.org/r/c/integration/quibble/+/757411 . That can surely be optimized (skip installing deps for linter when we know we are not going to run them). Note how we also install the composer dev dependencies (which I believe is done for linters/phpunit etc) even though we know we are not going to need it (--run selenium).

The logic is in build_execution_plan() https://gerrit.wikimedia.org/g/integration/quibble/+/refs/heads/master/quibble/cmd.py#193, which is a bunch of if/else to append steps to plan. So some more cases can be added there maybe. Ideally we would have some kind of dependency system between stages so that when one asks for --run selenium that would add to the build plan the npm install step, that would need some overhaul of the code.

Change #1249093 had a related patch set uploaded (by Phedenskog; author: Phedenskog):

[integration/quibble@master] selenium: Add run selenium test plan

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

Change #1249226 had a related patch set uploaded (by Phedenskog; author: Phedenskog):

[integration/quibble@master] Skip NpmInstall for core when not needed

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

Change #1249093 merged by jenkins-bot:

[integration/quibble@master] selenium: Add run selenium test plan

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

Change #1249226 merged by jenkins-bot:

[integration/quibble@master] browser-tests: Skip extra npm install for core tests

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

Change #1269507 had a related patch set uploaded (by Phedenskog; author: Phedenskog):

[integration/quibble@master] api-testing: Make sure npm install runs for api-testing

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

Change #1269507 merged by jenkins-bot:

[integration/quibble@master] api-testing: Make sure npm install runs for api-testing

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

Mentioned in SAL (#wikimedia-releng) [2026-04-10T10:21:59Z] <hashar> Updated apitesting job to Quibble 1.17.1 # T422843 T418743