Page MenuHomePhabricator

Pywikibot: welcome.py doesn't add signature correctly (arwikinews only)
Closed, ResolvedPublicBUG REPORT

Description

Background information

  • In T109225 (August 2015), I requested the addition of the local welcome template on Arabic Wikinews (arwikinews) to welcome.py
  • The chang was committed to the compat branch in gerrit:231894 and to the core branch (without the "u" for Unicode) in gerrit: 231892
  • (No bug up until this point)
  • In T210480 (November 2018), I requested to add the local version of the welcome template to several projects (but not arwikinews).
  • The requested change was committed in gerrit: 475966
  • Around that time, I stopped using the compat branch and started running my bot using the core branch.

Steps to Reproduce:

Run the following command on arwikinews

python pwb.py welcome.py -edit:0 -nlog -sul -limit:5000 -lang:ar -family:wikinews

Actual Results:

  • The bot adds the welcome template as expected but can't add the signature correctly.
  • Eample of wrong edits: Edit 1, Edit 2, Edit 3 (These are the earliest wrong edits, all dated on 27 November 2018)

Expected Results:

  • The bot should be able to add the signature correctly.
  • Examples of correct edits Edit 1, Edit 2, Edit 3 (These are the last correct edits from before 27 November 2018)

Notes

  • This bug affects only arwikinews but not other projects (although I use the same exact configuration for the 6 Arabic sister projects, namely arwiktionary, arwikibooks, etc)
  • This bug started only from November 2018. Bot edits before that date on arwikinews are OK.
  • 27 November 2018 is the date of gerrit: 475966 (So, may be it is related?)

Event Timeline

I can reproduce this, but I don't know, what causes this.

There are some bugs in the current welcome.py e. g using old compat functions which aren't ported to core. I started rewriting some code parts, Most of them aren’t merged yet. I’ll have a look too probably tomorrow.

Xqt triaged this task as Medium priority.May 12 2019, 8:16 PM

I found that problem in these lines:

elif (self.site.family.name != 'wikinews'
      and self.site.code != 'it'):

maybe it must be

elif not (self.site.family.name == 'wikinews'
      and self.site.code == 'it'):

or

elif (self.site.family.name != 'wikinews'
      or self.site.code != 'it'):

Change 509751 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [bugfix] Add defaultSign to welcome_text

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

Change 509751 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] Add defaultSign to welcome_text

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

The above if seems broken too, I can think of more cases, when this would produce no signature, but this is for some future patches.

btw this bug was introduced on compat very early in https://www.mediawiki.org/wiki/Special:Code/pywikipedia/8196 but I've no glue why it should have worked in meantime. I guess this issue is more or less academic ;)

There are more hidden early-compat issues like that somewhere I guess :) :/

The above if seems broken too, I can think of more cases, when this would produce no signature, but this is for some future patches.

The timeselected is not added for wiktionary:it (there is an or instead of the and) but sure I cannot follow why randomSign is excluded on wikinews. Anyway this is another issue.