Page MenuHomePhabricator

Wikimedia\Assert\ParameterElementTypeException: Bad value for parameter info['data']: all elements must be MediaWiki\IPInfo\Info\Info|MediaWiki\IPInfo\Info\IPoidInfo|MediaWiki\IPInfo\Info\BlockInfo|MediaWiki\IPInfo\Info\Contrib
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
labels.normalized_message
[{reqId}] {exception_url}   Wikimedia\Assert\ParameterElementTypeException: Bad value for parameter info['data']: all elements must be MediaWiki\IPInfo\Info\Info|MediaWiki\IPInfo\Info\IPoidInfo|MediaWiki\IPInfo\Info\BlockInfo|MediaWiki\IPInfo\Info\Contrib
error.stack_trace
from /srv/mediawiki/php-1.43.0-wmf.17/vendor/wikimedia/assert/src/Assert.php(164)
#0 /srv/mediawiki/php-1.43.0-wmf.17/extensions/IPInfo/src/Rest/Presenter/DefaultPresenter.php(82): Wikimedia\Assert\Assert::parameterElementType(array, array, string)
#1 /srv/mediawiki/php-1.43.0-wmf.17/extensions/IPInfo/src/Rest/Handler/AbstractRevisionHandler.php(61): MediaWiki\IPInfo\Rest\Presenter\DefaultPresenter->present(array, MediaWiki\User\User)
#2 /srv/mediawiki/php-1.43.0-wmf.17/extensions/IPInfo/src/Rest/Handler/IPInfoHandler.php(155): MediaWiki\IPInfo\Rest\Handler\AbstractRevisionHandler->getInfo(int)
#3 /srv/mediawiki/php-1.43.0-wmf.17/includes/Rest/SimpleHandler.php(40): MediaWiki\IPInfo\Rest\Handler\IPInfoHandler->run(int)
#4 /srv/mediawiki/php-1.43.0-wmf.17/includes/Rest/Module/Module.php(380): MediaWiki\Rest\SimpleHandler->execute()
#5 /srv/mediawiki/php-1.43.0-wmf.17/includes/Rest/Module/Module.php(269): MediaWiki\Rest\Module\Module->executeHandler(MediaWiki\IPInfo\Rest\Handler\RevisionHandler)
#6 /srv/mediawiki/php-1.43.0-wmf.17/includes/Rest/Router.php(477): MediaWiki\Rest\Module\Module->execute(string, MediaWiki\Rest\RequestFromGlobals)
#7 /srv/mediawiki/php-1.43.0-wmf.17/includes/Rest/Router.php(446): MediaWiki\Rest\Router->doExecute(string, MediaWiki\Rest\RequestFromGlobals)
#8 /srv/mediawiki/php-1.43.0-wmf.17/includes/Rest/EntryPoint.php(209): MediaWiki\Rest\Router->execute(MediaWiki\Rest\RequestFromGlobals)
#9 /srv/mediawiki/php-1.43.0-wmf.17/includes/MediaWikiEntryPoint.php(200): MediaWiki\Rest\EntryPoint->execute()
#10 /srv/mediawiki/php-1.43.0-wmf.17/rest.php(39): MediaWiki\MediaWikiEntryPoint->run()
#11 /srv/mediawiki/w/rest.php(3): require(string)
#12 {main}
Notes

Error started showing up in the logs after deploying wmf.17 to group1. So far volume in group1 is small.

This seems related to the changes applied recently to the IPInfo extension as part of T349715. The following change in particular modified the affected code: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/IPInfo/+/1058592

Details

Request URL
https://it.wikipedia.org/w/rest.php/ipinfo/v0/revision/140498184?dataContext=*&language=*
Related Changes in Gerrit:

Event Timeline

thcipriani triaged this task as Unbreak Now! priority.Aug 7 2024, 8:09 PM
thcipriani subscribed.

Flagging this one for Trust and Safety Product Team and setting it as a train blocker (hence the UBN! status) since it's a new error to a new thing. If this is innocuous, feel free to remove as a blocker and set an appropriate status.

Change #1060755 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/IPInfo@master] Fix DefaultPresenter rejecting IPCountInfo instances

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

I will take a look at this shortly once I'm in the conference centre

I had a quick look. There is a new IPCountInfoRetriever added via T349715 just a few days ago that returns IPCountInfo objects. These are not understood and even actively rejected by DefaultPresenter::present. I believe this is just a mistake. I made a quick patch that does nothing but silence the error. The team responsible for the codebase needs to decide if this is worth being backported or if they can quickly add the missing "presenter".

Related question: I wonder why the "Info" classes don't have a common interface? I think this is worth it even if they don't share any code. Something like this:

<?php

namespace MediaWiki\IPInfo\Info;

interface PresentableInfo extends JsonSerializable {
}

That's it. It won't change much in the code, but make it easier for humans to read and understand the code.

We should be able to revert this if necessary, as this was built for support of temporary accounts (which are not enabled anywhere but testwiki). The only engineer not on holiday or at Wikimania is @STran.

Change #1060760 had a related patch set uploaded (by Dreamy Jazz; author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/IPInfo@wmf/1.43.0-wmf.17] Fix DefaultPresenter rejecting IPCountInfo instances

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

Change #1060755 merged by jenkins-bot:

[mediawiki/extensions/IPInfo@master] Fix DefaultPresenter rejecting IPCountInfo instances

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

Change #1060760 merged by jenkins-bot:

[mediawiki/extensions/IPInfo@wmf/1.43.0-wmf.17] Fix DefaultPresenter rejecting IPCountInfo instances

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

Mentioned in SAL (#wikimedia-operations) [2024-08-08T09:21:46Z] <dreamyjazz@deploy1003> Started scap sync-world: Backport for [[gerrit:1060760|Fix DefaultPresenter rejecting IPCountInfo instances (T371966)]]

Mentioned in SAL (#wikimedia-operations) [2024-08-08T09:23:52Z] <dreamyjazz@deploy1003> dreamyjazz: Backport for [[gerrit:1060760|Fix DefaultPresenter rejecting IPCountInfo instances (T371966)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-08-08T09:32:24Z] <dreamyjazz@deploy1003> Finished scap: Backport for [[gerrit:1060760|Fix DefaultPresenter rejecting IPCountInfo instances (T371966)]] (duration: 10m 38s)

Merged fix, backported it, and I can't reproduce the error on it.wikipedia.org now -> train should be unblocked and this task can be resolved.