Page MenuHomePhabricator

FormIdHtmlFormatter: Call to undefined method Item::getRepresentations()
Closed, ResolvedPublic

Description

Wed Aug 15 08:01:19 2018] [hphp] [6572:7f9a3e6ce200:0:000002] [] 
08:01:19 Fatal error: Call to undefined method Wikibase\DataModel\Entity\Item::getRepresentations() in /home/jenkins/workspace/mwext-testextension-hhvm-composer-jessie/src/extensions/WikibaseLexeme/src/PropertyType/FormIdHtmlFormatter.php on line 71

https://integration.wikimedia.org/ci/job/mwext-testextension-hhvm-composer-jessie/15806/console for https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/ArticlePlaceholder/+/440821/

Event Timeline

Another comment tagging T200508 as the reason this appeared (so everything is linked together in a wonderful web of tickets)

Locally reproduceable on WB+WBL masters

Wikibase\Lexeme\Tests\MediaWiki\Specials\LexemeSpecialWhatLinksHereTest::testLexemeLanguage
Wikibase\Lexeme\Tests\MediaWiki\Specials\LexemeSpecialWhatLinksHereTest::testLexemeLexicalCategory
Wikibase\Lexeme\Tests\MediaWiki\Specials\LexemeSpecialWhatLinksHereTest::testGrammaticalFeatures
Wikibase\Lexeme\Tests\MediaWiki\Specials\LexemeSpecialWhatLinksHereTest::testFormStatements
Wikibase\Lexeme\Tests\MediaWiki\Specials\LexemeSpecialWhatLinksHereTest::testSenseStatements

I just realized what this error message means: Some test (at the moment I don't know which) creates an Item, but this Item ends in code that expects a Lexeme.

One possible improvement is to let FormIdTextFormatter::formatEntityId throw an exception when the Entity returned by EntityRevisionLookup::getEntityRevision()->getEntity() is not a Form. This would give us a stack trace.

An other possible improvement is to not throw an exception, but just return $formId->getSerialization() when the EntityId is not a FormId. This would make this code work in all situations, even when the type of a property got changed from wikibase-item to wikibase-form, but the database still contains some item values that now end in the FormId formatter.

Happens too when executing only the tests inside /var/www/mediawiki/extensions/WikibaseLexeme/tests/phpunit/mediawiki

Q345 seems to be the Wikibase\DataModel\Entity\Item that makes it into the formatter.

./phpunit default --filter 'LexemeDiffVisualizerIntegrationTest|LexemeSpecialWhatLinksHereTest' //var/www/mediawiki/extensions/WikibaseLexeme/tests/phpunit/ is indeed red.

https://gerrit.wikimedia.org/r/452392 was identified as watershed commit - why it was green at the time is still beyond us.

./phpunit default --filter 'LexemeDiffVisualizerIntegrationTest::testAddedStatementsOnFormsTargettingFormsAreDisplayedAsLinks|LexemeSpecialWhatLinksHereTest::testFormStatements' //var/www/mediawiki/extensions/WikibaseLexeme/tests/phpunit/ is the real test MVP

Change 452912 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] LexemeSpecialWhatLinksHereTest: create property

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

Change 452912 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] LexemeSpecialWhatLinksHereTest: create property

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

Change 453140 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/Wikibase@master] Store: add ability to clean in-memory cache

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

Change 453143 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/Wikibase@master] phpunit: clear in-memory caches between tests

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

Change 453147 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] phpunit: WikibaseRepo statics persist between tests

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

Pablo-WMDE changed the task status from Open to Stalled.Aug 29 2018, 1:04 PM

Change 453140 abandoned by Pablo Grass (WMDE):
Store: add ability to clean in-memory cache

Reason:
Made irrelevant by I82b5e94009527f9e46262bf6f505a43ddc9767f0 & Idd12370b09ad0ebae23d77c743b79a7163961436

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

Change 453143 abandoned by Pablo Grass (WMDE):
phpunit: clear in-memory caches between tests

Reason:
Made irrelevant by I82b5e94009527f9e46262bf6f505a43ddc9767f0 & Idd12370b09ad0ebae23d77c743b79a7163961436

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

WikibaseRepo instances are now reset for every test curtesy of https://gerrit.wikimedia.org/r/455180

Change 453147 abandoned by Addshore:
phpunit: WikibaseRepo statics persist between tests

Reason:
I think we can abandon this now?
I'm gonna be bold and just do it.
Feel free to un-abandon!

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