Page MenuHomePhabricator

extension.json schema validation
Closed, ResolvedPublic

Description

So, because I'm daft, I only had converted TorBlock to using manifest version 2 in https://gerrit.wikimedia.org/r/#/c/213314/

Jenkins happily let me merge it etc, but because the config wasn't version 2, this causes a spew of errors

PHP Notice:  Undefined index: value in /var/www/wiki/mediawiki/core/includes/registration/ExtensionProcessor.php on line 394
PHP Stack trace:
PHP   1. {main}() /var/www/wiki/mediawiki/core/maintenance/eval.php:0
PHP   2. require_once() /var/www/wiki/mediawiki/core/maintenance/eval.php:36
PHP   3. require() /var/www/wiki/mediawiki/core/maintenance/commandLine.inc:72
PHP   4. require_once() /var/www/wiki/mediawiki/core/maintenance/doMaintenance.php:97
PHP   5. ExtensionRegistry->loadFromQueue() /var/www/wiki/mediawiki/core/includes/Setup.php:40
PHP   6. ExtensionRegistry->readFromQueue() /var/www/wiki/mediawiki/core/includes/registration/ExtensionRegistry.php:137
PHP   7. ExtensionProcessor->extractInfo() /var/www/wiki/mediawiki/core/includes/registration/ExtensionRegistry.php:216
PHP   8. ExtensionProcessor->extractConfig2() /var/www/wiki/mediawiki/core/includes/registration/ExtensionProcessor.php:167

Notice: Undefined index: value in /var/www/wiki/mediawiki/core/includes/registration/ExtensionProcessor.php on line 394

Call Stack:
    0.0008     360840   1. {main}() /var/www/wiki/mediawiki/core/maintenance/eval.php:0
    0.0011     367312   2. require_once('/var/www/wiki/mediawiki/core/maintenance/commandLine.inc') /var/www/wiki/mediawiki/core/maintenance/eval.php:36
    0.0060     597104   3. require('/var/www/wiki/mediawiki/core/maintenance/doMaintenance.php') /var/www/wiki/mediawiki/core/maintenance/commandLine.inc:72
    0.0796    3547272   4. require_once('/var/www/wiki/mediawiki/core/includes/Setup.php') /var/www/wiki/mediawiki/core/maintenance/doMaintenance.php:97
    0.0816    3617840   5. ExtensionRegistry->loadFromQueue() /var/www/wiki/mediawiki/core/includes/Setup.php:40
    0.0850    3707776   6. ExtensionRegistry->readFromQueue() /var/www/wiki/mediawiki/core/includes/registration/ExtensionRegistry.php:137
    0.1105    4689048   7. ExtensionProcessor->extractInfo() /var/www/wiki/mediawiki/core/includes/registration/ExtensionRegistry.php:216
    0.1105    4689144   8. ExtensionProcessor->extractConfig2() /var/www/wiki/mediawiki/core/includes/registration/ExtensionProcessor.php:167

This was fixed in https://gerrit.wikimedia.org/r/#/c/300909/

But jenkins really should've rejected this... And maybe MW itself too, rather than all the unidefined indexes?

Event Timeline

Reedy created this task.Jul 25 2016, 6:21 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 25 2016, 6:21 PM
hashar added a subscriber: hashar.Jul 25 2016, 7:28 PM

Is the issue that nothing validate the schema of extension.json? If such a thing, it should be run via the MediaWiki core structure testsuite which runs on all extensions.

For the CI configuration itself there is not much we can do.

Reedy added a comment.EditedJul 25 2016, 7:44 PM
[20:29:35] <hasharAway> Reedy: is there something to validate extension.json / skin.json files ?
[20:29:45] <Reedy> Not sure really
[20:29:50] <Reedy> We check its valid json
[20:30:00] <Reedy> Lego has written schema files
[20:30:14] <James_F> I thought we did validate the schema?
[20:30:32] <Reedy> It might not work fully for v2
[20:30:46] <Reedy> As it let me submit something that didn't validate to v2
[20:30:58] <James_F> Ah.
[20:31:04] <hashar> given TorBlock managed to sneak in an invalid schema...
[20:31:09] <James_F> I2fd1caaa50c288821ab6847dc29d60e6554d9df5
[20:31:10] <James_F> Yeah.
[20:31:11] <Reedy> Maybe the file used by CI just needs a bump
[20:31:21] <Reedy> File name that is
[20:31:26] <Reedy> Wait
[20:31:38] <Reedy> No, no version number file name is newest
[20:31:47] <hashar> CI is really lame
[20:31:47] <Reedy> Older are copied to version numbers
[20:31:58] -*- James_F nods.
[20:32:04] <Reedy> There's something askew anyway
[20:32:10] <hashar> beside cloning/setting up the patches, it just run something like   cd tests/phpunit ;  php phpunit.php --testsuite extensions
[20:32:11] <hashar> afaik
[20:32:15] <James_F> So it's more "something doesn't work in the existing validation" than "there is none".
[20:32:22] <Reedy> Should be an easy fix
[20:32:30] <Reedy> I think. But I'm not sure
[20:32:31] <James_F> Or a really hard to spot subtle bug.
[20:32:47] <Reedy> I guess I made a test case :p
[20:32:53] <Reedy> Hmm
[20:33:10] <Reedy> Does Jenkins automatically use extension.json if it exists?
[20:33:19] <Reedy> And hence, know to validate if

Eh wtf. Is ExtensionJsonValidationTest not running? It's a structure test which was written for this exact purpose.

Legoktm triaged this task as Unbreak Now! priority.Jul 25 2016, 9:14 PM
Restricted Application added subscribers: Luke081515, TerraCodes. · View Herald TranscriptJul 25 2016, 9:14 PM
Reedy added a comment.EditedJul 25 2016, 9:17 PM

15:36:58 Warning: in_array() expects parameter 2 to be an array or collection in /mnt/jenkins-workspace/workspace/mwext-testextension-hhvm/src/extensions/TorBlock/includes/TorBlockHooks.php on line 46

		if ( $action !== null && in_array( $action, $wgTorAllowedActions ) ) {
			return true;
		}

I presume that's related to the problem, but not enough to surface it?

Legoktm claimed this task.

This is an issue with unit test. Debugging right now.

Okay, it was actually an issue with the schema. Patch incoming. Also my MassMessage test case of https://gerrit.wikimedia.org/r/301004 was flawed in that the unit test requires the "name" field to work, which happened to be the one I made not validate. I'll file a different bug for that.

Change 301017 had a related patch set uploaded (by Legoktm):
registration: Fix "config" schema validation

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

Change 301017 merged by jenkins-bot:
registration: Fix "config" schema validation

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

Legoktm closed this task as Resolved.Jul 25 2016, 11:45 PM