Wikipedia:Bots/Requests for approval/CapsuleBot 2

New to bots on Wikipedia? Read these primers!

Operator: Capsulecap (talk · contribs · SUL · edit count · logs · page moves · block log · rights log · ANI search)

Time filed: 00:14, Wednesday, June 14, 2023 (UTC)

Function overview: This task checks the Top 25 Report page frequently to see if the current report has updated. If it was updated, then it will go through all pages in the new report and add or update the Template:Top 25 Report template on their talk pages.

Automatic, Supervised, or Manual: Automatic

Programming language(s): Python

Source code available: No, but if necessary I can upload it

Links to relevant discussions (where appropriate): Wikipedia:Bot requests#Top 25 report

Edit period(s): Daily

Estimated number of pages affected: 25 pages/week

Namespace(s): Talk

Exclusion compliant (Yes/No): No

Function details: This task first checks the page Wikipedia:Top 25 Report to see if the transcluded link was modified. (This should mean that the report was updated.) If it has, then it uses the first revision of the transcluded page, which is always a basic list, to get a list of article talk pages to modify. It then goes through each talk page, updating the Template:Top 25 Report template if it exists and adding it if not. As for exclusion compliance, I have not added that feature in yet.

Discussion edit

The Top 25 report is updated weekly. Why does this task need to run twice a day? Primefac (talk) 09:08, 14 June 2023 (UTC)[reply]

I wanted to ensure that the template is added quickly. I've changed it to daily, and if it should be longer then you can tell me. Capsulecap (talkcontribs) 14:24, 14 June 2023 (UTC)[reply]
Additionally, some reports (including the one for last week) are finished late, and do not get added until later on. I wanted to ensure that the pages on the report get the template on their talk page. If the next report is done on time, then the maintainers of the report will replace the transclusion to the late report with the new one less than a week after the old report replaced the one before it. I agree that twice a day was a bit too excessive. Daily should be fine. Capsulecap (talkcontribs) 14:28, 14 June 2023 (UTC)[reply]
Capsulecap is right about this. And task need to run twice a day.--BabbaQ (talk) 15:58, 14 June 2023 (UTC)[reply]
  • @Capsulecap: Hi. What would happen if the same article comes in top 25 report again, say with a gap of four months? —usernamekiran (talk) 17:21, 21 June 2023 (UTC)[reply]
    If that happens, then there will be no difference from if it was featured twice with more than a four month gap. There is nothing that says to do anything different for pages on T25 which are featured multiple times in a small timespan, and pages like Talk:ChatGPT feature multiple such examples. Capsulecap (talkcontribs) 23:56, 21 June 2023 (UTC)[reply]

  Approved for trial (1 days). Please provide a link to the relevant contributions and/or diffs when the trial is complete. I'm trying to wrap my head around what's this bot supposed to do exactly, so I'm going to approve it for a one-time run of 1 day. This should give me (and perhaps others) a better idea of what this is about. Headbomb {t · c · p · b} 17:34, 2 July 2023 (UTC)[reply]

@Headbomb: Although I did a trial run, the bot made test edits with numerous errors. I have fixed the code causing these issues, and will (with permission) restart the trial when the next report comes in. Capsulecap (talkcontribs) 19:51, 3 July 2023 (UTC)[reply]
@Capsulecap: can you link to the results nonetheless? Headbomb {t · c · p · b} 21:46, 3 July 2023 (UTC)[reply]
See edits 4 through 29. Note that the newest three edits were a test run for a fix to something which happened in Talk:Elemental (2023 film), and that many incorrect edits were caused by other editors modifying talk pages to add the template before the test run was done. Although the bot will not add redundant templates assuming that nobody adds the top 25 placement before it, I am considering adding redundancy protection. One problem — the one on the page about the Titan submarine incident — was one I didn't think of, as the talk page was moved with the main page, causing the top 25 report template to be placed on a redirect instead of the actual talk page. This is a problem I am working on fixing, as I have noticed that "current events" pages that show up on the report often frequently get moved. The bot also ended up creating the page "Talk:Errible things in Russia, the North Atlantic and HBO have the most attention this week.", but I fixed the source issue and tagged the page for CSD. few of the edits are fine, and most would be fine if there was redundancy protection or if the top 25 templates didn't already have the week in there. One question, though — since the bot will run daily, and people wouldn't need to modify top 25 templates anymore — should I implement redundancy protection? Capsulecap (talkcontribs) 02:46, 4 July 2023 (UTC)[reply]
"Should I implement redundancy protection" I would say that's a good idea, regardless of how often it comes into play. Headbomb {t · c · p · b} 02:52, 4 July 2023 (UTC)[reply]
I just finished implementing the redundancy protection along with the redirect traversal stuff. The bot should work just fine now. Do I have to redo the trial? Capsulecap (talkcontribs) 04:35, 4 July 2023 (UTC)[reply]
  Trial complete. See 21 most recent contributions. Out of the 25 pages in the June 25th to July 1st edition, 21 pages were correctly edited, two pages (Talk:Money in the Bank (2023) and Talk:Titan submersible implosion) were not edited because of unexpected and likely erroneous formatting in the report's first revision (a space was in place of the usual tab after those two pages' titles), and two pages were not edited as they already had this week in their templates. For context on those two pages which didn't get the template on accident, the first revision of the report is always an imported set of tab delimited data — in this case, spaces were in place of tabs for the names of those two articles. The bot created two new talk pages on accident, which I quickly tagged for CSD. Capsulecap (talkcontribs) 05:48, 7 July 2023 (UTC)[reply]
Update: I've come up with a solution to this problem and will be implementing and testing it soon. This is the last issue which I will have to fix. Capsulecap (talkcontribs) 16:26, 7 July 2023 (UTC)[reply]

  Approved for extended trial (25 edits or 7 days). Please provide a link to the relevant contributions and/or diffs when the trial is complete. One week's worth, or 25 edits, whichever you need. Headbomb {t · c · p · b} 17:16, 7 July 2023 (UTC)[reply]

  Trial complete. See See 25 most recent contributions. This time, I verified that all edits the bot would make would be correct on a script that had editing commented out. They were all good edits, so I ran the full script. All 25 pages on the report had the template added or changed on their talk pages. Capsulecap (talkcontribs) 01:57, 15 July 2023 (UTC)[reply]
Most seemed fine, but there was this that stood out.
Headbomb {t · c · p · b} 21:59, 20 July 2023 (UTC)[reply]
I noticed that and didn't pay much attention to it as it was merely cosmetic. Since that was considered problematic, I'll get to fixing that and keeping the collapse as the last edit. Capsulecap (talkcontribs) 14:57, 21 July 2023 (UTC)[reply]
For testing you can revert to a prior state and unleash the bot on it. Headbomb {t · c · p · b} 16:17, 21 July 2023 (UTC)[reply]
  Trial complete. See 22 most recent edits. Also see this test edit which the bot made in user talk space showing a similar condition to the page Talk:Deaths in 2023. If you would like, I can manually revert the edit on Talk:Deaths in 2023 which added the newest date and run the bot again to show you. Capsulecap (talkcontribs) 19:58, 21 July 2023 (UTC)[reply]
Well... the collapsed stuff is handled correctly, but now it's inconsistent the other way around. It should list the ranks when they're there, or omit them when they're not.
Or, probably a better idea, update old listings to list the ranks, e.g. [1]. You might need some discussion before though. Headbomb {t · c · p · b} 20:18, 21 July 2023 (UTC)[reply]
I think it's a good idea to retroactively add the rankings to the templates, but I'm not sure of where to obtain consensus for that, and it would either require a bot task or lots of manual work. The other way you listed is probably easier, but causes inconsistency between pages. Something else I thought of is a Lua module that automatically grabs the placements, but I'm not sure if such a thing is supported. Capsulecap (talkcontribs) 20:30, 21 July 2023 (UTC)[reply]
What if it deleted what was there first, then re-added the template with all dates and ranks? In the same edit that is. Headbomb {t · c · p · b} 20:46, 21 July 2023 (UTC)[reply]
It could work, but I think I would have to submit a separate bot task for that. A separate (and much simpler) approach would be to add a "ranks" parameter that does nothing to the bot category. If set to yes, then the bot will add ranks when it updates the report. Otherwise or if unset, the bot will only add the date. This maintains consistency within talk pages, but not between talk pages; the latter would require consensus strongly towards either using ranks or not. Capsulecap (talkcontribs) 21:03, 21 July 2023 (UTC)[reply]
  Approved for extended trial (25 edits). Please provide a link to the relevant contributions and/or diffs when the trial is complete. Indeed, consistency within talk pages is usually a lesser threshold to clear. I'm giving you trial for that (make sure to include a mix of both types of edits), but if you want to have that (should we always rank things) discussion first, you can also wait for consensus to emerge before trialing. Headbomb {t · c · p · b} 21:11, 21 July 2023 (UTC)[reply]
@Capsulecap, are you still doing this? — Qwerfjkltalk 14:43, 11 October 2023 (UTC)[reply]
Yes, I am. Have taken a long break from editing but I never canceled this bot project. Capsulecap (talkcontribs) 15:44, 21 October 2023 (UTC)[reply]

{{Operator assistance needed}} It has been more than a month since the last post, is this trial still ongoing? Primefac (talk) 13:26, 31 December 2023 (UTC)[reply]

Yes. As I said a long time ago, I wasn't really maintaining activity onwiki or paying attention to this page. I've decided to come back to wikipedia at some point in the near future (within 1-2 months) but I can add the features to the project. Thanks for reaching out. Capsulecap (talkcontribs) 22:27, 5 January 2024 (UTC)[reply]
@Primefac: I've added support for that ranks attribute, as is seen in the 5 most recent bot edits, all of which are to my test pages. I've also created support for converting preexisting top25 templates of the alternate form into regular form top 25s, and made it so top 25 report templates longer than 800 bytes are collapsed. I will test the bot once the report is switched to the current week, which should be on Saturday or Sunday. Capsulecap (talkcontribs) 01:34, 6 January 2024 (UTC)[reply]
@Primefac: Status: Current run had too many problems to use as a final trial. Fixed 2 bugs here. Should be ready to be released any week now. Capsulecap (talkcontribs) 03:27, 15 January 2024 (UTC)[reply]
@Primefac: Status: Apparently what I said above was wrong. The bot works fine on the average page but I forgot to put the ranks parameter on new templates. That has since been fixed. However, there are several larger problems that I discovered on this run — the bot broke another bot's template that was split over two lines (how rude of it!), and the entries in the report were changed from the first entry, necessitating me to delete templates from two talk pages. For some reason it also ignored the page Franz Beckenbauer in the first revision, but that shouldn't be a problem once I manage to switch over to using the newest revision with tables. Also created a list at User:CapsuleBot/Todo. Capsulecap (talkcontribs) 02:36, 20 January 2024 (UTC)[reply]