MediaWiki talk:Gadget-BugStatusUpdate.js

Webservice restart instructions
Sometimes the webservice needs to be restarted. For people with access, the commands are:
 * 1) ssh login.tools.wmflabs.org
 * 2) become phabricator-bug-status
 * 3) webservice restart

Sometimes it needs more than a restart.

Ping a maintainer if it is acting up (Currently user:Mattflaschen).

Volunteer to become a maintainer if you understand the code!

Bugs
See mw:User talk:Robmoen/bugStatusUpdate.js. Helder 09:51, 4 May 2012 (UTC)

Inform resolution in case the bug is "RESOLVED"
When a bug is marked as "RESOLVED", it would be useful to have the resolution available to know if it is a FIXED, INVALID, WONTFIX, DUPLICATED or a WORKSFORME. Helder 11:25, 25 January 2013 (UTC)

Stepping up to the plate...
, I see you have made many scattered requests for enhancements/fixes to this template/gadget. I'm going to be working through trying to accomodate as many of them as I can, and would appreciate if you could go through the bulleted list here and make sure I don't miss any. Thanks Technical 13 (talk) 18:32, 18 June 2013 (UTC)
 * You can track the progress by adding User:Technical 13/SandBox/Gadget-BugStatusUpdate.js and User:Technical 13/Templates/Bugzilla to your watchlist and you can track the results of my changes on User:Technical 13/Bugzilla (you will have to add the following line of code to your custom js page to see the changes) Technical 13 (talk) 19:33, 18 June 2013 (UTC)


 * , sorry for taking so long to reply.
 * What is the current status of the [//en.wikipedia.org/w/index.php?oldid=477087530&diff=560507640 changes you did]?
 * BTW: our bugmaster might have suggestions about this gadget, since he seems to be very familiar with Bugzilla? Helder 17:22, 11 September 2013 (UTC)
 * I've actually asked for some input, and he said he knows little about the actual api.  I actually got distracted from this project, and you can see what I did manage to get done in my version in the list below.  I've also made some adjustments to the template and started working on "resolutions" but have had the time to write the code to scrape the html of the bugs to get it (since it isn't returned by the api).  I also looked at and thought about ways to indicate "security" bugs based on the error message returned by the api, but haven't gotten around to implementing it just yet. Technical 13 (talk) 17:47, 11 September 2013 (UTC)
 * Yeah, sorry, knowledge of Bugzilla's API is definitely one of my weak points. I've played with it (and JIRA's API) a little bit around the beginning of this year for a technical paper but I only touched the surface (plus it was slightly frustrating, but upstream developers are now finally working on a REST API). If you have some specific questions, Arthur Richards might be able to help as he maintains a script to sync Bugzilla with Wikimedia's Mingle instance. --AKlapper (WMF) (talk) 17:02, 16 September 2013 (UTC)

List of things to fix or improve

 * Fix only the first instance of the template working per bug number
 * This should be easily fixed by changing the system to use as opposed to the  that it currently uses.
 * Add more details as to the status of "resolved" bugs as to whether it was resolved as:
 * DUPLICATED, FIXED, INVALID, LATER, WONTFIX, WORKSFORME
 * Not returned by API directly.
 * Offer some kind of information for security-restricted bug reports such as
 * Normal query results: Bug:300
 * Security-restricted query results: Bug:49741
 * Security-restricted query results: Bug:49741

Failure in Chrome/Firefox
A short time ago, this gadget is failing in chrome with the following error:  on the line. Firefox has the same problem. I can find no recent edits that would cause this, but I can see no definition for 'result'. Anyone knows whats going on? — Edokter  ( talk ) — 10:39, 22 June 2013 (UTC)
 * It only seems to be broken at the Village Pump when viewed as a whole, so it must be something on the page itself. — Edokter  ( talk ) — 13:12, 23 June 2013 (UTC)
 * , are you still getting the error? I'm not seeing it on FF21. Technical 13 (talk) 16:49, 23 June 2013 (UTC)
 * Still getting the error (but only on Village pump (technical)). Chrome 28 reports, Firefox 21 reports  . —  Edokter  ( talk ) — 17:19, 23 June 2013 (UTC)
 * Okay, I am using a test script I've been working on (see above section) and didn't see the error on other pages... I flipped my script off and tried again with the live script on VPT. I went through one section at a time until I came across  which wouldn't load up with just that section.  I've deactivated the 49741 for that bug and think I know what is going on.  I think that is a "security" related bug which you can't see the details of (neither can I for that matter), and it is bugging the whole thing out.  I'm already working on a patch/fix for that above, but the api returns a completely different result for those, so it may be a bit for my to formulate it.  Let me know if commenting it out fixed VPT for you. Technical 13 (talk) 00:11, 24 June 2013 (UTC)
 * Seems to be fixed. A simple check (if data.result) should remedy these faults. — Edokter  ( talk ) — 18:07, 24 June 2013 (UTC)

Adapting this gadget to Phabricator
Hi, we are planning to deprecate Bugzilla (and a bunch of other tools) in favor of Phabricator. We are looking for volunteers to adapt this gadget at Port gadget to query Phabricator API. Any takers?--Qgil (talk) 19:31, 13 May 2014 (UTC)
 * Qgil: it is probably better to ask on Village pump (technical)‎‎. I'm not familiar with Phabricator yet, much less its API (maybe Technical 13 is?). Helder 15:59, 8 September 2014 (UTC)
 * I hadn't even created a user account on Phabricator until just now. I'm very interested in this however, but I may have a slow learning curve as I don't have a lot of free time at the moment with all my 300 level classes at school weighing me down in homework.  If others are interested, I'd happily defer it to them, otherwise, there's no real deadline I suppose... — &#123;&#123;U&#124;Technical 13&#125;&#125; (e • t • c) 17:22, 8 September 2014 (UTC)
 * We have a new version of the Template:Tracked on its sandbox (see the diff). Helder 13:40, 9 September 2014 (UTC)
 * That is just the template which auto-links to either Bugzilla od Phabricator (which does not work at the moment as it is in the process of moving). The Gadget queries the status of the bug/ticket and needs an API to communicate with.  19:37, 9 September 2014 (UTC)
 * I've cast a glance at how to do the same thing with phabricator as with bugzilla. First, the API (conduit) “auto”-documentation is very light; second, we'll need an additional step to get a CSRF token, even for read-only requests (I still wonder why); third, I haven't found yet how to query information for several tasks at the same time (I certainly wouldn't use the gadget if it was doing one request per task) — but again, the documentation is subpar.
 * Example, request for bugzilla was this one, now it'll be like this one (except that it only gets information for one task and that some other query — which one and why, I've no idea — is required first to get the CSRF token).
 * I dunno if we had to patch bugzilla in the past, but I've the feeling that we'll have to contribute to phabricator in the future…
 * Best regards — Arkanosis ✉ 01:50, 3 October 2014 (UTC)
 * Thanks, I'm no Conduit expert, but you can surely find good advice in our Phabricator instance. I have created a task for this: T539.--5.147.248.10 (talk) 11:53, 3 October 2014 (UTC)
 * This is done. I've ported it over; the new version is it at User:Mattflaschen (WMF)/Gadget-BugStatusUpdate.js.  It uses a simple JSONP service I implemented on Tool Labs.  The new gadget does not support Bugzilla at all (the template still does); all Bugzilla bugs have been migrated to the Phabricator site, and any Bugzilla statuses are potentially out of date, so I don't think it's necessary.
 * You can try it out if you'd like (see https://en.wikipedia.org/w/index.php?title=User:Mattflaschen_%28WMF%29/common.js&oldid=646451192 for import line). If it looks good, I'd like to have the gadget updated. Mattflaschen (WMF) (talk) 05:52, 10 February 2015 (UTC)
 * ✅. I'll clean up the template later.  10:07, 10 February 2015 (UTC)

Not working
I'm not getting any status; I keep getting a 500 error from tools.wmflabs.org in my console. 14:51, 8 March 2015 (UTC)
 * ^ Quiddity (talk) 17:28, 8 March 2015 (UTC)
 * I'm not sure why it stopped working (I didn't make any recent code change), but I can't restart it due to T92039. Mattflaschen (WMF) (talk) 22:56, 9 March 2015 (UTC)
 * Tim.landscheidt quickly fixed webservice2, and the gadget is working again. Mattflaschen (WMF) (talk) 21:58, 10 March 2015 (UTC)
 * This gadget seems to be non-functional again, but there are no errors in console this time. Something something error at https://tools.wmflabs.org/phabricator-bug-status/queryTasks though. Quiddity (WMF) (talk) 01:52, 16 April 2015 (UTC)
 * I do get a 500 error in my console.  07:52, 16 April 2015 (UTC)
 * Restarted it, and it works again. Mattflaschen (WMF) (talk) 00:06, 22 April 2015 (UTC)
 * For anyone with access, steps to restart it:
 * ssh login.tools.wmflabs.org
 * become phabricator-bug-status
 * webservice restart
 * -- Mattflaschen (WMF) (talk) 00:07, 22 April 2015 (UTC)


 * It's down... again.  15:14, 28 April 2015 (UTC)


 * , what does it take to get access? —  15:50, 28 April 2015 (UTC)
 * It's down... again. Please add me to the phabricator-bug-status project, so I can restart. Thanks. —  02:36, 29 April 2015 (UTC)
 * FYI, this works again. Nudge me if it goes down again. Thanks. Quiddity (WMF) (talk) 22:35, 5 August 2015 (UTC)

Startup optimization
Hello, you might be interested by this optimization I made on frwiki. The gain is really worth it, especially on large pages with many links. Od1n (talk) 06:43, 4 April 2018 (UTC)
 * Thanks for the suggestion! Done. Enterprisey (talk!) 14:43, 14 February 2019 (UTC)

404 not found?
The API call gets a 404 error. Is the tool still maintained? Od1n (talk) 16:57, 28 April 2018 (UTC)
 * Hi, do you know why this tool is down? (https://tools.wmflabs.org/phabricator-bug-status/queryTasks gets a 503). Also a reminder to look for a second tool-maintainer. :) Quiddity (WMF) (talk) 18:28, 30 April 2018 (UTC)
 * Note: I asked Bryan, who said "I think I got it back up and running. it was a bit more complex than just restart". However, whilst a query now works (example), the gadget still does not work and shows this error in console: https://i.imgur.com/fwJhjXr.png Or text: https://ghostbin.com/paste/a4bzf/raw
 * I've also added a section at the top of this page, for any further maintenance notes/clues you might be able to add.
 * Hope that helps. Quiddity (WMF) (talk) 20:23, 30 April 2018 (UTC)

Status issues?
Anyone else seeing problems with this showing resolved on open tickets recently?

Example link above. — xaosflux  Talk 11:07, 18 June 2021 (UTC)


 * @Xaosflux: No, but now it's returning internal service errors (500); and the listed maintainer hasn't edited anywhere since 2019. Any ideas on how to get a suitable kick administered to the tool? Xover (talk) 17:16, 5 August 2021 (UTC)
 * it is working for me right now, are you seeing this problem now? The local script can produce a 500 error for a timeout upstream. —  xaosflux  Talk 17:19, 5 August 2021 (UTC)
 * @Xaosflux: This URL was grabbed from my JS console shortly before the above message, and still returns 500 for me. Xover (talk) 17:53, 5 August 2021 (UTC)
 * ah OK, so this isn't a problem with our script - but with the external tool. You can open a ticket on that tool at phab (https://phabricator.wikimedia.org/project/profile/2159/) and maybe someone will pick it up. — xaosflux  Talk 18:05, 5 August 2021 (UTC)
 * @Xaosflux: AIUI phabricator-bug-status.toolforge.org was developed specifically as the backend for enwp's Gadget-BugStatusUpdate.js, and points here from the tool description. The (only) maintainer listed there and here is, who hasn't edited on any project since 2019 (cf. #Webservice restart instructions above). Now granted I was following up a problem reported over on enWS, but if it's starting to bitrot it's going to start affecting enWP too. In any case, since it apparently isn't completely down I'll do some more poking and try to quantify it before filing in Phab. Xover (talk) 18:21, 5 August 2021 (UTC)
 * only option really, the editors and admins of enwiki can't do anything about that, if it goes down for good all we can do is disable this gadget or retarget it if someone else makes a status tool - would probably be better to not have to use a toolforge shunt and just fetch the values from phab directly. — xaosflux  Talk 18:37, 5 August 2021 (UTC)
 * @Xaosflux: Looking into this, it turns out Phabricator supports neither JSONP nor CORS, and it requires a manually assigned per-user Conduit API key, so in practice it's not possible to query this from JS in a web browser. I also cannot find that the code for the proxy is available anywhere (it's not on Matt's Github, for example), but I imagine that it is in essence just providing the API key and JSONP bits of that. It also, incidentally, massages the data coming from Conduit before returning it to the client, presumably to cater to clients written for Bugzilla's API. But, bottom line, the only way to get at the 500 errors is to either usurp the  tool, or to replace it with a new tool based on cors-anywhere or something similar.That being said, in debugging why enWS's gadget was seemingly completely broken while enwp's only failed on occasional 500 errors I ended up rewriting  in Lua, moving hardcoded formatting into TemplateStyles, and cleaning up the code. The gadget itself is now down to about ~55 lines of fairly readable code (and inline comments), faster (not that it matters), more robust (possibly matters), and should deal better with multiple tracked templates on a single page.If there's any interest, the updated code is at s:MediaWiki:Gadget-BugStatusUpdate.js, s:Template:Tracked, s:Module:Tracked, s:Template:Tracked/styles.css, and it's probably a good idea to grab the testcases too: s:Template:Tracked/testcases. I'm happy to help bringing it over, but since I'm not currently very active on enwp I don't want to pull the trigger on that unilaterally. It also requires updating the gadget and the template concurrently meaning it requires someone with the right bits turned on on their account. Xover (talk) 07:38, 13 August 2021 (UTC)