Page MenuHomePhabricator

pywikbot page.save ignores bot status (does not set bot flag on changes)
Closed, InvalidPublicBUG REPORT

Description

When using pywikibot to do a page change the bot flag is not set to edit. The calling bot have bot flag for the bot user.

Steps to replicate the issue (include links if applicable):

It is called either
page.save(summary="ChemoBot: ...", minor=False)
or
page.save(summary="ChemoBot: ...", minor=False, bot=True)

What happens?:

In both cases the changes are not marked as bot changes, therefore it is not possible for autors to filter these bot edits from there watchlist.
The call of these function does not give any error. Using BotFlag as parameter instead of bot parameter leads to deprecated warning (documentation outdated on many places).

Bot User: ChemoBot

Recent changes (Recent changes) where last change from this list (Diazanaphthaline) is called with bot parameter (bot=True) as above. Second last is called with botflag parameter (botflag=True) instead. Any changes before are without bot/botflag parameter.

What should have happened instead?:
Changes should get the bot flag (rc_bot flag in edit). See also list of changes by wmcloud.org/quer which shows the flags also.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
pywikibot 9.3

Other information (browser name/version, screenshots, etc.):
Bot was reenabled some days before.
To name the flag simply "bot" instead of change_flag_bot or similar is a bad idea, because it is neither self explaining nor helpful if you try to search them in bug list, because search for "bot" list nearly anything

Event Timeline

Does the bot password you are using have the highvolume grant?

@Rjh: you cannot see the botflag on bot's user contribution given above. You have to investigate the RC instead. bot flag is set by default if the account has bot rights even the flag parameter is not passed to save method. To suppress that flag it has to be set to False.

The bot rights was granted after the edits. Maybe the flag cannot be set on MW side if this right is missing. I have to investigate this.

@JJMC89 : No, should I? Also single edits does not have the bot change flag.
@Xqt : Sorry I'm not familar with the abbreviations. What is RC or MW (Mediawiki ?) I printed out the user info, which is used to automatic set of the bot flag in the pywikibot.

self.userinfo = {'id': 867493, 'name': 'ChemoBot', 'messages': True, 'groups': ['bot', 'editor', '*', 'user', 'autoconfirmed'], 'rights': ['ipblock-exempt', 'autoconfirmed', 'editsemiprotected', 'nominornewtalk', 'autopatrol', 'suppressredirect', 'autoreview', 'skipcaptcha', 'unreviewedpages', 'patrolmarks', 'read', 'edit', 'createpage', 'createtalk', 'abusefilter-view', 'abusefilter-log', 'move-rootuserpages', 'move-categorypages', 'minoredit', 'applychangetags', 'changetags', 'move', 'abusefilter-log-detail'], 'ratelimits': {'move': {'user': {'hits': 8, 'seconds': 60}}, 'edit': {'user': {'hits': 90, 'seconds': 60}}, 'badcaptcha': {'user': {'hits': 30, 'seconds': 60}}, 'changeemail': {'user': {'hits': 4, 'seconds': 86400}}, 'rollback': {'user': {'hits': 100, 'seconds': 60}}, 'purge': {'user': {'hits': 30, 'seconds': 60}}, 'linkpurge': {'user': {'hits': 30, 'seconds': 60}}, 'renderfile': {'user': {'hits': 700, 'seconds': 30}}, 'renderfile-nonstandard': {'user': {'hits': 70, 'seconds': 30}}, 'cxsave': {'user': {'hits': 10, 'seconds': 30}}, 'thanks-notification': {'user': {'hits': 10, 'seconds': 60}}, 'badoath': {'user': {'hits': 10, 'seconds': 60}}, 'growthmentordashboardupdatedata': {'user': {'hits': 1, 'seconds': 7200}}, 'growthexperimentsuserimpacthandler': {'user': {'hits': 10, 'seconds': 86400}}, 'growthexperiments-apiqueryimagesuggestiondata': {'user': {'hits': 500, 'seconds': 86400}}}}

It looks like the ChemoBot is in the group of bots, but miss the rights of a bot. At least the sourcecode check if the the value "bot" is in the the rights part. At least this is the reason, why the automatic set is not working. But also if I override that manually the bot flag in the change is not set. So that supports your thought that it is filtered out by Mediawiki.

I have the fealing that the admins which added the bot to the bots group missed something.
If this is right it might be good to add an warning message in the code, if someone forces the bot flag to true in the save function, but the right is not there. And the question is, what can I do to get this right?

Yes, seems that the bot right is missing. For example Xqbot has it:

batchcomplete": "",

"query": {
    "userinfo": {
        "id": 721234,
        "name": "Xqbot",
        "groups": [
            "bot",
            "*",
            "user",
            "autoconfirmed"
        ],
        "rights": [
            "noratelimit",
            "bot",
            "autoconfirmed",

@JJMC89 : No, should I? Also single edits does not have the bot change flag.

Yes, it is required. Without the bot right, edits cannot be flagged as a bot.

I have the fealing that the admins which added the bot to the bots group missed something.

No, you are missing the required grant for the bot password.

Change #1068698 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [IMPR] Add hints if an account is member of bot group but has no bot right

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

Change #1068698 merged by jenkins-bot:

[pywikibot/core@master] [IMPR] Add hints if an account is member of bot group but has no bot right

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