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 Approved.
Operator: Cyberpower678 (talk · contribs · SUL · edit count · logs · page moves · block log · rights log · ANI search)
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
[edit]- I ran a few tests and everything checks out.—cyberpower ChatOffline 16:24, 14 January 2013 (UTC)[reply]
- 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· Talk To Me! 18:51, 14 January 2013 (UTC)[reply]
- 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)[reply]
- Even if, multiple jobs doing such tasks don't hurt the ecosystem of Wikipedia. ;-) mabdul 19:17, 14 January 2013 (UTC)[reply]
- 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)[reply]
- 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· Talk To Me! 18:51, 14 January 2013 (UTC)[reply]
- 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)[reply]
- Approved for trial (7 days). Please provide a link to the relevant contributions and/or diffs when the trial is complete. MBisanz talk 23:54, 14 January 2013 (UTC)[reply]
- 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)[reply]
- It tags immediately. It removes immediately. The longest wait is probably 5 minutes.—cyberpower ChatOnline 03:57, 15 January 2013 (UTC)[reply]
- 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)[reply]
- 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)[reply]
- Fixed I found the problem and fixed it.—cyberpower ChatOffline 04:54, 15 January 2013 (UTC)[reply]
- It removed a pp-protected tag from Texas Chainsaw 3D, incorrectly I believe? Amalthea 09:14, 15 January 2013 (UTC)[reply]
- 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)[reply]
- Fixed I have found the bug and confirmed the fix per this and this. It will no longer do this.—cyberpower ChatOnline 03:28, 17 January 2013 (UTC)[reply]
- The confirmed flag can be removed now.—cyberpower ChatOffline 05:10, 15 January 2013 (UTC)[reply]
- Y Done. Amalthea 09:14, 15 January 2013 (UTC)[reply]
- It also erased the Holy Week article.
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)[reply]
- A simple check against original page size should fix this. ·Add§hore· Talk To Me! 21:50, 16 January 2013 (UTC)[reply]
- 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 ChatOffline 22:17, 16 January 2013 (UTC)[reply]
- A simple check against original page size should fix this. ·Add§hore· Talk To Me! 21:50, 16 January 2013 (UTC)[reply]
Would you mind making the source code public for review? --Chris 14:33, 17 January 2013 (UTC)[reply]
- Sure. As soon as my computer is available I will post it.—cyberpower ChatOffline 15:14, 17 January 2013 (UTC)[reply]
- User:Cyberbot II/Run/PC/source—cyberpower ChatOffline 16:52, 17 January 2013 (UTC)[reply]
- 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 ChatOffline 16:57, 17 January 2013 (UTC)[reply]
- User:Cyberbot II/Run/PC/source—cyberpower ChatOffline 16:52, 17 January 2013 (UTC)[reply]
- 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 init_page 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 get_text from the edit, 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
{{ pp-pc1}}
, and incorrectly matches {{P-PC1/sandbox}}. 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 prependtext 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
- 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:
- Amalthea 19:48, 17 January 2013 (UTC)[reply]
- Thank you Amalthea. I give you a more detailed reply later.—cyberpower ChatOnline 23:17, 17 January 2013 (UTC)[reply]
- 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 ChatOnline 01:50, 18 January 2013 (UTC)[reply]
- I'd have some suggested changes there, for stability and resource usage.
Trial complete. 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 ChatOnline 01:01, 22 January 2013 (UTC)[reply]
- 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 ChatOnline 23:17, 24 January 2013 (UTC)[reply]
- I'm still here just to let everyone know. No luck with the toolserver yet.—cyberpower ChatLimited Access 14:19, 28 January 2013 (UTC)[reply]
- Try for a Wikipedia:Labs account? ·Add§hore· Talk To Me! 23:15, 28 January 2013 (UTC)[reply]
- Good news. I have re-established access to my toolserver. I will modify the code sometime with in the next 2 weeks.—cyberpower ChatOnline 15:38, 5 February 2013 (UTC)[reply]
- 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)[reply]
- Why not. I like it.—cyberpower OnlineBe my Valentine 23:29, 14 February 2013 (UTC)[reply]
- I just think there are more up to date frameworks:). Any further updates? ·Add§hore· Talk To Me! 22:59, 22 February 2013 (UTC)[reply]
- 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 ChatOnline 23:12, 22 February 2013 (UTC)[reply]
- Re-write complete, performing final tests.—cyberpower ChatOnline 00:45, 27 February 2013 (UTC)[reply]
- 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 ChatOnline 23:12, 22 February 2013 (UTC)[reply]
- I just think there are more up to date frameworks:). Any further updates? ·Add§hore· Talk To Me! 22:59, 22 February 2013 (UTC)[reply]
- Why not. I like it.—cyberpower OnlineBe my Valentine 23:29, 14 February 2013 (UTC)[reply]
- {{BAGAssistanceNeeded}} I have rewritten the script for efficiency of resources now. I have run some tests and believe another trial is in order.—cyberpower ChatOnline 02:58, 27 February 2013 (UTC)[reply]
- Approved for trial (5 days). Please provide a link to the relevant contributions and/or diffs when the trial is complete. ·Add§hore· Talk To Me! 03:22, 27 February 2013 (UTC)[reply]
- 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.
- Trial complete. Edits look good. No blanking issues present.—cyberpower ChatAbsent 20:18, 4 March 2013 (UTC)[reply]
- Approved. ·Add§hore· Talk To Me! 14:27, 6 March 2013 (UTC)[reply]
- 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.
- 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.