Page MenuHomePhabricator

API query for userprops not working on group0 wikis (maybe because comment migration read-new)
Closed, ResolvedPublic

Description

Since this week's train, on testwiki and officewiki (only?), tools no longer seem able to get userprops for "editcount" or "groups" etc with the API. This means that the feature is broken to see a user's editcount or local user-groups within NavPopups and with the UserInfo.js script.

Did something change? Or is there a schema change (or something) that needs to be nudged for those wikis?

E.g. (not working)

vs (both working)

(it works fine on other wikis I tested, including enwiki, collabwiki, test2wiki)

Event Timeline

Quiddity created this task.Dec 2 2018, 4:51 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 2 2018, 4:51 AM
Quiddity updated the task description. (Show Details)Dec 2 2018, 4:52 AM
Reedy added a subscriber: Reedy.Dec 2 2018, 11:59 AM

It's responding like your account is "missing" on testwiki

"users": [
    {
        "name": "Quiddity",
        "missing": ""
    }
],

Userinfo script is not working on mw.org. See https://www.mediawiki.org/wiki/User:Quiddity if you have the script installed.

Quiddity renamed this task from API query for userprops not working on testwiki or officewiki to API query for userprops not working on testwiki or officewiki or mediawikiwiki.Dec 3 2018, 6:18 AM
Bawolff added a subscriber: Bawolff.EditedDec 3 2018, 6:35 AM

It seems like minimal reproducible test case is: https://test.wikipedia.org/w/api.php?format=jsonfm&formatversion=2&action=query&list=users&usprop=blockinfo&ususers=Quiddity

So I'm going to guess its related to partial blocks. further investigation suggests that it isn't related

Ok, so its doing the query

SELECT  user_id,user_name,user_real_name,user_email,user_touched,user_token,user_email_authenticated,user_email_token,user_email_token_expires,user_registration,user_editcount,user_actor.actor_id,ipb_deleted,ipb_id,ipb_expiry,ipb_timestamp,ipb_by,ipb_by_text,NULL AS `ipb_by_actor`,comment_ipb_reason.comment_text AS `ipb_reason_text`,comment_ipb_reason.comment_data AS `ipb_reason_data`,comment_ipb_reason.comment_id AS `ipb_reason_cid` 
FROM `user`
LEFT JOIN `actor` `user_actor` ON ((user_actor.actor_user = user_id))
LEFT JOIN `ipblocks` ON ((ipb_user=user_id) AND (ipb_expiry > '20181203070920'))
JOIN `comment` `comment_ipb_reason` ON ((comment_ipb_reason.comment_id = ipb_reason_id)) 
WHERE user_name = 'Quiddity'  ;

So the issue seems to be its using an inner join instead of a left join, so if no block is there, then the join eliminates the row, causing the user to be reported as missing.

Bawolff added a subscriber: Anomie.EditedDec 3 2018, 7:25 AM

So the code (ApiQueryBase::showHiddenUsersAddBlockInfo) was introduced in 27c61fb1, but its probably just showing up now since comment migration was set to read new on group 0 on nov 29 (T166733)

Bawolff renamed this task from API query for userprops not working on testwiki or officewiki or mediawikiwiki to API query for userprops not working on testwiki or officewiki or mediawikiwiki (maybe because comment migration read-new).Dec 3 2018, 7:26 AM
Bawolff added a subscriber: MediaWiki-Comment-backend.

There's no need for this to block T206662, it was not caused by the wmf.8 rollout (which hasn't even happened yet). It does need to block T166733.

Change 477280 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/core@master] API: Use parenthesized join in ApiQueryBase::showHiddenUsersAddBlockInfo

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

Anomie moved this task from Unsorted to Needs Review on the MediaWiki-API board.Dec 3 2018, 2:36 PM
Quiddity renamed this task from API query for userprops not working on testwiki or officewiki or mediawikiwiki (maybe because comment migration read-new) to API query for userprops not working on group0 wikis (maybe because comment migration read-new).Dec 3 2018, 5:28 PM
Quiddity updated the task description. (Show Details)

Change 477280 merged by jenkins-bot:
[mediawiki/core@master] API: Use parenthesized join in ApiQueryBase::showHiddenUsersAddBlockInfo

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

Change 479458 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/core@wmf/1.33.0-wmf.8] API: Use parenthesized join in ApiQueryBase::showHiddenUsersAddBlockInfo

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

Change 479458 merged by jenkins-bot:
[mediawiki/core@wmf/1.33.0-wmf.8] API: Use parenthesized join in ApiQueryBase::showHiddenUsersAddBlockInfo

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

Mentioned in SAL (#wikimedia-operations) [2018-12-13T16:18:33Z] <anomie> Deployed fix for T210937: API: Use parenthesized join in ApiQueryBase::showHiddenUsersAddBlockInfo

Anomie closed this task as Resolved.Dec 13 2018, 4:37 PM

Change 488236 had a related patch set uploaded (by Reedy; owner: Anomie):
[mediawiki/core@REL1_32] API: Use parenthesized join in ApiQueryBase::showHiddenUsersAddBlockInfo

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

Change 488236 merged by jenkins-bot:
[mediawiki/core@REL1_32] API: Use parenthesized join in ApiQueryBase::showHiddenUsersAddBlockInfo

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