User talk:GeneralNotability/spihelper/Archives/2020/September

Tagging

Tags are currently added as

{{sockpuppet|1=Example|2=proven}}

Could it be switched to the more verbose, but equivalent

{{sockpuppet
 | 1 = Example
 | 2 = proven <!-- blank/blocked/proven/confirmed -->
 | evidence = <!-- wiki link to alternate location of evidence if it's not on the master's SPI page -->
 | locked = no
 | notblocked = no
 | altmaster = 
 | altmaster-status = <!-- blank/blocked/proven/suspected -->
 | length =
 | cat = <!-- Custom category name for the sockpuppet -->
}}

to make it easier to amend the tag manually later? There's no alteration to its appearance but will save looking up Template:Sockpuppet/doc to figure out how to tag a confirmed, locked & not blocked sock (Popskamiev) & other such oddities.

It would also be good, while I'm dwelling on it, to alter the template to also take named parameters rather than just numbered/positional parameters...

{{sockpuppet
 | master = Example
 | status = proven <!-- blank/blocked/proven/confirmed -->
}}

-- Thanks, Cabayi (talk) 11:25, 1 September 2020 (UTC)

Cabayi, but what about the cost of adding a few dozen bytes per sock tag? Imagine the server load! (Sounds reasonable and pretty straightforward, I'll work on it) GeneralNotability (talk) 14:14, 1 September 2020 (UTC)
I shall spare a moment of reflection to honour those extra pixels bravely giving their all for the greater good of the wiki. Thanks, Cabayi (talk) 17:53, 1 September 2020 (UTC)
Cabayi, added in 2.2.3 along with a fix for the block reason for rangeblocks (it was saving an empty string as the block reason because I failed at parentheses). GeneralNotability (talk) 01:18, 2 September 2020 (UTC)
@Cabayi and GeneralNotability: There is a bug here. When you supply an empty |cat= parameter, the account no longer gets categorized correctly, see [1]. The empty |cat= parameter should be removed. Mz7 (talk) 05:03, 2 September 2020 (UTC)
Heh, a part of me wants to be conservative here and feels like this change overcomplicates the tagging a bit and makes it less understandable. We rarely change sock tags after we apply them, and most of the other parameters in the sockpuppet template beyond |1= and |2= are seldom used and rather obscure. If we must make this change at all, I would prefer the other version Cabayi suggested with just the "master" and "status" parameters. Mz7 (talk) 05:12, 2 September 2020 (UTC)
Mz7, acknowledged - I've removed a couple lines from my dev version and will sync them soon. GeneralNotability (talk) 12:33, 2 September 2020 (UTC)
Thanks, the locked = no & notblocked = no were the ones I really can see being adjusted manually (if rarely) and challenging my memory beyond its capacity. Cabayi (talk) 10:36, 3 September 2020 (UTC)

Double archiving?

@GeneralNotability: could you take a look at the history of Wikipedia:Sockpuppet investigations/Arshifakhan61/Archive. It's a multi-day case that I archived using spihelper.js. It looks like the script double-archived most of the sections. Thank you to ST47 for noticing the problem and fixing the archive page. -- RoySmith (talk) 17:46, 2 September 2020 (UTC)

RoySmith, interesting, bradv saw a similar problem (but since it was just bradv I figured it was his fault [FBDB])...I'll have a look. GeneralNotability (talk) 17:48, 2 September 2020 (UTC)
Oh, RoySmith, question - how did you do your archiving here, was it the one-click archive button? GeneralNotability (talk) 17:49, 2 September 2020 (UTC)
GeneralNotability, one-click, yes. -- RoySmith (talk) 17:51, 2 September 2020 (UTC)
RoySmith, okay, pushed a fix, I hope. GeneralNotability (talk) 17:58, 2 September 2020 (UTC)
GeneralNotability, Thanks. I'll keep an eye open the next time I archive something. -- RoySmith (talk) 18:50, 2 September 2020 (UTC)
For reference - I think the trigger here is when a spihelper is archiving multiple sections in one case. I didn't mark the call that blanked the newly-archived section as "await," so I think that for large cases where multiple sections were archived, spihelper was re-reading the SPI page before the write had finished. GeneralNotability (talk) 19:57, 2 September 2020 (UTC)
GeneralNotability, Yeah, nothing there's I than hate more multithreaded conditions race. -- RoySmith (talk) 20:38, 2 September 2020 (UTC)
"knock knock" "race condition!" "who's there?" GeneralNotability (talk) 20:43, 2 September 2020 (UTC)

sockpuppet template formatting?

Looking at this revision, the {{sockpuppet}} is broken across lines. Is that a new change to spihelper? I ask because that breaks the regex parsing I do in tag-check (obligatory whine about how regex is not a parser). -- RoySmith (talk) 13:09, 3 September 2020 (UTC)

RoySmith, yup, see two sections up. If it's giving you problems I could condense everything back to one line. GeneralNotability (talk) 13:13, 3 September 2020 (UTC)
GeneralNotability, Let me think on this a bit. Making things easier for humans is a good goal, so backing out your change would be a step backwards.. The fundamental problem here is that I'm parsing the wikitext with regexes, which is a losing game. Is there anything like mwparserfromhell for javascript? -- RoySmith (talk) 13:18, 3 September 2020 (UTC)
RoySmith, no idea, but could you do a multiline regex to match the template and then remove all the newlines? something like
/{{sockpuppet.*?}}/im
(non-greedy * there so that we don't run over into a different template). GeneralNotability (talk) 14:52, 3 September 2020 (UTC)
GeneralNotability, yeah, I've been playing around in that direction. The latest hitch is how to ignore the "blocked/proven/confirmed" in the HTML comments, but that's going deeper and deeper into regex abuse territory.
I'm actually thinking the best thing I could do here is add a JSON call to my spi-tools server-side app and have that do the parsing using mwparserfromhell. I think I'm going to take you up on your offer to roll your change back temporarily, while I work on a good fix to my stuff. -- RoySmith (talk) 15:06, 3 September 2020 (UTC)
RoySmith, if the HTML comment is the main issue I can remove that, no problem. GeneralNotability (talk) 15:45, 3 September 2020 (UTC)
GeneralNotability, That would certainly simplify things, yes. -- RoySmith (talk) 15:46, 3 September 2020 (UTC)
Actually, I'm looking at wtf_wikipedia which looks like it should do what I need without you having to change anything. -- RoySmith (talk) 18:17, 3 September 2020 (UTC)
@RoySmith: You can use the locally available MediaWiki:Gadget-libExtraUtil.js (parseTemplates function). But is there really a chance that the {{sockpuppet}} template can ever have nested templates in it? Because if not, using a formal parsing method is overkill and you're better off using a multiline regex. Note that s flag (not m) in JS makes . match newlines. This flag is not supported in older browsers like IE 11. If you want to support those browsers as well, use [\s\S] instead of .. – SD0001 (talk) 19:47, 3 September 2020 (UTC)
SD0001, I originally used a regex because it was simple and easy, but down that path lies madness. It's not just the multiline issue; that's easy to solve. Then it's ignoring HTML comments. And dealing with inventive usernames, i.e. User:1=proven, and so on. -- RoySmith (talk) 20:49, 3 September 2020 (UTC)
@Jackmcbarn: I just uploaded a new version of tag-check which uses Parsoid instead of regex to parse the sock templates. The upside here is that what I've got now is a lot more robust. I've also had the opportunity to learn something about Parsoid, which is clearly the way of the future, even if the API that's exposed is mind-bogglingly obtuse. -- RoySmith (talk) 00:20, 5 September 2020 (UTC)