Page MenuHomePhabricator

WikibaseLexeme's PHPunit test failing on Jenkins due to autoloading issues
Closed, ResolvedPublic

Description

WikibaseLexeme uses PHP implementation of Eris library for property-based testing.

The library is not part of mediawiki/core's dev dependencies. It is only defined in the extension's composer.json.

On Jenkins CI, we run PHPUnit test using the composer-flavoured version of the job, i.e. in my understanding composer install is being also run in the extension's directory (this seems to happen looking at job logs), and thanks to "load_composer_autoloader" set to true in extension.json, extension's autoload data is picked up by mediawiki.

Until Friday May 25th phpunit jobs seemed to be running just fine, see https://gerrit.wikimedia.org/r/#/c/435131/1, and https://integration.wikimedia.org/ci/job/mwext-testextension-hhvm-composer-jessie/14002/console.
For some reason since yesterday all phpunit job on this extension are failing due to autoloading issue, see e.g. the same patch https://integration.wikimedia.org/ci/job/mwext-testextension-hhvm-composer-jessie/14002/console, and: https://integration.wikimedia.org/ci/job/mwext-testextension-hhvm-composer-jessie/14073/console.
The issue does not seem to be hhvm-specific: https://integration.wikimedia.org/ci/job/mwext-testextension-php70-composer-jessie/684/console.

The main suspect is currently some recent changes in mediawiki's autoloading, but I didn't really find any significant changes made there over the weekend.

Attempt to explicitly defined the autoload namespace for the library didn't seem to help in any way, see: https://gerrit.wikimedia.org/r/#/c/435758/5/extension.json.

Any help would be appreciated. I assume adding the library to mediawiki/core's dev dependencies would help but that 1) seems a bit backwards, 2) does not explain why the autoloading issues suddenly popped up.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 29 2018, 10:38 AM

My current guess is it might be related to mediawiki core's AutoLoaderStructureTest. When running it with WikibaseLexeme enabled, but CirrusSearch not enabled, I get errors saying PHP Fatal error: Interface 'CirrusSearch\Search\ResultsType' not found in /var/www/mediawiki/extensions/WikibaseLexeme/src/Search/FormTermResult.php on line 21 which the same kind of errors CI says about Eris\Generators.

Just a note: I could not reproduce with Quibble due to PropertySuggester failling to find a class (which is T195783).
Even a dummy change fails such as: https://gerrit.wikimedia.org/r/#/c/435980/ so probably something changed in mediawiki/core at some point.

We would need to reproduce locally and bisect to find the root cause.

Change 436016 had a related patch set uploaded (by WMDE-leszek; owner: WMDE-leszek):
[mediawiki/extensions/WikibaseLexeme@master] Removed AutoloadNamespaces from extension.json, use composer.json

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

So looks like WikibaseLexeme was using AutoloadNamespaces setting in extension.json wrong, and that lead to issues. Sorry for the noise!

Change 436078 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/core@master] Don't autoload classes in AutoloadStructureTest

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

Change 436078 merged by jenkins-bot:
[mediawiki/core@master] Don't autoload classes in AutoloadStructureTest

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

Change 436229 had a related patch set uploaded (by WMDE-leszek; owner: WMDE-leszek):
[mediawiki/extensions/WikibaseLexeme@master] Adjusted namespaces and files names to be PSR-4-complient

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

Change 436229 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Adjusted namespaces and files names to be PSR-4-compliant

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

Change 436016 abandoned by WMDE-leszek:
Removed AutoloadNamespaces from extension.json, use composer.json

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

WMDE-leszek closed this task as Resolved.May 30 2018, 10:28 AM
WMDE-leszek claimed this task.

We're green again. Thanks a lot @Legoktm and @hashar for help!

Vvjjkkii renamed this task from WikibaseLexeme's PHPunit test failing on Jenkins due to autoloading issues to s3baaaaaaa.Jul 1 2018, 1:07 AM
Vvjjkkii reopened this task as Open.
Vvjjkkii removed WMDE-leszek as the assignee of this task.
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed subscribers: gerritbot, Aklapper.
thcipriani renamed this task from s3baaaaaaa to WikibaseLexeme's PHPunit test failing on Jenkins due to autoloading issues.Jul 1 2018, 7:33 PM
thcipriani closed this task as Resolved.
thcipriani assigned this task to WMDE-leszek.
thcipriani updated the task description. (Show Details)
CommunityTechBot raised the priority of this task from High to Needs Triage.Jul 5 2018, 6:55 PM