mikeconley / myqonly

A tool for Mozillians who want to know how many reviews are in their queue in their browser.
Mozilla Public License 2.0
11 stars 12 forks source link

Consider using the Conduit API #4

Open mystor opened 5 years ago

mystor commented 5 years ago

Hey! This seems really awesome, thanks for making it! It may make the most sense to continue using web scraping to get phabricator review information, but there is an API which you can probably ping: https://phabricator.services.mozilla.com/conduit/ (I think having the cookie should mean you don't need a token? Not sure)

In specific, I think you'd want to fetch https://phabricator.services.mozilla.com/api/user.whoami to get the user's PHID, and then https://phabricator.services.mozilla.com/api/differential.revision.search with { "queryKey": "active", "constraints": { "reviewerPHIDs": ["PHID_HERE"] } } to get revisions where you're the reviewer.

After that you can scan through them and find the ones in the needs-review state to build up the queue :-).

mikeconley commented 5 years ago

Funnily enough, I was using the Conduit API before (using precisely the technique you describe!), but it didn't give me what I needed. Specifically, see #2. I switched over from the Conduit API to page scraping in these commits:

f00d45869d30081c8c7dd54ed636ff8ae0f9834a c77e3d27ba40737ae840d49a85cb70a599e975d0 5ee3019af3bb097236138ae5f03830e156cb5b4d

I'm going to keep this open though, since I suspect the Conduit API will change over time, and might start offering the stuff we need.

mystor commented 5 years ago

I'm pretty sure the issue you were running into is actually a design decision of phabricator. I don't think that scraping the dashboard will actually do any better.

If you are a non-blocking reviewer on a bug, and someone else has already approved that revision, I don't think it will appear in your review queue anymore, even on the phabricator dashboard. I think that's just how phabricator works, if you're non-blocking, you're only needed if nobody else has stepped in.

mikeconley commented 5 years ago

If you are a non-blocking reviewer on a bug, and someone else has already approved that revision, I don't think it will appear in your review queue anymore, even on the phabricator dashboard. I think that's just how phabricator works, if you're non-blocking, you're only needed if nobody else has stepped in.

I believe in this case, they won't be listed under "Must Review", but they will be listed under "Ready to Review", and that'll get counted.

mystor commented 5 years ago

I have definitely had a patch I was flagged on as a non-blocking reviewer just appear in "waiting on author" because someone else had requested changes before, so I don't think it'll necessarily be in "ready to review".