Page MenuHomePhabricator

archivebot.py: don't reorder template parameters
Closed, ResolvedPublicBUG REPORT

Description

Archivebot should not reorder template parameters.

Example:
In https://commons.wikimedia.org/w/index.php?title=User_talk:Carlos_yo&diff=prev&oldid=345742621 and in https://commons.wikimedia.org/w/index.php?title=Commons_talk:Structured_data&diff=prev&oldid=345635841 , archiveheader and minthreadstoarchive got reversed.

While reordering doesn't make any difference semantically, it makes diffs more cluttered than they should be. At least that's what I think @Jeff_G was concerned about when he reported it.

I can think of two approaches:

  1. Remember the pre-edit parameter order and reproduce it when saving. If new parameters have to be added, they should be at the bottom.
  2. Always sort the parameters alphabetically - this is easier to implement but it can produce a cluttered diff at first against non-sorted templates.

Event Timeline

Restricted Application added a subscriber: pywikibot-bugs-list. · View Herald Transcript

This has been fixed a while ago. Which Pywikibot version does ArchiverBot use?

@Dvorapa in which commit was it fixed?

https://commons.wikimedia.org/w/index.php?title=Commons_talk:Structured_data&diff=prev&oldid=345635841 was done using this version: b77a0534576bca6556a92081bd8b0fdb532a645b (at least that's what I believe), and it looks like the problem is still there? It reordered parameters into a non-alphabetical order.

In 14f2ded70c288275157163a5b4cc7128e2f29adf. The order was set to following:

  • archive
  • algo
  • counter
  • maxarchivesize
  • other parameters in the order they've been found (which still differs between Python 2 and 3, but if your bot uses only one Python version, then it should be fine)
  • other parameters in the order they've been found (which still differs between Python 2 and 3, but if your bot uses only one Python version, then it should be fine)

Can we solve it for these other parameters too?

Like setting their initial empty value?

Anyway the example in the description seems like there was Pywikibot downgraded OR Python version changed between 2 and 3 on outdated Pywikibot version. Weird.

Sorry, the link in the description was not adequate - it was done before I updated Pywikibot. I replaced it with newer examples.

Okay, examples now show just the fiddling with optional parameters. The fix was easy for mandatory parameters, but it may not be an easy task for optional parameters.

As of this diff 07:48, 3 July 2019 (UTC), it is thankfully no longer shuffling parameters on my user talk page on Commons.

However, as of this diff 07:59, 14 July 2019 (UTC) it is still happening.

Xqt triaged this task as Medium priority.Jul 14 2019, 9:28 AM
Xqt changed the subtype of this task from "Task" to "Bug Report".

Wouldn't loading config from self.page.raw_extracted_templates instead of self.page.templatesWithParams() keep the right order?

Change 524305 had a related patch set uploaded (by Mpaa; owner: Mpaa):
[pywikibot/core@master] archivebot.py: don't reorder template parameters

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

Change 524305 merged by jenkins-bot:
[pywikibot/core@master] archivebot.py: don't reorder template parameters

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

Xqt claimed this task.

Note to @Jeff_G: you might still see the bug on Commons, but that's expected. It might take some time before I update ArchiverBot@Commons to reflect the bug fix. (Maybe next weekend.)

Note to @Jeff_G: you might still see the bug on Commons, but that's expected. It might take some time before I update ArchiverBot@Commons to reflect the bug fix. (Maybe next weekend.)

Thanks.