Page MenuHomePhabricator

Code review for ZppixBot's mhphab.py
Closed, ResolvedPublic4 Estimated Story Points

Description

Intro

The mhphab script allows viewing information of miraheze phabricator tasks when typing a task number on IRC & sends a weekly update on high priority tasks,

Was it a cause of outages or incidents ?

No

When it was first deployed to production

21 October 2017

Usage statistics based on audience(s) served

Used mainly in one channel and by Miraheze SRE team

Changes committed in last 1, 3, 6, and 12 months

None, last change was 13 May 2019 and 15/24 commits were authored by users no longer maintaining the service

Reliance on outdated platforms (e.g. operating systems)

The code currently uses the sopel modules infra rather than plugins like everything and will need to be converted. If this was to fail, the code will eventually break.

Number of developers who committed code in the last 1, 3, 6, and 12 months

0

Number and age of open patches

1 - As mentioned above for the modules -> plugins switch that is blocked on the rollout by upstream

Number and age of open bugs

0

#. Number of known dependencies?

Phabricator Client Utils - Unmaintained
Sopel Modules - To be switched to plugins which is the same but a new name
Time, os, sys, re and future python modules

Is there a replacement/alternative for the feature? Is there a plan for a replacement?

Submitter's recommendation (what do you propose be done?)

Attempt to rewrite & replace the code with something we can maintain

Event Timeline

The current code spans 2 files and over 300 lines.

Given how easy maniphest.search's api is. I'm pretty sure we can cull a lot of that down.

When I tried to review the code to look at the bug raised today, I had a feeling that it might make sense after an hour.

RhinosF1 triaged this task as Medium priority.

Using requests, my current code is 67 lines & 1 file compared to 342 lines + 2 files but is only about half done.

I may split bits into 2 files over time but in total I expect the code to not exceed 40% of the size of the current one.

The code currently sits at 19.5% of the size.

Assuming I can get past travis, I will merge to dev and assign to @Zppix to update the master version and maybe have GSOC/GCI students write tests.

As it stands, We operate at 111 lines (~34% of the original size) and I could arguably make some stuff even shorter by implementing a backend.

If we want to switch to using a requests based client and reduce duplication, Assign back to me.

modules % pylint --disable=all --enable=duplicate-code phabtest.py

------------------------------------
Your code has been rated at 10.00/10

Is surprising to be honest

Deployed but we seem to have an issue with the response, fixing.

Deployed but we seem to have an issue with the response, fixing.

Once, I've fixed it to handle no tasks in high pri - I'll open a PR to merge to core and the rest should be follow up tasks personally to refine things.

Please only add T253297 if they need working on asap. General bugs don't need to be part of this as this is about improving code practice.

RhinosF1 set the point value for this task to 4.
RhinosF1 removed Final Story Points.

I will complete a review of the new code and deploy to master later this week.