Wikipedia:Bots/Requests for approval/Cyberbot II 1


 * The following discussion is an archived debate. Please do not modify it. To request review of this BRFA, please start a new section at WT:BRFA. The result of the discussion was Symbol keep vote.svg Approved

Cyberbot II 1
Operator:

Time filed: 15:21, Monday January 14, 2013 (UTC)

Automatic, Supervised, or Manual: Automatic

Programming language(s): PHP

Source code available: Per request

Function overview: Add and remove PC protection templates from protected and non-protected pages respectively.

Links to relevant discussions (where appropriate): Uncontroversial task

Edit period(s): Continuous

Estimated number of pages affected: About 1-10 pages a day. Initial run may be higher.

Exclusion compliant (Yes/No): Yes, but unnecessary.

Already has a bot flag (Yes/No): No

Function details: The bot obtains a list of pages that have pending changes protected on it and applies the appropriate level protection template. It then looks at all the pages with a protection template and checks if they have that respective protection on it. If not, it will remove it.

Task switch: Click to enable

Discussion

 * I ran a few tests and everything checks out.— cyberpower ChatOffline 16:24, 14 January 2013 (UTC)
 * Sounds like a good task. I'm guessing PC protection isnt covered by the other bots which check for the templates on article pages?  ·Add§hore·  T alk T o M e ! 18:51, 14 January 2013 (UTC)
 * I think Sigma was working on integrating this into his bot (discussion), however I don't know if he ever finished it. Legoktm (talk) 18:57, 14 January 2013 (UTC)
 * Even if, multiple jobs doing such tasks don't hurt the ecosystem of Wikipedia. ;-) mabdul 19:17, 14 January 2013 (UTC)


 * I asked Sigma to comment here on the status of his bot. More than one bot in operation shouldn't be an issue.— cyberpower ChatOffline 20:04, 14 January 2013 (UTC)


 *  MBisanz  talk 23:54, 14 January 2013 (UTC)


 * I am working on integrating this task into my bot, and strongly believe that we should not have multiple bots covering the same task. How long will Cyberbot wait before tagging a page? → Σ σ  ς . (Sigma) 00:57, 15 January 2013 (UTC)
 * It tags immediately. It removes immediately.  The longest wait is probably 5 minutes.— cyberpower ChatOnline 03:57, 15 January 2013 (UTC)
 * Sigma, I'm not really sure why you think this kind of task should not have multiple bots running it. It seems like the kind of task, to me, that doesn't really matter how many bots do it, as long as they all check for edit conflicts, of course. - Kingpin13 (talk) 09:22, 17 January 2013 (UTC)


 * Aside from this, everything seems to be running fine. Will look into what's causing the uncertainty.— cyberpower ChatOffline 04:08, 15 January 2013 (UTC)
 * ✅ I found the problem and fixed it.— cyberpower ChatOffline 04:54, 15 January 2013 (UTC)
 * from Texas Chainsaw 3D, incorrectly I believe? Amalthea  09:14, 15 January 2013 (UTC)
 * Not sure what happened. The bot wasn't designed to remove other tags.  Will have to look into to that.— cyberpower ChatOffline 13:20, 15 January 2013 (UTC)
 * ✅ I have found the bug and confirmed the fix per this and this. It will no longer do this.— cyberpower Chat<sub style="margin-left:-4.4ex;color:olive;font-family:arnprior">Online 03:28, 17 January 2013 (UTC)
 * The confirmed flag can be removed now.— cyberpower <sup style="color:red;font-family:arnprior">Chat<sub style="margin-left:-4.4ex;color:red;font-family:arnprior">Offline 05:10, 15 January 2013 (UTC)
 * ✅ Done. Amalthea  09:14, 15 January 2013 (UTC)
 * It also . Would you consider turning the bot off until this and the above issue are resolved, and maybe make the source code available so that others can sanity-check the code? Amalthea  21:47, 16 January 2013 (UTC)
 * A simple check against original page size should fix this.  ·Add§hore·  <sup style="color:black;">T alk T o M e ! 21:50, 16 January 2013 (UTC)
 * There was a temporary API failure from what I gather from the logs. The get page call gave the bot an empty string so it returned an empty string plus a tag.  As to why the other tag was removed, I believe I see the issue in the code and the bug is set off if the tag is placed right after another protection tag.— cyberpower <sup style="color:red;font-family:arnprior">Chat<sub style="margin-left:-4.4ex;color:red;font-family:arnprior">Offline 22:17, 16 January 2013 (UTC)

Would you mind making the source code public for review? -- Chris 14:33, 17 January 2013 (UTC)
 * Sure. As soon as my computer is available I will post it.— cyberpower <sup style="color:red;font-family:arnprior">Chat<sub style="margin-left:-4.4ex;color:red;font-family:arnprior">Offline 15:14, 17 January 2013 (UTC)
 * User:Cyberbot II/Run/PC/source— cyberpower <sup style="color:red;font-family:arnprior">Chat<sub style="margin-left:-4.4ex;color:red;font-family:arnprior">Offline 16:52, 17 January 2013 (UTC)
 * Note: I have updated the code to check to make sure the buffer matches the actual source. This will also convieniently reduce edit conflicts as well.  This will allow for another bot to run this task simultaneously.— cyberpower <sup style="color:red;font-family:arnprior">Chat<sub style="margin-left:-4.4ex;color:red;font-family:arnprior">Offline 16:57, 17 January 2013 (UTC)


 * I'd have some suggested changes there, for stability and resource usage.
 * Most fundamentally, you are currently querying the page content of every flagged page (multiple times even). I'm not familiar with that bot framework, but I assume it's using the API, not the toolserver database, so that's very wasteful. Instead, I would recommend to restructure the code to test all pages like you already do when removing tags:
 * Get all transclusions of pp-pc1 and pp-pc2
 * Get the list of all flagged pages with their protection levels
 * Iterate through all flagged pages, test whether the required template is already on the page by checking the respective transclusion list. If it's missing, add it. Bonus is that you can avoid parsing the page for existence of the template, the current regex isn't quite right, and it's impossible to get it completely right without duplicating the entire MediaWiki parser
 * The edits don't guard against edit conflicts. I am, again, not familiar with the framework, but I assume the page object you get back from <tt>init_page</tt> alrady contains everything you need to do that, it may be sufficient to simply reuse the same page object. So only init a given page once, if you separate the <tt>get_text</tt> from the <tt>edit</tt>, you risk that another editor's changes are completely overwritten without warning or edit conflict recognition. If this is X!'s framework then you could ask him about it.
 * It seems like there should be a way to get the list of flagged pages from the API, but at a glance I don't see a (sane) way. Screen-scraping is a pain though, makes it much more likely that the bot breaks with updates
 * The regex to remove the transclusion could be revised to be more exact. E.g., it currently incorrectly misses, and incorrectly matches <tt>  </tt>. Like I said before it's not practical to get it completely right, but it can be made a bit more precise.
 * For adding the template, I would advise to use the <tt>prependtext</tt> feature from the editing API. That way, you don't need to get and resubmit the existing page content at all.
 * For maintainability, avoid code duplications. Both when adding and removing texts, there are significant chunks of code copy/pasted. That works, but is harder to maintain and comprehend. It would be appropriate to turn those blocks into functions, just pass the few bits that are different as parameters
 * Amalthea 19:48, 17 January 2013 (UTC)
 * Thank you Amalthea. I give you a more detailed reply later.— cyberpower <sup style="color:olive;font-family:arnprior">Chat<sub style="margin-left:-4.4ex;color:olive;font-family:arnprior">Online 23:17, 17 January 2013 (UTC)
 * I will take up your suggestions and be more careful coding new scripts next for my next tasks and requests. I looked through the API to see if I can query it to obtian PC protected pages, but I couldn't find one.  I am more than willing to constantly update page scratching code to acheive the desired goal as long as the API doesn't yet support it.  Once it does, I will write a new subcommand into the framework to allow for this.  The framework is called Peachy, and it's written by X!, although, he admits he no longer knows how it works.  I learned the Peachy Framework by reading it.  I'm still exploring its capabilities and update the minor bugs I find when going through it.— cyberpower <sup style="color:olive;font-family:arnprior">Chat<sub style="margin-left:-4.4ex;color:olive;font-family:arnprior">Online 01:50, 18 January 2013 (UTC)

Given the issues raised. The bot shouldn't be approved yet. Though most of edits are good, per Amalthea, the code needs some more love. I'll post the new code once I have it updated.— cyberpower <sup style="color:olive;font-family:arnprior">Chat<sub style="margin-left:-4.4ex;color:olive;font-family:arnprior">Online 01:01, 22 January 2013 (UTC)


 * I have some rather unfortunate news. While doing a little bit of spring cleaning on my computer, I inadvertently, permanently, deleted the ppk file for toolserver, so I now I can't access my bot source at the moment.  Will advise if anything changes.— cyberpower <sup style="color:olive;font-family:arnprior">Chat<sub style="margin-left:-4.4ex;color:olive;font-family:arnprior">Online 23:17, 24 January 2013 (UTC)
 * I'm still here just to let everyone know. No luck with the toolserver yet.— cyberpower <sup style="color:\#FF8C00;font-family:arnprior">Chat<sub style="margin-left:-4.4ex;color:\#FF8C00;font-family:arnprior">Limited Access 14:19, 28 January 2013 (UTC)
 * Try for a Labs account?  ·Add§hore·  <sup style="color:black;">T alk T o M e ! 23:15, 28 January 2013 (UTC)


 * Good news. I have re-established access to my toolserver.  I will modify the code sometime with in the next 2 weeks.— cyberpower <sup style="color:olive;font-family:arnprior">Chat<sub style="margin-left:-4.4ex;color:olive;font-family:arnprior">Online 15:38, 5 February 2013 (UTC)
 * Recoding in progress...
 * Phase 1: Modifying and updating Peachy framework.
 * Why are you using peachy? :P  ·Add§hore·  Talk To Me! 22:59, 14 February 2013 (UTC)
 * Why not. I like it.— cyberpower <sub style="color:olive;font-family:arnprior">Online <sup style="margin-left:-6.1ex;color:olive;font-family:arnprior">Be my Valentine 23:29, 14 February 2013 (UTC)
 * I just think there are more up to date frameworks:). Any further updates?  ·Add§hore·  Talk To Me! 22:59, 22 February 2013 (UTC)
 * My entire bot runs on Peachy. I don't really feel like rewriting it.  Especially since I don't have the time to.  Besides, I have plans for Peachy 2 and am considering to release it into public domain for everyone to use as well.— cyberpower <sup style="color:olive;font-family:arnprior">Chat<sub style="margin-left:-4.4ex;color:olive;font-family:arnprior">Online 23:12, 22 February 2013 (UTC)
 * Re-write complete, performing final tests.— cyberpower <sup style="color:olive;font-family:arnprior">Chat<sub style="margin-left:-4.4ex;color:olive;font-family:arnprior">Online 00:45, 27 February 2013 (UTC)


 * BAGAssistanceNeeded I have rewritten the script for efficiency of resources now. I have run some tests and believe another trial is in order.— cyberpower <sup style="color:olive;font-family:arnprior">Chat<sub style="margin-left:-4.4ex;color:olive;font-family:arnprior">Online 02:58, 27 February 2013 (UTC)
 *  ·Add§hore·  Talk To Me! 03:22, 27 February 2013 (UTC)
 * Task running. Found and fixed this bug, where the bot was repeatedly edit warring with itself.  Turns out I forgot to shut off the follow redirect function, and it was following a redirect of Chris Lee (referee) which is PC1 and fully protected for some reason.
 * Edits look good. No blanking issues present.— cyberpower <sup style="color:black;font-family:arnprior">Chat<sub style="margin-left:-4.4ex;color:black;font-family:arnprior">Absent 20:18, 4 March 2013 (UTC)
 *  ·Add§hore·  Talk To Me! 14:27, 6 March 2013 (UTC)
 * The above discussion is preserved as an archive of the debate. Please do not modify it. To request review of this BRFA, please start a new section at WT:BRFA.