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.

Details

Related Gerrit Patches:

Event Timeline

whym created this task.Apr 12 2019, 2:54 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 12 2019, 2:54 PM
Restricted Application added a project: Pywikibot. · View Herald TranscriptApr 12 2019, 2:55 PM
Restricted Application added a subscriber: pywikibot-bugs-list. · View Herald Transcript

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

whym added a comment.Apr 13 2019, 1:17 AM

@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)
Xqt added a subscriber: Xqt.Apr 13 2019, 3:26 PM
  • 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?

Dvorapa added a comment.EditedApr 13 2019, 5:28 PM

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.

whym updated the task description. (Show Details)Apr 14 2019, 12:15 AM
whym updated the task description. (Show Details)Apr 14 2019, 12:22 AM

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".
Mpaa added a subscriber: Mpaa.Jul 16 2019, 7:42 PM

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 closed this task as Resolved.Jul 19 2019, 9:54 PM
Xqt claimed this task.
whym added a comment.Jul 22 2019, 8:55 AM

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.