Page MenuHomePhabricator

SlotRoleHandler's introduction breaks WBMI; edits now fail with "content is not allowed on page" error
Closed, ResolvedPublic

Event Timeline

This works fine on my local version with the latest wikibase. Some (other) quirk of beta perhaps?

Also if I try and edit captions on an existing image e.g. https://commons.wikimedia.beta.wmflabs.org/wiki/File:Martti_Jukola_reporting_from_a_sports_event,_1930s..jpg refreshing the captions fails

The reason is the api query for wbgetentities for the relevant mediainfo item returns "missing", see https://commons.wikimedia.beta.wmflabs.org/w/api.php?action=wbgetentities&format=json&props=info|labels&ids=M53736

Again works fine on my local version

Jdforrester-WMF triaged this task as Unbreak Now! priority.Dec 4 2018, 4:39 PM

Replicated locally as well as on Beta. Back-trace:

{
    "error": {
        "code": "internal_api_error_MediaWiki\\Storage\\PageUpdateException",
        "info": "[a3dc984b44fa2b36b377efe2] Exception caught: Slot role `mediainfo` is not allowed.",
        "errorclass": "MediaWiki\\Storage\\PageUpdateException",
        "*": "MediaWiki\\Storage\\PageUpdateException at /vagrant/mediawiki/includes/Storage/PageUpdater.php(1260)
		#0 /vagrant/mediawiki/includes/Storage/PageUpdater.php(349): MediaWiki\\Storage\\PageUpdater->ensureRoleAllowed(string)
		#1 /vagrant/mediawiki/extensions/Wikibase/repo/includes/Store/Sql/WikiPageEntityStore.php(314): MediaWiki\\Storage\\PageUpdater->setContent(string, Wikibase\\MediaInfo\\Content\\MediaInfoContent)
		#2 /vagrant/mediawiki/extensions/Wikibase/repo/includes/Store/Sql/WikiPageEntityStore.php(207): Wikibase\\Repo\\Store\\WikiPageEntityStore->saveEntityContent(Wikibase\\MediaInfo\\Content\\MediaInfoContent, string, User, integer, boolean)
		#3 /vagrant/mediawiki/extensions/Wikibase/lib/includes/Store/TypeDispatchingEntityStore.php(87): Wikibase\\Repo\\Store\\WikiPageEntityStore->saveEntity(Wikibase\\MediaInfo\\DataModel\\MediaInfo, string, User, integer, boolean)
		#4 /vagrant/mediawiki/extensions/Wikibase/repo/includes/EditEntity/StatsdSaveTimeRecordingEntityStore.php(49): Wikibase\\Lib\\Store\\TypeDispatchingEntityStore->saveEntity(Wikibase\\MediaInfo\\DataModel\\MediaInfo, string, User, integer, boolean)
		#5 /vagrant/mediawiki/extensions/Wikibase/repo/includes/EditEntity/MediawikiEditEntity.php(709): Wikibase\\Repo\\EditEntity\\StatsdSaveTimeRecordingEntityStore->saveEntity(Wikibase\\MediaInfo\\DataModel\\MediaInfo, string, User, integer, boolean)
		#6 /vagrant/mediawiki/extensions/Wikibase/repo/includes/EditEntity/StatsdSaveTimeRecordingEditEntity.php(73): Wikibase\\Repo\\EditEntity\\MediawikiEditEntity->attemptSave(Wikibase\\MediaInfo\\DataModel\\MediaInfo, string, integer, string, boolean)
		#7 /vagrant/mediawiki/extensions/Wikibase/repo/includes/Api/EntitySavingHelper.php(350): Wikibase\\Repo\\EditEntity\\StatsdSaveTimeRecordingEditEntity->attemptSave(Wikibase\\MediaInfo\\DataModel\\MediaInfo, string, integer, string)
		#8 /vagrant/mediawiki/extensions/Wikibase/repo/includes/Api/ModifyEntity.php(309): Wikibase\\Repo\\Api\\EntitySavingHelper->attemptSaveEntity(Wikibase\\MediaInfo\\DataModel\\MediaInfo, string)
		#9 /vagrant/mediawiki/includes/api/ApiMain.php(1595): Wikibase\\Repo\\Api\\ModifyEntity->execute()
		#10 /vagrant/mediawiki/includes/api/ApiMain.php(531): ApiMain->executeAction()
		#11 /vagrant/mediawiki/includes/api/ApiMain.php(502): ApiMain->executeActionWithErrorHandling()
		#12 /vagrant/mediawiki/api.php(87): ApiMain->execute()
		#13 /var/www/w/api.php(5): require(string)
		#14 {main}"
    }
}

"info": "[a3dc984b44fa2b36b377efe2] Exception caught: Slot role mediainfo is not allowed.",

That makes it sound like code somewhere needs to call MediaWikiServices::getSlotRoleRegistry()->defineRole( 'mediainfo', ... ) to define the mediainfo role. The "..." is a factory function for a SlotRoleHandler object, either a mediainfo-specific subclass or SlotRoleHandler itself if __construct() has enough flexibility do the right thing.

Change 477606 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/WikibaseMediaInfo@master] Use SlotRoleHandler so that our content is editable again

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

Jdforrester-WMF renamed this task from Adding WBMI captions now fails in Wikibase with "content is not allowed on page" error on master to SlotRoleHandler's introduction breaks WBMI; edits now fail with "content is not allowed on page" error.Dec 4 2018, 7:59 PM
Jdforrester-WMF claimed this task.
Jdforrester-WMF removed a project: Wikidata.
Jdforrester-WMF updated the task description. (Show Details)

Change 477606 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Use SlotRoleHandler so that our content is editable again

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

Sorry about breaking this. I should have myself made the necessary patch.

I left a few comments on the patch about how to make this a bit smoother.

Change 477820 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/WikibaseMediaInfo@master] Follow-up 9210005: Move to the MediaWikiServices hook and scrap our class

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

Change 477820 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Follow-up 9210005: Move to the MediaWikiServices hook and scrap our class

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

So… my patch for this fixed it locally, but not on Beta Commons – content-not-allowed-here (e.g. "wikibase-mediainfo" content is not allowed on page File:Test-1445021196.521987.png in slot "Main") is still the error I get on trying to add a caption. Any ideas? Maybe related to T211237 brokeness?

The message is correct - wikibase-mediainfo is indeed not allowed in the Main slot. The question is, why is it trying to write mediainfo into the main slot?

The message is correct - wikibase-mediainfo is indeed not allowed in the Main slot. The question is, why is it trying to write mediainfo into the main slot?

Yeah, it looks like some wiring is wrong.

Ramsey-WMF subscribed.

This specific issue on Beta has been resolved with the rollback of Wikibase Federation. But we still have issues to look at. See T211801 and T211800