Page MenuHomePhabricator

Module prefix 'wbeu' is shared between Wikibase\Client\Api\ApiListEntityUsage and Wikibase\Client\Api\ApiPropsEntityUsage
Closed, ResolvedPublic3 Estimated Story Points

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:

NOTE: This is a breaking change. Announcement is being prepared here.

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

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?

@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.

Change 719554 had a related patch set uploaded (by Inductiveload; author: Inductiveload):

[mediawiki/core@master] Api prefix uniqueness: suppress for 'pi'

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

How can we move forward on this?

@ItamarWMDE maybe we can pull this, T300460 and T254334 into the tech backlog, as a general “fix the entity usage API(s)” project? (At least two of the tasks, and maybe all three, probably require a breaking change to the API, so it would be best to do them at the same time.)

Sure, I will need more context on why this was stalled to begin with, but let's discuss this in tech prio.

Prio Notes:

  • Affects end users / production systems (consult product about breaking change to stable interface)
  • Does not affect development efforts (These tests are currently not running)
  • Does not affect onboarding efforts
  • Does affect additional stakeholders (Tests are run for core, where they fail - but are blocked by a special case)
ItamarWMDE changed the task status from Open to Stalled.EditedJan 18 2023, 10:42 AM

We decided to wait with this task in anticipation for T327062: Show entity labels in parsed edit summaries in API requests as well as we want to batch together announcements of significant changes

See T300460#8625492 for my latest suggestion for how to fix this without inconveniencing API users too much.

ItamarWMDE changed the task status from Stalled to Open.Feb 21 2023, 10:23 AM

Change 893508 had a related patch set uploaded (by Hoo man; author: Hoo man):

[mediawiki/extensions/Wikibase@master] wblistentityusage: Deprecate wbeu prefix, new output format

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

I think this can go back to waiting, actually – the Gerrit change exists and I already reviewed it, and it’s only blocked on the announcement / timing and otherwise ready.

Change 914297 had a related patch set uploaded (by Michael Große; author: Hoo man):

[mediawiki/extensions/Wikibase@wmf/1.41.0-wmf.7] wblistentityusage: Deprecate wbeu prefix, new output format

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

Change 893508 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] wblistentityusage: Deprecate wbeu prefix, new output format

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

Change 914437 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Hoo man):

[mediawiki/extensions/Wikibase@wmf/1.41.0-wmf.6] wblistentityusage: Deprecate wbeu prefix, new output format

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

Change 914297 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@wmf/1.41.0-wmf.7] wblistentityusage: Deprecate wbeu prefix, new output format

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

Mentioned in SAL (#wikimedia-operations) [2023-05-03T10:00:32Z] <lucaswerkmeister-wmde@deploy1002> Started scap: Backport for [[gerrit:914297|wblistentityusage: Deprecate wbeu prefix, new output format (T300460 T196962)]]

Mentioned in SAL (#wikimedia-operations) [2023-05-03T10:18:46Z] <lucaswerkmeister-wmde@deploy1002> lucaswerkmeister-wmde and migr: Backport for [[gerrit:914297|wblistentityusage: Deprecate wbeu prefix, new output format (T300460 T196962)]] synced to the testservers: mwdebug1002.eqiad.wmnet, mwdebug2002.codfw.wmnet, mwdebug2001.codfw.wmnet, mwdebug1001.eqiad.wmnet

Mentioned in SAL (#wikimedia-operations) [2023-05-03T10:35:25Z] <lucaswerkmeister-wmde@deploy1002> Finished scap: Backport for [[gerrit:914297|wblistentityusage: Deprecate wbeu prefix, new output format (T300460 T196962)]] (duration: 34m 53s)

Change 914437 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@wmf/1.41.0-wmf.6] wblistentityusage: Deprecate wbeu prefix, new output format

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

Mentioned in SAL (#wikimedia-operations) [2023-05-03T13:24:30Z] <lucaswerkmeister-wmde@deploy1002> Started scap: Backport for [[gerrit:914437|wblistentityusage: Deprecate wbeu prefix, new output format (T300460 T196962)]]

Mentioned in SAL (#wikimedia-operations) [2023-05-03T13:41:59Z] <lucaswerkmeister-wmde@deploy1002> lucaswerkmeister-wmde: Backport for [[gerrit:914437|wblistentityusage: Deprecate wbeu prefix, new output format (T300460 T196962)]] synced to the testservers: mwdebug2002.codfw.wmnet, mwdebug2001.codfw.wmnet, mwdebug1001.eqiad.wmnet, mwdebug1002.eqiad.wmnet

Mentioned in SAL (#wikimedia-operations) [2023-05-03T13:52:25Z] <lucaswerkmeister-wmde@deploy1002> Finished scap: Backport for [[gerrit:914437|wblistentityusage: Deprecate wbeu prefix, new output format (T300460 T196962)]] (duration: 27m 54s)

back to Waiting until we can drop support for the old prefix.

Task Breakdown Notes:

  • We concluded that the only remaining work on this ticket is to remove support for the old prefix, therefore, we will create a subtask for this.
  • As this change doesn't rely on configuration, and it is already live, we can just let the support for the old prefix drop with the next train. i.e. this doesn't require a deployment window scheduling.
  • By looking at the changes made by Marius (893508 on gerrit) we can ascertain which methods and parameters should be removed n order to only support the new prefix. In case of doubt, ask @hoo
hoo moved this task from Todo/Backlog to Doing on the Wikidata Dev Team (Sprint-∞) board.
hoo updated Other Assignee, added: hoo.
hoo updated Other Assignee, removed: hoo.

Change 922908 had a related patch set uploaded (by Hoo man; author: Hoo man):

[mediawiki/extensions/Wikibase@master] ApiListEntityUsage: Remove legacy prefix

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

Change 922908 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] ApiListEntityUsage: Remove legacy prefix

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

Change 454049 merged by jenkins-bot:

[mediawiki/core@master] ApiPrefixUniquenessTest: Drop wbeu hack

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