kowainik / hit-on

:octocat: Kowainik Git Workflow Helper Tool
https://kowainik.github.io/projects/hit-on
Mozilla Public License 2.0
77 stars 13 forks source link

User can assign him/herself to issue when pushing a new branch. #59

Closed StevenXL closed 5 years ago

StevenXL commented 5 years ago

Resolves #15

StevenXL commented 5 years ago

@vrom911 Please let me know what you think. :-)

chshersh commented 5 years ago

@vrom911 @StevenXL When I call new <n> -a command I see the following error:

ParseError "Error in $: key \"updated_at\" not present"

This doesn't work for me either, unfortunately ๐Ÿ˜ž

Regarding tests: need to think how to make tests automatic. Maybe not for all commands. But should be possible. At least for issue command. Maybe we can create test repository only to test hit-on. But even without the repository it should be possible do test some commands...

StevenXL commented 5 years ago

Hm... I think this exposes a problem with the github library.

For example, if I run hit new 99, and there is no issue 99 in the repo, with github-0.20, I would get the following output:

  HTTPError (HttpExceptionRequest Request {
  host                 = "api.github.com"
  port                 = 443
  secure               = True
  requestHeaders       = [("Authorization","<REDACTED>"),("User-Agent","github.hs/0.7.4"),("Accept","application/vnd.github.preview")]
  path                 = "/repos/StevenXL/hit-on/issues/99"
  queryString          = ""
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}
 (StatusCodeException (Response {responseStatus = Status {statusCode = 404, statusMessage = "Not Found"}, responseVersion = HTTP/1.1, responseHeaders = [("Server","GitHub.com"),("Date","Wed, 06 Mar 2019 18:31:42 GMT"),("Content-Type","application/json; charset=utf-8"),("Transfer-Encoding","chunked"),("Status","404 Not Found"),("X-RateLimit-Limit","5000"),("X-RateLimit-Remaining","4999"),("X-RateLimit-Reset","1551900702"),("X-OAuth-Scopes","admin:business, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion"),("X-Accepted-OAuth-Scopes","repo"),("X-GitHub-Media-Type","github.v3; param=preview"),("Access-Control-Expose-Headers","ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type"),("Access-Control-Allow-Origin","*"),("Strict-Transport-Security","max-age=31536000; includeSubdomains; preload"),("X-Frame-Options","deny"),("X-Content-Type-Options","nosniff"),("X-XSS-Protection","1; mode=block"),("Referrer-Policy","origin-when-cross-origin, strict-origin-when-cross-origin"),("Content-Security-Policy","default-src 'none'"),("Content-Encoding","gzip"),("X-GitHub-Request-Id","0A2F:403A:900CD5:11B977A:5C80120E")], responseBody = (), responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose}) "{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/issues/#get-a-single-issue\"}"))

However, if I run the same command, but simply upgrade github package to 0.21, I get this output:

ParseError "Error in $: key \"updated_at\" not present"

So, my code is surely wrong, but the ParseError is misleading. I think we should be getting back an error tagged with the HTTPError data constructor.

I will keep looking, but let me know if you all have some thoughts.

vrom911 commented 5 years ago

@StevenXL, I don't think that your code is wrong. It looks like that the new GitHub library is broken, and the error it returns looks very much like JSON parsing error, which means that they broke some encoders/decoders in the new release. I think we could try to create an issue there with the minimal example of this behaviour. Do you want to do this? ๐Ÿ™‚

StevenXL commented 5 years ago

@StevenXL, I don't think that your code is wrong. It looks like that the new GitHub library is broken, and the error it returns looks very much like JSON parsing error, which means that they broke some encoders/decoders in the new release. I think we could try to create an issue there with the minimal example of this behaviour. Do you want to do this? ๐Ÿ™‚

Hello! I will try to provide a minimal, reproducible example on the github repository and then link to that here when I do.

StevenXL commented 5 years ago

@vrom911 I couldn't write a small enough reproduction. (I was trying to use the script interpreter feature of stack but couldn't figure out how to get it to use github-0.21 given that v0.21 is not in any resolver).

This is a link to the issue in the github package.

chshersh commented 5 years ago

@StevenXL I see that the issue is fixed (at least is says so) and github-0.22 is released. Can you try this with the newer github version?

StevenXL commented 5 years ago

Hi! I can work on this starting on June 6th. Iโ€™ll get back in touch then.

On June 25, 2019 at 8:58:44 PM, Dmitrii Kovanikov (notifications@github.com) wrote:

@StevenXL https://github.com/StevenXL I see that the issue is fixed (at least is says so) and github-0.22 is released. Can you try this with the newer github version?

โ€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kowainik/hit-on/pull/59?email_source=notifications&email_token=ABYMRSIDYI6J3ZYARQDY423P4LLOHA5CNFSM4G27OE2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYSFK4Q#issuecomment-505697650, or mute the thread https://github.com/notifications/unsubscribe-auth/ABYMRSPZIHW2MN6NZMQQ4Z3P4LLOHANCNFSM4G27OE2A .

StevenXL commented 5 years ago

Sorry - I meant July 6th.

On Wed, Jun 26, 2019 at 9:58 AM Steven Leiva leiva.steven@gmail.com wrote:

Hi! I can work on this starting on June 6th. Iโ€™ll get back in touch then.

On June 25, 2019 at 8:58:44 PM, Dmitrii Kovanikov ( notifications@github.com) wrote:

@StevenXL https://github.com/StevenXL I see that the issue is fixed (at least is says so) and github-0.22 is released. Can you try this with the newer github version?

โ€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kowainik/hit-on/pull/59?email_source=notifications&email_token=ABYMRSIDYI6J3ZYARQDY423P4LLOHA5CNFSM4G27OE2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYSFK4Q#issuecomment-505697650, or mute the thread https://github.com/notifications/unsubscribe-auth/ABYMRSPZIHW2MN6NZMQQ4Z3P4LLOHANCNFSM4G27OE2A .

-- Steven Leiva 305.528.6038 leiva.steven@gmail.com http://www.linkedin.com/in/stevenleiva

StevenXL commented 5 years ago

@chshersh Hi! I am trying to add github-0.22 to the project, but I am ending up in dependency hell (please excuse the phrasing). If you pull down this PR and run stack build, you will run into the following issue:

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for transformers-compat-0.6.5:
    transformers-0.5.6.2 from stack configuration does not match >=0.3 && ==0.2.*
needed due to hit-on-0.1.0.0 -> transformers-compat-0.6.5

I don't know how to proceed from here. Any help would be greatly appreciated.

chshersh commented 5 years ago

@StevenXL I can start building the project using the following stack.yaml file:

resolver: lts-13.27

extra-deps:
  - relude-0.5.0
  - shellmet-0.0.1

  - github-0.22
  - binary-orphans-1.0.1  # for github
  - binary-instances-1    # for github
  - time-compat-1.9.2.2   # for github
StevenXL commented 5 years ago

@chshersh I was able to build with your suggestion. Thank you. Will continue to work on this.

StevenXL commented 5 years ago

@chshersh OK I think the functionality is finally working. Let me know your thoughts.

piq9117 commented 5 years ago

it sounds like yโ€™all are experiencing the same problem with the github package as we did. We think it has something to do with the encoding where some fields are optional but the package puts in a Nothing which then becomes null instead of just leaving out that field. Iโ€™m guessing the request will succeed with curl or some other method like postman?

chshersh commented 5 years ago

@piq9117 Parsing in github-0.21 was broken which stopped this PR from moving forward. The issue with parsing should be fixed in github-0.22 (as promised by CHANGELOG). I'm not sure what it's the problem now. This either might be wrong token scopes or something else. I agree with your proposed strategy for testing this: write curl command to test that the token is valid. And if curl command works, try to implement github version of it and open issue to the github library if it doesn't work.

vrom911 commented 5 years ago

Hey @StevenXL, do you have plans for this PR? Sorry for bothering!

StevenXL commented 5 years ago

Hey @StevenXL, do you have plans for this PR? Sorry for bothering!

@vrom911 It's no bother at all. I am going to close out the PR so if someone else wants to work on it, they don't feel the need to ask for "permission" or to check in on this PR.

Thank you for the reminder.