Page MenuHomePhabricator

Module prefix 'wbeu' is shared between Wikibase\Client\Api\ApiListEntityUsage and Wikibase\Client\Api\ApiPropsEntityUsage
Open, Needs TriagePublic

Description

Noticed as part of https://gerrit.wikimedia.org/r/c/mediawiki/core/+/439794. The module prefix needs to be globally unique.

While running MediaWiki core tests with Wikibase, I eventually got a failure:

1) PrefixUniquenessTest::testPrefixes
Module prefix 'wbeu' is shared between Wikibase\Client\Api\ApiListEntityUsage and Wikibase\Client\Api\ApiPropsEntityUsage

tests/phpunit/includes/api/PrefixUniquenessTest.php:24
tests/phpunit/MediaWikiTestCase.php:469
maintenance/doMaintenance.php:94

PrefixUniquenessTest::testPrefixes is described as:

Checks that all API query modules, core and extensions, have unique prefixes.

It is part of mediawiki/core, since the test is not a structure test, it is never run for extension, only for mediawiki/core patches. Which explains why it has never been noticed yet.

Related code:

client/includes/Api/ApiListEntityUsage.php:34:          parent::__construct( $query, $moduleName, 'wbeu' );
client/includes/Api/ApiPropsEntityUsage.php:32:         parent::__construct( $query, $moduleName, 'wbeu' );

Module references:

Event Timeline

Legoktm created this task.Jun 12 2018, 1:22 AM
Restricted Application added a project: Wikidata. · View Herald TranscriptJun 12 2018, 1:22 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
hashar updated the task description. (Show Details)Jun 19 2018, 7:32 AM

Fixing it is one line change (might need to change some tests too but very unlikely) but it's a public interface and per stable interface policy it has to be announced beforehand. @Lydia_Pintscher would it work for you?

Vvjjkkii renamed this task from Module prefix 'wbeu' is shared between Wikibase\Client\Api\ApiListEntityUsage and Wikibase\Client\Api\ApiPropsEntityUsage to 57aaaaaaaa.Jul 1 2018, 1:04 AM
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed subscribers: gerritbot, Aklapper.
CommunityTechBot renamed this task from 57aaaaaaaa to Module prefix 'wbeu' is shared between Wikibase\Client\Api\ApiListEntityUsage and Wikibase\Client\Api\ApiPropsEntityUsage.Jul 2 2018, 2:09 PM
CommunityTechBot raised the priority of this task from High to Needs Triage.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added subscribers: gerritbot, Aklapper.

@Lydia_Pintscher so the "wbeu" prefix this mentions is used in parameter names of the particular API modules.
This can be seen at https://en.wikipedia.org/w/api.php?action=help&modules=query%2Bwbentityusage and https://en.wikipedia.org/w/api.php?action=help&modules=query%2Bwblistentityusage.
If one (or both) of API module would have their prefix changed, this would mean the parameter names would change as well. This change would be a subject to wikidata's stable interface policy (any users using parameter would probably need to adjust their API calls).

Ok cool. Then I think it's fine. It should indeed follow the stable interface policy. Can you work with @Lea_Lacroix_WMDE on the announcement?

Change 454049 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/core@master] ApiPrefixUniquenessTest: Drop wbeu hack

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

When I make an API call with action=query and generator=wblistentityusage, like https://en.wikipedia.org/w/api.php?action=query&generator=wblistentityusage&gwbeuentities=Q42 I get an RuntimeException:

{
    "error": {
        "code": "internal_api_error_RuntimeException",
        "info": "[66cd48ca-659d-4873-92dc-505e78f08159] Caught exception of type RuntimeException",
        "errorclass": "RuntimeException"
    },
    "servedby": "mw1382"
}

I get the expected result if I use action=list and list=wblistentityusage, like in https://en.wikipedia.org/w/api.php?action=query&list=wblistentityusage&wbeuentities=Q42.

Is this a consequence of the shared module prefix, or should I create a new task for the RuntimeException?

hashar removed a subscriber: hashar.May 22 2020, 1:18 PM

@Dipsacus_fullonum no, that’s an independent error (I was still able to reproduce it locally after disabling the prop=wbentityusage module). I’ve reported it as T254334: WikibaseClient wblistentityusage API module throws RuntimeException when used as generator.

Aklapper removed a subscriber: Anomie.Oct 16 2020, 5:01 PM