[go: up one dir, main page]

Page MenuHomePhabricator

No option to continue querying for more results in globalallusers API
Open, MediumPublic

Description

Me need to get all users which have a global rights. See link. But... where is continue in response?
No, it is not all users. If we change &agulimit to 50, then we get 31 continues and 1569 users. See for example and source code.

It’s very old bug. Sorry for my English.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Masumrezarock100 renamed this task from Continue in a list=globalallusers to No option to continue querying for more results in globalallusers API.Jan 5 2020, 2:30 PM

If I understand correctly, you want to retrieve a list of users who is in at least one global group by using API query. But there is no option to continue querying for more results?

If I understand correctly, you want to retrieve a list of users who is in at least one global group by using API query. But there is no option to continue querying for more results?

Yes. If &agulimit=300, there is no option. If 50, all fine.
If we use other limits, then continues may be contain, but not all (users less than 1569).

Eevans triaged this task as Medium priority.Jan 10 2020, 5:23 PM

The real problem seems to be that the module thinks that it finished the result set when it actually didn't. Since it thinks it finished, it doesn't generate a continuation.

The underlying problem seems similar to T72496: Internal error in ApiQueryAllUsers::execute: MediaWiki configuration error: The database contains more user groups than known to User::getAllGroups() function, but in this case there's no existing check to detect and raise an error.

I'd like to "bump" this task because it appears that the issue is still present in 2023.
Try the following link (the server domain, ja.wikipedia.org, should be modified if needed):
https://ja.wikipedia.org/w/api.php?action=query&list=globalallusers&agulimit=max&agugroup=founder%7Csteward%7Combuds%7Cstaff%7Csysadmin%7Cglobal-sysop%7Cabusefilter-maintainer%7Cabusefilter-helper%7Cglobal-interface-editor%7Cglobal-bot%7Cglobal-deleter%7Cglobal-rollbacker%7Cvrt-permissions%7Coathauth-tester&aguprop=groups&formatversion=2
Notice that agulimit is set to max. I have an admin right on jawp (hence have apihighlimits), then get 1467 responses, but when I open this link on an incognito window (meaning not logged in), I only get 500 responses (which is normal) and there's no continue property (which is abnormal).

Change #1090538 had a related patch set uploaded (by Iluvatar; author: Iluvatar):

[mediawiki/extensions/CentralAuth@master] Context: API: list=globalallusers In cases where multiple groups are requested (agugroup=group1|group2|group3), 'continue' was often invoked before the $i was incremented. 'break' was often unreachable.

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

Can you update the message accordingly and ideally mention the relevant Phabricator ticket? Thanks!

Bug explanation: When multiple groups are requested (agugroup=group1|group2|group3), SELECT query returns the same username multiple times if user is a member of several groups.

gu_name: Test1 (steward)
gu_name: Test2 (steward)  <<
gu_name: Test2 (vrts)  <<
gu_name: Test2 (…)  <<
gu_name: Test2 (steward)

Duplicates are removed in the code: if username is a duplicate, the iteration of the loop is skipped.

if ( $row->gu_name === $previousName ) {
        continue;
}

But increment of $i and continue condition is also skipped:

if ( $i > $params['limit'] ) {
        $this->setContinueEnumParameter( 'from', $row->gu_name );
	break;
}
$i++;

The condition becomes unreachable. User did not receive continue in the API response.

Sry for my English.