Page MenuHomePhabricator

UploadWizard structure tests fail when EventLogging is not loaded
Closed, ResolvedPublic

Description

When running structure tests for UploadWizard , tests fail due to lack of the MediaWiki-extensions-EventLogging extension:

1) ContentHandlerFunctionalTest::testMakeEmptyContent
Error: Class "MediaWiki\Extension\EventLogging\EventLogging" not found

extensions/UploadWizard/includes/CampaignContent.php:59
extensions/UploadWizard/includes/CampaignContent.php:67
core/tests/phpunit/structure/ContentHandlerFunctionalTest.php:43
2) ContentHandlerFunctionalTest::testGetParserOutput
Error: Class "MediaWiki\Extension\EventLogging\EventLogging" not found

extensions/UploadWizard/includes/CampaignContent.php:59
extensions/UploadWizard/includes/CampaignContent.php:67
core/includes/Parser/ParserObserver.php:54
core/includes/Content/ContentHandler.php:1581
core/tests/phpunit/structure/ContentHandlerFunctionalTest.php:67
3) ContentHandlerFunctionalTest::testPreSaveTransform
Error: Class "MediaWiki\Extension\EventLogging\EventLogging" not found

extensions/UploadWizard/includes/CampaignContent.php:59
extensions/UploadWizard/includes/CampaignContent.php:67
core/includes/Content/JsonContentHandler.php:99
core/tests/phpunit/structure/ContentHandlerFunctionalTest.php:91

https://www.mediawiki.org/wiki/Extension:UploadWizard states:

You should also install the EventLogging extension.

This is used only if you use the campaigns feature, and should be made a soft dependency at some point in the future.

Surely if I remove the content handler in extension.json:

{
    "ContentHandlers": { 
        "Campaign": "MediaWiki\\Extension\\UploadWizard\\CampaignContentHandler"
    },
}

The tests pass since the content handler no more exists. Maybe it could be registered solely when EventLogging is present.

Related Objects

StatusSubtypeAssignedTask
OpenNone
OpenNone
Openhashar
Openhashar
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
Resolvedhashar
Openhashar
Openhashar
Resolvedhashar
ResolvedDAlangi_WMF
Resolvedmszwarc
Resolvedhashar
Resolvedhashar
ResolvedAmmarpad

Event Timeline

Change #1214625 had a related patch set uploaded (by Hashar; author: Hashar):

[mediawiki/extensions/UploadWizard@master] Only register content handler when EventLogging is loaded

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

UploadWizard uses EventLogging to validate content on a wiki page against a schema. The Experiment Platform team would very much prefer this not to be the case (see T317793: [EPIC] Deprecate EventLogging::schemaValidate()). I would be happy to work with the maintainers of the extension to use the justinrainbow/json-schema or opis/json-schema libraries for this, both of which are used in production.

@phuedx UploadWizard does not have a maintainer anymore after the Structured Content team has been disbanded. Your team might want to handle the removal of EventLogging:schemaValidate() ;)

Change #1214625 abandoned by Hashar:

[mediawiki/extensions/UploadWizard@master] Only register content handler when EventLogging is loaded

Reason:

Sam Smith mentioned we should instead remove `EventLogging:schemaValidate()` T411660#11436326. That is tracked by the epic T317793

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

Change #1224684 had a related patch set uploaded (by Hashar; author: Hashar):

[integration/config@master] Zuul: [UploadWizard] disable recursion

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

Change #1224684 merged by jenkins-bot:

[integration/config@master] Zuul: [UploadWizard] disable recursion

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

hashar claimed this task.

The UploadWizard tests failed for EncryptedUploads and PronunciationRecording. They both depend on UploadWizard but did not have EventLogging injected.

Short of making the tests skippable, I have simply added EventLogging as a dependency to both EncryptedUploads and PronunciationRecording. I have confirmed the CI jobs pass as a result which resolves this task.

EventLogging:schemaValidate() should still be removed, that should be a new sub task of T317793 😉