Page MenuHomePhabricator

PagePropsEntityIdLookup: don’t pass non-PageIdentity Titles into PageProps::getProperties()
Closed, ResolvedPublic5 Estimated Story Points

Description

T283170 (via T279796) was caused by Wikibase passing Titles into PageProps::getProperties() that don’t represent existing pages (such as special pages). We should probably filter those out in PagePropsEntityIdLookup::getEntityIds(), at least as long as that method is declared to accept a Title[]. (Eventually we should probably move the EntityIdLookup interface away from the Title class as well.)

This was caused by the message on the italian wikiversity recent changes speciale page being overwritten with something that included Wikibase-Lua.

Acceptance criteria:🏕️🌟

  • PagePropsEntityIdLookup::getEntityIds() (link) should be able to handle Non-PageIdentity titles, like Special Pages, without causing a fatal error.
    • i.e. the query should not run for title that do not have page props, like Special Pages

Event Timeline

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

Relevant stacktrace from T283170: Special:RecentChanges in it.wikiversity dies with an internal error

2021-05-19 15:31:30 [bcf89ab8-639a-47a4-aaa7-df9434894444] mw1327 itwikiversity 1.37.0-wmf.6 exception ERROR: [bcf89ab8-639a-47a4-aaa7-df9434894444] /wiki/Speciale:UltimeModifiche   Wikimedia\Assert\PreconditionException: Precondition failed: This Title instance does not represent a proper page, but merely a link target. {"exception_url":"/wiki/Speciale:UltimeModifiche","reqId":"bcf89ab8-639a-47a4-aaa7-df9434894444","caught_by":"entrypoint"} 
[Exception Wikimedia\Assert\PreconditionException] (/srv/mediawiki/php-1.37.0-wmf.6/vendor/wikimedia/assert/src/Assert.php:49) Precondition failed: This Title instance does not represent a proper page, but merely a link target.
  #0 /srv/mediawiki/php-1.37.0-wmf.6/includes/Title.php(4546): Wikimedia\Assert\Assert::precondition(boolean, string)
  #1 /srv/mediawiki/php-1.37.0-wmf.6/includes/Title.php(4527): Title->assertProperPage()
  #2 /srv/mediawiki/php-1.37.0-wmf.6/includes/PageProps.php(236): Title->getId()
  #3 /srv/mediawiki/php-1.37.0-wmf.6/includes/PageProps.php(105): PageProps->getGoodIDs(array)
  #4 /srv/mediawiki/php-1.37.0-wmf.6/extensions/Wikibase/client/includes/Store/Sql/PagePropsEntityIdLookup.php(46): PageProps->getProperties(array, array)
  #5 /srv/mediawiki/php-1.37.0-wmf.6/extensions/Wikibase/client/includes/Store/Sql/PagePropsEntityIdLookup.php(57): Wikibase\Client\Store\Sql\PagePropsEntityIdLookup->getEntityIds(array)
  #6 /srv/mediawiki/php-1.37.0-wmf.6/extensions/Wikibase/data-access/src/ByTypeDispatchingEntityIdLookup.php(62): Wikibase\Client\Store\Sql\PagePropsEntityIdLookup->getEntityIdForTitle(Title)
  #7 /srv/mediawiki/php-1.37.0-wmf.6/extensions/Wikibase/client/includes/DataAccess/Scribunto/WikibaseLanguageIndependentLuaBindings.php(143): Wikibase\DataAccess\ByTypeDispatchingEntityIdLookup->getEntityIdForTitle(Title)
  #8 /srv/mediawiki/php-1.37.0-wmf.6/extensions/Wikibase/client/includes/DataAccess/Scribunto/Scribunto_LuaWikibaseLibrary.php(566): Wikibase\Client\DataAccess\Scribunto\WikibaseLanguageIndependentLuaBindings->getEntityId(string, string)
  #9 /srv/mediawiki/php-1.37.0-wmf.6/extensions/Scribunto/includes/engines/LuaSandbox/LuaSandboxCallback.php(26): Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseLibrary->getEntityId(string)
  #10 [internal function]: Scribunto_LuaSandboxCallback->__call(string, array)
  #11 /srv/mediawiki/php-1.37.0-wmf.6/extensions/Scribunto/includes/engines/LuaSandbox/LuaSandboxInterpreter.php(113): LuaSandboxFunction->call(LuaSandboxFunction)
  #12 /srv/mediawiki/php-1.37.0-wmf.6/extensions/Scribunto/includes/engines/LuaCommon/LuaEngine.php(296): Scribunto_LuaSandboxInterpreter->callFunction(LuaSandboxFunction, LuaSandboxFunction)
  #13 /srv/mediawiki/php-1.37.0-wmf.6/extensions/Scribunto/includes/engines/LuaCommon/LuaModule.php(68): Scribunto_LuaEngine->executeFunctionChunk(LuaSandboxFunction, PPTemplateFrame_Hash)
  #14 /srv/mediawiki/php-1.37.0-wmf.6/extensions/Scribunto/includes/common/Hooks.php(128): Scribunto_LuaModule->invoke(string, PPTemplateFrame_Hash)
  #15 /srv/mediawiki/php-1.37.0-wmf.6/includes/parser/Parser.php(3382): ScribuntoHooks::invokeHook(Parser, PPTemplateFrame_Hash, array)
  #16 /srv/mediawiki/php-1.37.0-wmf.6/includes/parser/Parser.php(3067): Parser->callParserFunction(PPTemplateFrame_Hash, string, array)
  #17 /srv/mediawiki/php-1.37.0-wmf.6/includes/parser/PPFrame_Hash.php(263): Parser->braceSubstitution(array, PPTemplateFrame_Hash)
  #18 /srv/mediawiki/php-1.37.0-wmf.6/includes/parser/Parser.php(3256): PPFrame_Hash->expand(PPNode_Hash_Tree)
  #19 /srv/mediawiki/php-1.37.0-wmf.6/includes/parser/PPFrame_Hash.php(263): Parser->braceSubstitution(array, PPFrame_Hash)
  #20 /srv/mediawiki/php-1.37.0-wmf.6/includes/parser/Parser.php(2905): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
  #21 /srv/mediawiki/php-1.37.0-wmf.6/includes/parser/Parser.php(1575): Parser->replaceVariables(string)
  #22 /srv/mediawiki/php-1.37.0-wmf.6/includes/parser/Parser.php(648): Parser->internalParse(string)
  #23 /srv/mediawiki/php-1.37.0-wmf.6/includes/cache/MessageCache.php(1321): Parser->parse(string, Title, ParserOptions, boolean)
  #24 /srv/mediawiki/php-1.37.0-wmf.6/includes/specials/SpecialRecentChanges.php(654): MessageCache->parse(string, Title, boolean, boolean, Language)
  #25 /srv/mediawiki/php-1.37.0-wmf.6/includes/specials/SpecialRecentChanges.php(536): SpecialRecentChanges->setTopText(FormOptions)
  #26 /srv/mediawiki/php-1.37.0-wmf.6/includes/specialpage/ChangesListSpecialPage.php(1662): SpecialRecentChanges->doHeader(FormOptions, integer)
  #27 /srv/mediawiki/php-1.37.0-wmf.6/includes/specialpage/ChangesListSpecialPage.php(1673): ChangesListSpecialPage->webOutputHeader(integer, FormOptions)
  #28 /srv/mediawiki/php-1.37.0-wmf.6/includes/specialpage/ChangesListSpecialPage.php(674): ChangesListSpecialPage->webOutput(Wikimedia\Rdbms\ResultWrapper, FormOptions)
  #29 /srv/mediawiki/php-1.37.0-wmf.6/includes/specials/SpecialRecentChanges.php(203): ChangesListSpecialPage->execute(NULL)
  #30 /srv/mediawiki/php-1.37.0-wmf.6/includes/specialpage/SpecialPage.php(646): SpecialRecentChanges->execute(NULL)
  #31 /srv/mediawiki/php-1.37.0-wmf.6/includes/specialpage/SpecialPageFactory.php(1390): SpecialPage->run(NULL)
  #32 /srv/mediawiki/php-1.37.0-wmf.6/includes/MediaWiki.php(314): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
  #33 /srv/mediawiki/php-1.37.0-wmf.6/includes/MediaWiki.php(917): MediaWiki->performRequest()
  #34 /srv/mediawiki/php-1.37.0-wmf.6/includes/MediaWiki.php(551): MediaWiki->main()
  #35 /srv/mediawiki/php-1.37.0-wmf.6/index.php(53): MediaWiki->run()
  #36 /srv/mediawiki/php-1.37.0-wmf.6/index.php(46): wfIndexMain()
  #37 /srv/mediawiki/w/index.php(3): require(string)
  #38 {main}

Change 696589 had a related patch set uploaded (by Itamar Givon; author: Itamar Givon):

[mediawiki/extensions/Wikibase@master] Typehint files to be modified

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

Change 696590 had a related patch set uploaded (by Itamar Givon; author: Itamar Givon):

[mediawiki/extensions/Wikibase@master] Filter out non PageIdentity titles in PagePropsEntityIdLookup

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

Change 696589 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Typehint files to be modified

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

Change 696590 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Filter out non PageIdentity titles in PagePropsEntityIdLookup

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