Page MenuHomePhabricator

ORES Extension master branch is failing tests
Open, Needs TriagePublicBUG REPORT

Description

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

In latest mediawiki docker, with latest ORES enabled:

  • simply run docker compose exec mediawiki composer phpunit:entrypoint -- --filter "ORES"

In CI:

  • Create any change (it can be just a comment) to ores ( or an extension that runs ores in its ci jobs ) and submit it it for review

What happens?:
PHP unit fails with errors in:

  • CI
  • Vanilla MediaWiki-Docker
  • MediaWiki-Docker with $wgOresModels defined in LocalSettings.php

What should have happened instead?:
PHP unit tests should pass:

  • CI - gerrit:955959
  • Vanilla MediaWiki-Docker - gerrit:955959
  • Fully configured MediaWiki-Docker with PageTriage (and other extensions) and mariadb backend

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):
Defining $wgOresModels differently from defaults:
https://www.mediawiki.org/wiki/Extension:ORES#Config_variables
results in errors.

> phpunit '-c' 'tests/phpunit/suite.xml' '--filter' 'ORES'
[...]
1) ORES\Tests\FetchScoreJobTest::testRun
InvalidArgumentException: No model available for [articlequality]

/var/www/html/w/extensions/ORES/includes/Storage/HashModelLookup.php:40
/var/www/html/w/extensions/ORES/includes/Storage/SqlScoreStorage.php:172
/var/www/html/w/extensions/ORES/includes/Storage/SqlScoreStorage.php:111
/var/www/html/w/extensions/ORES/includes/Services/FetchScoreJob.php:98
/var/www/html/w/extensions/ORES/tests/phpunit/includes/Services/FetchScoreJobTest.php:108
=== Logs generated by test case
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"HashBagOStuff"}
[ORES] [info] Fetching scores for revision {"revid":17,"models":["damaging","goodfaith"],"precache":true,"namespace":0,"title":"","requestId":"7ca6835816183499c0b0a663"} []
===

2) ORES\Tests\PopulatedSqlModelLookupTest::testGetModelVersionSql
InvalidArgumentException: No model available for [damaging]

/var/www/html/w/extensions/ORES/includes/Storage/SqlModelLookup.php:58
/var/www/html/w/extensions/ORES/includes/Services/PopulatedSqlModelLookup.php:126
/var/www/html/w/extensions/ORES/tests/phpunit/includes/Services/PopulatedSqlModelLookupTest.php:144

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 955947 had a related patch set uploaded (by Jsn.sherman; author: Jsn.sherman):

[mediawiki/extensions/ORES@master] DO NOT MERGE - CI TEST

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

Looping in listed former maintainer @Ladsgroup: I'm really not sure what to do about this, but it's blocking builds for PageTriage.

Change 955959 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/extensions/ORES@master] Avoid hard-coding non-deterministic revision id in tests

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

I made a patch that according to my localhost fixes the issue. Just want to say while I'm one of the authors of that extension and I'd be more than happy to help on any issues, I'm not a maintainer. I haven't been in ML team for five years now.

I made a patch that according to my localhost fixes the issue. Just want to say while I'm one of the authors of that extension and I'd be more than happy to help on any issues, I'm not a maintainer. I haven't been in ML team for five years now.

Sorry for the mixup, and thanks for the patch! I should have read the team page more closely as the former staff lists on those pages are more prominent than the current team info card.

No worries! The patch is straightforward and jenkins is green. Feel free to +2 it to unblock your team's work.

Change 955959 merged by jenkins-bot:

[mediawiki/extensions/ORES@master] Avoid hard-coding non-deterministic revision id in tests

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

Thanks again for getting us unstuck; this totally solves the issue in ci and in a vanilla mediawiki docker environment. I'm going to update the task description with more specifics and keep this open, as there are some other test problems with my mediawiki-docker environment that uses a mariadb backend and has a bunch of config. I'll happily work up a patch for those tests.

Change 955947 abandoned by Jsn.sherman:

[mediawiki/extensions/ORES@master] DO NOT MERGE - CI TEST

Reason:

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

My next step will be to define the actual default config in LocalSettings.php and simply ignore the documentation for now.

As a starting point, the documented defaults were incomplete (This is now fixed):
https://www.mediawiki.org/wiki/Extension:ORES#Config_variables listed this as the default:

$wgOresModels = [
    'damaging' => [ 'enabled' => true ],
    'goodfaith' => [ 'enabled' => true ],
    'reverted' => [ 'enabled' => true ],
    'wp10' => [ 'enabled' => true ],
];

when the actual default is:

$wgOresModels = [
	'damaging' => [ 'enabled' => true ],
	'goodfaith' => [ 'enabled' => true ],
	'reverted' => [ 'enabled' => false ],
	'articlequality' => [
		'enabled' => false,
		'namespaces' => [ 0 ],
		'cleanParent' => true,
		'keepForever'=> true
	],
	'wp10' => [
		'enabled' => false,
		'namespaces' => [ 0 ],
		'cleanParent' => true,
		'keepForever'=> true
	],
	'draftquality' => [
		'enabled' => false,
		'namespaces' => [ 0 ],
		'types' => [ 1 ],
	],
];

Using the real defaults resolves the test failures. I still need to figure out what part of this is mandatory for tests to pass.

With other models left as above, I can enable reverted and draft quality models with the following config and tests still pass

	reverted' => [ 'enabled' => true ],

[...]

	'draftquality' => [
		'enabled' => false,
		'namespaces' => [ 0 ],
		'types' => [ 1 ],
	],

enabling wp10 or article quality causes test errors
InvalidArgumentException: No model available for [wp10]
InvalidArgumentException: No model available for [articlequality]

I think we just need to update the test setup to configure these models.

So that approach fixed one specific problem, but changing my settings can still break things. I think the real problem is that tests are using the models configured in LocalSettings in the first place.

Change 957970 had a related patch set uploaded (by Jsn.sherman; author: Jsn.sherman):

[mediawiki/extensions/ORES@master] Don't use live configuration

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

Tested today on master branch. MW Docker + MariaDB. I'm using the recommended config for testing PageTriage:

$wgOresWikiId = 'enwiki';
$wgOresModels = [
	'articlequality' => [ 'enabled' => true, 'namespaces' => [ 0 ], 'cleanParent' => true ],
	'draftquality' => [ 'enabled' => true, 'namespaces' => [ 0 ], 'types' => [ 1 ] ]
];

2 errors, 10 failures.

image.png (328×1 px, 33 KB)

Jason's patch above gets us down to 1 error, 1 failure. I recommend a follow up patch for that.

image.png (1×1 px, 83 KB)

Change 957970 merged by jenkins-bot:

[mediawiki/extensions/ORES@master] Don't use live configuration

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