Page MenuHomePhabricator

mwext-phpunit-coverage-publish fails for Math
Closed, ResolvedPublic

Description

15:54:44 ......................................................        2067 / 2067 (100%)PHP Fatal error:  Uncaught InvalidArgumentException: Key "JobTypeConf" not found in input sources in /workspace/src/includes/config/ServiceOptions.php:60
15:54:44 Stack trace:
15:54:44 #0 /workspace/src/includes/ServiceWiring.php(1027): MediaWiki\Config\ServiceOptions->__construct()
15:54:44 #1 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php(447): Wikimedia\Services\ServiceContainer::{closure}()
15:54:44 #2 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php(411): Wikimedia\Services\ServiceContainer->createService()
15:54:44 #3 /workspace/src/includes/MediaWikiServices.php(356): Wikimedia\Services\ServiceContainer->getService()
15:54:44 #4 /workspace/src/includes/MediaWikiServices.php(1250): MediaWiki\MediaWikiServices->getService()
15:54:44 #5 /workspace/src/includes/ServiceWiring.php(1022): MediaWiki\MediaWikiServices->getJobQueueGroupFactory()
15:54:44 #6 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php(447): Wikimedia\Services\ServiceContainer::{closure}()
15:54:44 #7 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php(411): Wikimedia\Servi in /workspace/src/includes/config/ServiceOptions.php on line 60

Event Timeline

I also saw that when testing with docker T362030. However, I didn't find any match for JobTypeConf in the math extension.

Any idea why this happens? Can that cause that beta won't be updated automatically after merge?

Via local codesearch I only find two parts in the math extension code (I suspect this only happens with Math) that might be related

	/**
	 * MaintenanceRefreshLinksInit handler; optimize settings for refreshLinks batch job.
	 *
	 * @param Maintenance $maint
	 */
	public function onMaintenanceRefreshLinksInit( $maint ) {
		$user = RequestContext::getMain()->getUser();

		// Don't parse LaTeX to improve performance
		$this->userOptionsManager->setOption( $user, 'math', MathConfig::MODE_SOURCE );
	}

I think the modern rendering could be fast enough to drop this. However, there is a risk that it makes some background jobs slower.

Still a problem https://integration.wikimedia.org/ci/job/mwext-phpunit-coverage-publish/51824/console

17:16:19 ..........                                                    3365 / 3365 (100%)
17:16:19 
17:16:19 Detected 4 tests where the duration exceeded the global maximum duration (0.100).
17:16:19 
17:16:19 # Duration Test
17:16:19 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
17:16:19 1    0.470 MathParserIntegrationTest::testParserCacheIntegration
17:16:19 2    0.278 MediaWiki\Extension\Math\Tests\WikiTexVC\AllTest::testRunCases with data set "Big" (array('\big(\big)\big[\big]\big\{\bi...r\uarr', '{\big (}{\big )}{\big [}{\big...rrow }'))
17:16:19 3    0.224 MathParserIntegrationTest::testMathParserOption
17:16:19 4    0.109 MediaWiki\Extension\Math\Tests\PreferencesIntegrationTest::testMathOptionRegistered
17:16:19 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
17:16:19      0.000
17:16:19       └─── secondsKey "JobTypeConf" not found in input sources
17:16:19 + set -e
17:16:19 + '[' -f /workspace/log/junit.xml ']'
17:16:19 + phpunit-junit-edit /workspace/log/junit.xml
17:16:19 Traceback (most recent call last):
17:16:19   File "/usr/local/bin/phpunit-junit-edit", line 66, in <module>
17:16:19     main()
17:16:19   File "/usr/local/bin/phpunit-junit-edit", line 44, in main
17:16:19     tree = etree.parse(args.junit)
17:16:19   File "/usr/lib/python3.9/xml/etree/ElementTree.py", line 1229, in parse
17:16:19     tree.parse(source, parser)
17:16:19   File "/usr/lib/python3.9/xml/etree/ElementTree.py", line 580, in parse
17:16:19     self._root = parser._parse_whole(source)
17:16:19 xml.etree.ElementTree.ParseError: no element found: line 1, column 0

I had the problem before when generating coverage locally. I documented the fix in https://phabricator.wikimedia.org/T378434

Physikerwelt moved this task from Blocked: needs help to Needs clarification on the Math board.

I started looking into it myself and it seems that the error might come from the step that edits the phpunit.xml so even before the problem that is caused by not using the new composer based entry point.

The script in question seems to be https://gerrit.wikimedia.org/r/plugins/gitiles/integration/config/+/deb683f9ac3f052d163881e7f7a55f8b443eb871/dockerfiles/quibble-bullseye-php81-coverage/phpunit-suite-edit.py

I would guess that

/workspace/log/junit.xml

is not a valid xml file. Maybe this warnig

17:08:27 PHP Warning: Undefined array key "\ca" in /workspace/src/extensions/Math/tests/phpunit/integration/WikiTexVC/MMLGenerationTexUtilTest.php on line 195

got into the xml file.

Instead of trying to reproduce it locally, someone with access to /workspace/log/junit.xml on the ci server might be in a better position to solve that.

The junit.xml is in the "build artifact" of the job, reachable from the "status" page of that job

For the last coverage of Math this is https://integration.wikimedia.org/ci/job/mwext-phpunit-coverage-publish/52331/artifact/log/ which shows 0 byte for that file.
The related error in the log is "xml.etree.ElementTree.ParseError: no element found: line 1, column 0", which indicates a empty file as well.
The extra output of php maybe interrupts the writing from coverage.

Unfortunately, this is not related.

Change #1270136 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/Math@master] tests: Move call to markTestSkipped() into setUp()

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

The message "Key "JobTypeConf" not found in input sources" at the end happens because all globals are unset (except php internal one and MediaWikiUnitTestCase::ALLOWED_GLOBALS_LIST)
This seems to happen because some tests extending MediaWikiUnitTestCase skipping from setUpBeforeClass, skipping is an exception, no tear down is called and that brings MediaWikiUnitTestCase into a bad state about the globals.

Change #1270136 merged by jenkins-bot:

[mediawiki/extensions/Math@master] tests: Move call to markTestSkipped() into setUp()

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

Umherirrender claimed this task.

https://doc.wikimedia.org/cover-extensions/Math/

Before:

Generated by php-code-coverage 9.2.32 using PHP 8.1.32 and PHPUnit 9.6.21 at Tue Jul 22 23:16:25 UTC 2025.

After:

Generated by php-code-coverage 9.2.32 using PHP 8.3.30 and PHPUnit 9.6.34 at Sat Apr 11 14:15:12 UTC 2026.