Page MenuHomePhabricator

UnexpectedValueException when looking at a Special:MobileDiff for an EntitySchema Revision
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

Request URL: https://www.wikidata.org/wiki/Special:MobileDiff/951170414
Request ID: XO4GxApAIC8AAEaLNhEAAACM

message
[XO4GxApAIC8AAEaLNhEAAACM] /wiki/Special:MobileDiff/951170414   UnexpectedValueException from line 52 of /srv/mediawiki/php-1.34.0-wmf.6/extensions/EntitySchema/src/MediaWiki/Content/EntitySchemaSlotDiffRenderer.php: Expected a TextSlotDiffRenderer
trace
#0 /srv/mediawiki/php-1.34.0-wmf.6/extensions/EntitySchema/src/MediaWiki/Content/EntitySchemaContentHandler.php(43): EntitySchema\MediaWiki\Content\EntitySchemaSlotDiffRenderer->__construct(RequestContext)
#1 /srv/mediawiki/php-1.34.0-wmf.6/includes/content/ContentHandler.php(618): EntitySchema\MediaWiki\Content\EntitySchemaContentHandler->getSlotDiffRendererInternal(RequestContext)
#2 /srv/mediawiki/php-1.34.0-wmf.6/includes/diff/DifferenceEngine.php(255): ContentHandler->getSlotDiffRenderer(RequestContext)
#3 [internal function]: Closure$DifferenceEngine::getSlotDiffRenderers(array)
#4 /srv/mediawiki/php-1.34.0-wmf.6/includes/diff/DifferenceEngine.php(256): array_map(Closure$DifferenceEngine::getSlotDiffRenderers;1736, array)
#5 /srv/mediawiki/php-1.34.0-wmf.6/includes/diff/DifferenceEngine.php(1179): DifferenceEngine->getSlotDiffRenderers()
#6 /srv/mediawiki/php-1.34.0-wmf.6/extensions/MobileFrontend/includes/diff/InlineDifferenceEngine.php(202): DifferenceEngine->getDiffBodyCacheKeyParams()
#7 /srv/mediawiki/php-1.34.0-wmf.6/includes/diff/DifferenceEngine.php(1033): InlineDifferenceEngine->getDiffBodyCacheKeyParams()
#8 /srv/mediawiki/php-1.34.0-wmf.6/extensions/MobileFrontend/includes/diff/InlineDifferenceEngine.php(65): DifferenceEngine->getDiffBody()
#9 /srv/mediawiki/php-1.34.0-wmf.6/extensions/MobileFrontend/includes/specials/SpecialMobileDiff.php(156): InlineDifferenceEngine->showDiffPage()
#10 /srv/mediawiki/php-1.34.0-wmf.6/extensions/MobileFrontend/includes/specials/SpecialMobileDiff.php(128): SpecialMobileDiff->displayDiffPage()
#11 /srv/mediawiki/php-1.34.0-wmf.6/extensions/MobileFrontend/includes/specials/MobileSpecialPage.php(74): SpecialMobileDiff->executeWhenAvailable(string)
#12 /srv/mediawiki/php-1.34.0-wmf.6/includes/specialpage/SpecialPage.php(570): MobileSpecialPage->execute(string)
#13 /srv/mediawiki/php-1.34.0-wmf.6/includes/specialpage/SpecialPageFactory.php(575): SpecialPage->run(string)
#14 /srv/mediawiki/php-1.34.0-wmf.6/includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#15 /srv/mediawiki/php-1.34.0-wmf.6/includes/MediaWiki.php(865): MediaWiki->performRequest()
#16 /srv/mediawiki/php-1.34.0-wmf.6/includes/MediaWiki.php(515): MediaWiki->main()
#17 /srv/mediawiki/php-1.34.0-wmf.6/index.php(42): MediaWiki->run()
#18 /srv/mediawiki/w/index.php(3): include(string)
#19 {main}

Impact

5 Exceptions in the last 12 hours.

Notes

Event Timeline

MobileFrontend hooks into GetDifferenceEngine to return an InlineDifferenceEngine on Special:MobileFrontend; ContentHandler::getSlotDiffRenderer then returns a DifferenceEngineSlotDiffRenderer instead of the TextSlotDiffRenderer we expect in EntitySchemaSlotDiffRenderer:

if ( get_class( $slotDiffRenderer ) === TextSlotDiffRenderer::class ) {
	//  To keep B/C, when SlotDiffRenderer is not overridden for a given content type
	// but DifferenceEngine is, use that instead.
	$differenceEngine = $this->createDifferenceEngine( $context );
	if ( get_class( $differenceEngine ) !== DifferenceEngine::class ) {
		// TODO turn this into a deprecation warning in a later release
		LoggerFactory::getInstance( 'diff' )->info(
			'Falling back to DifferenceEngineSlotDiffRenderer', [
				'modelID' => $this->getModelID(),
				'DifferenceEngine' => get_class( $differenceEngine ),
			] );
		$slotDiffRenderer = new DifferenceEngineSlotDiffRenderer( $differenceEngine );
	}
}

Perhaps we should just instantiate a fresh TextSlotDiffRenderer ourselves if that’s what we really need.

yeah, I'm just about to create a patch. We need to both create that renderer ourselves and force the default DiffEngine, because InlineDifferenceEngine doesn't expect a diff body made of table rows :/

Change 513092 had a related patch set uploaded (by Michael Große; owner: Michael Große):
[mediawiki/extensions/EntitySchema@master] Fix Exception by forcing default diff engine and renderer

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

Change 513092 merged by jenkins-bot:
[mediawiki/extensions/EntitySchema@master] Fix Exception by forcing default diff engine and renderer

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

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:06 PM