Wikipedia talk:Interceptor
From Wikipedia, the free encyclopedia
Welcoming/thanking option
Hello, I use CVPI when on mobile and I really like it! As a suggestion, can you add a feature that welcomes or thanks users? I would like to use it when i find obviously good edits but do not currently have the option to do so without exiting out of the tab. FantasticWikiUser (talk) 14:28, 1 February 2026 (UTC)
- Also, I just came across what I think might be a glitch where CVPI overrode the level 4 warning with a level 3 one instead of reporting to AIV. The warning before that was a level 2 warning, I think that's what caused the glitch if it is one. FantasticWikiUser (talk) 15:02, 1 February 2026 (UTC)
- Hey @FantasticWikiUser! "Welcome" and "thanks" buttons are in the works, but will probably have to come after I refactor some of how the page is rendered (it's getting pretty spaghetti). As far as the override thing, it looks like that edit was an edit conflict arising from the other editor adding their warning in the tiny fraction of a second between CVPI reading the vandal's talk page and CVPI saving the talk page with the new content. I've never seen that before, and I'll see if there's a better way to handle those edge cases so it doesn't happen again :) --tony 15:07, 2 February 2026 (UTC)
- Okay. FantasticWikiUser (talk) 15:57, 2 February 2026 (UTC)
- Hey @FantasticWikiUser! "Welcome" and "thanks" buttons are in the works, but will probably have to come after I refactor some of how the page is rendered (it's getting pretty spaghetti). As far as the override thing, it looks like that edit was an edit conflict arising from the other editor adding their warning in the tiny fraction of a second between CVPI reading the vandal's talk page and CVPI saving the talk page with the new content. I've never seen that before, and I'll see if there's a better way to handle those edge cases so it doesn't happen again :) --tony 15:07, 2 February 2026 (UTC)
Changes to Edit API params
Pinging @LuniZunie: and @Ingenuity:. I wanted to share something I just changed in Interceptor that may also be applicable for AntiVandal and WikiShield. I was going to post this on both tools' talk pages but figured it might be easier to consolidate here.
A few days ago, a user (in the topic above) used Interceptor to automatically leave a warning on a user talk page after issuing a rollback, but this happened instead. It turns out another user had added their own warning at essentially the exact same time.
As a broad and extremely simplified outline, the "warning" logic for AntiVandal, WS, and CVPI goes something like:
- Trigger an API call to retrieve the entire text of the user's talk page, if it exists, and store it in some variable (we'll call it
content) - Add the appropriate warning to
content - Trigger an API call to edit the user's talk page, setting the entire text of their page to
content
This takes only a fraction of a second and normally works perfectly fine. However, there's an edge case where if another user modifies the page between step 1 and step 3, the script doesn't know about that change, and the other user's change is overwritten.
Fortunately, MediaWiki's Edit API has a property called "baserevid", which appears to be the solution. All we need to do is add a baserevid param to the edit API call. That "baserevid" param should match the ID of the revision we're expecting to edit. If it doesn't match, MediaWiki rejects the edit and throws an editconflict exception. We omit that param if the user talk page is being newly created.
I pushed that change to CVPI's test instance yesterday and to production today, but I wanted to share what I learned since it appears that WikiShield and AntiVandal don't use that param, and it's probable this issue is silently occurring there as well. --tony 19:23, 4 February 2026 (UTC)
- @TonySt I will look into this, I am aware of the
baserevidsystem (you should also check outbasetimestampandstarttimestamp!), but I use a different system to send talk page warnings. I have it directly edit (or create) the proper section, so usingbaserevidwould make it so an edit in another section would cause an edit conflict failure even though no edit conflict should actually occur. I should add, that I think this is really good to be sharing, as a user pointed out to me early on in WIkiShield's development, that it may be better for the community if we work together, at least to some degree, on the development of these apps. – LuniZunie(talk) 19:31, 4 February 2026 (UTC) - @TonySt Don't know if you know of these, but I thought I would add some things that I found out.
oresscoresometimes is not added to the edit when fetching the edit, however, if you wait a bit, it may be added. So, WikiShield holds a "cache" of edits where theoresscorewas not attached, and on the next run through it queries those revisions again. Rarely, it still won't add theoresscoreafter a while, so I have a limit of 3 iterations before it just sends anoresscoreofNaN(which just gets turned into0later on).- Another thing with
oresscore, there are two different models,goodfaithanddamaging(both withtrueandfalseproperties, thefalsebeing the inverse oftrue), AV usesgoodfaith.false, but I changed this on WS to be(damaging.true + goodfaith.false) / 2. Though, I have been looking for a better equation as I assume these can be weighted differently to give a more accurate result. - It is possible for a rollback to be seen as successful, but still be an edit conflict (which leads to a double warning possibly being sent to the user, or a level 4 warning leading to an early report). To fix this, WS has a check after the rollback to see if the latest revision of the page is your rollback. If any error occurs, it does not send a warning, nor does it report, even if the rollback was successful (AV has this too I believe).
- Make sure your warning level detection can accurately detect the warning level even if the comment is unsigned, it's a really rare error to come across so you would likely miss it in testing, but it can cause some problems.
- Oversight'd and revdel'd edits will likely cause an error, maybe even a fatal one. Again, it is really rare to get this to happen in testing, but I have had it happen before and it threw tons of errors as requesting the
compareapi method on a removed diff will throw an error. - If you are going to test your app,
test2wikiis closer related toenwikithantestwikiis toenwiki. I still am yet to figure out getting rollback ontest2wiki(for know I just have a bypass hard coded in), buttest2wikihas stuff like pending changes, OAuth, and many more things thattestwikijust doesn't have. There is also the betaenwikiwhich can be helpful to use. - If you are using the API using
fetch()(notnew mw.Api()), MAKE SURE TO SET A USER AGENT AS DEFINED HERE. I got my IP completely blocked from making scripted requests to any of the Wikimedia projects for a while, and it was not fun.
- Anyways, hope some of these help, and have fun coding =) Cheers! – LuniZunie(talk) 14:24, 5 February 2026 (UTC)
- Thank you for all this info! CVPI deals with most of those cases pretty well, with the exception of signatureless warnings (it failsafes to ignoring those). I'll be honest, the
goodfaithvsdamagingmodels are things I never really thought about after I had a working oresscore fetching and parsing system. The averaging you're describing is really interesting -- I'll have to tinker with that :) tony 16:26, 5 February 2026 (UTC)
- Thank you for all this info! CVPI deals with most of those cases pretty well, with the exception of signatureless warnings (it failsafes to ignoring those). I'll be honest, the
CVPI.js
Doesn't Method 2: Add {{subst:lusc|User:TonySt/CVPI.js}} to your common.js. need an importscript? When I add it to my common.js, I get five errors: Expected a string and instead saw {. — Expected ':' and instead saw 'subst'. — Expected a JSON value. — Expected '}' and instead saw ':'. — Unrecoverable syntax error. (66% scanned).
. On User:TonySt/common.js, I see importScript('User:TonySt/CVPI dev.js'); // Backlink: [[User:TonySt/CVPI dev.js]]
Thank you Adakiko (talk) 20:58, 5 February 2026 (UTC)
- I get one error in the source editor related to the colon, but I don't get the others when I try. But this also gave me an excuse to dive into the difference between lusc and iusc, and I think I'll update the documentation to use iusc instead since that should result in the output you see at my common.js file. It still throws a syntax error in the source editor but my guess is that's just an artifact of how the source editor parses the template. --tony 21:06, 5 February 2026 (UTC)
What does CVPI even stand for?
Button location
First off, this tool is great! I’ve been thinking about how useful a mobile friendly vandalism tool would be and was very happy to find this one.
Just an idea/suggestion, could there be an option to move all the buttons on the interface to the bottom of the screen on mobile, and display the diffs above that? Would make it easier and faster just because that’s where thumbs already are on phones (instead of moving my hand up to the top of the screen). Thanks for a great tool! SnowyRiver28 (talk) 10:32, 18 March 2026 (UTC)
- I like this idea a lot! I'm actually in the middle of a complete redesign of the button UI -- it's my least favorite part of the tool and I think I'm on the right track with the changes being made in development. Part of those changes involve moving different buttons around to places that make more sense. I have a feeling that the "Rollback now (vandalism)" button will probably stay at the top so there's less chance of accidentally hitting it, but the other buttons will hopefully be in a much better spot soon :) tony 16:55, 18 March 2026 (UTC)