Repository navigation
Conversation
|
A WIP that still needs some refactoring to avoid duplicate code. Also depends on darccio/mergo#210 getting merged or, if we want to stick with that library, vendoring or forking it. This was more a proof of concept but was hoping for some early feedback on the concept. With the mergo change this would handle both top-level JSON arrays or objects, so both REST and GraphQL responses. |
|
@mislav I need to add some specific tests, but wanted to see - if you have time to review - if you feel this is on the right track. I maintained writing responses as they come without pagination so that the user can see something happening. I do ponder adding a progress indicator if paginating, though, because it's pretty long. The main concern with that is that, even writing to stderr, it's likely callers have redirected at least stdout if not stderr using . Writing progress could, therefore, be a breaking change. EDIT: Actually, considering we'd only show progress if stderr wasn't redirected, this would probably be fine. I'll make the change, but certainly can pull it if there's concern. |
e042de9 to
a7ca779
Compare
|
@mislav how much do we care about keeping errors printed in the same order. This is what we do currently: I'm trying to better refactor this so the code is cleaner and easier to maintain (basically, fewer branches in the code and having to pass fewer parameters) but trying to keep this error format is making that more difficult unless I just inline all the code into the But, if the error format could be the following, there's a lot cleaner refactorings possible: Frankly, I like this format better anyway. That an error occurred is shown immediately, followed by more details from the server. |
|
@mislav I've been using this in a few instances and not exhibited any problems. What do you think? |
|
darccio/mergo#210 was merged so we can actually pick up v0.3.13 and not need a redirect. |
|
@mislav @samcoe this is ready to review. Even before the refactoring, the response body would be read completely into a buffer anyway - and in some cases, multiple times - so I ended up allocating a single |
|
Hi, thanks for the work! If the pr is approved, can we get it merged to fix some downstream issues at pwntester/octo.nvim#302 :) |
|
We're still interested in this but wanted consensus; waiting on @mislav 's review |
|
I merged upstream/trunk, or do you need a rebase on trunk? There was a lot of churn since this was first reviewed in pkg/cmd/api/api.go, or perhaps I could just squash all my commits if the history isn't important - would be easier to effectively merge trunk. |
|
/ping @mislav |
|
@heaths: what makes the most sense regarding this PR? Are you okay with closing it until such a time that either you or the CLI team can prioritize the work? Given the age and triage efforts to ensure PRs don't grow stale, I appreciate you understanding the desire to ensure the CLI team is staying engaged while having a up to date view of work in flight. If you want my $0.02, I think closing this and creating a new PR when that work can be prioritized while linking it back here for posterity makes the most sense. 🤷 By the way, nice to meet you and thank you for being a consistent CLI friend and contributor! 👋 ❤️ 🙇 |
|
What work do you need to prioritize? The PR has been done for ages. Seems the outstanding concern was using a third party module, which is sort of absurd given how many are already in use. This module has decent usage and it's straight forward. It could even be reimplimented, but that's not very idiomatic. There's no rush of breaking changes here. The output is invalid JSON that would be valid. Any work around like slurping wouldn't break because there'd be nothing to slurp. I see no downside. I could rebase this and make it conditional for GraphQL. |
|
Thanks for the follow up, @heaths 🙇 It seems this PR needs prioritization from both sides:
There is a lot of history and mentions of the related issue in other places. I admit there is a lot to catch up on here. |
|
Would a quick sync over Teams be acceptable (we're on the same network)? Most of the history is just me keeping this up to date (which gets harder with the PR age, hence trying to get buy-in from Mislav) and not getting it reviewed with requested changes for many months, but we could maybe go through this PR and recap quickly. The quick gist is that Mislav wasn't keen on the mergo dependency I took after some investigation. I think concern about this being a breaking change - given it was already broken - was resolved, but there was still some concern about a behavioral change when logging headers/logs via EDIT: I sent you a message over Teams in case you wanted to chat briefly tomorrow morning. |
|
@heaths : sorry for being slow to respond, I'm going to raise this up with @samcoe and @williammartin, seeing if we can make time next week to get on the same page and get this settled 👍 |
|
@heaths : Happy new year! Just making sure to deliver on pre-holidays conversation about keeping an eye on this PR so we can prioritize it and get it shipped. No pressure or anything, just wanting to deliver on the commitment on our end 🫂 |
|
@andyfeller @samcoe I had a thought. Building on Nate's writer that merges top-level JSON arrays and a discussion we had about something similar for GraphQL, could I create a REST and GraphQL response merger (separate implementations) in Line 112 in 57f6787 I'd develop these in conjunction to test them out - make sure the design is good - but |
|
@heaths That seems like a good idea to me, I don't know if we will get around to fully automatic pagination but having a helper(s) to merge responses is definitely a step forward for cli/go-gh#23. |
Partly resolves cli/cli#1268 and replaces cli/cli#5652
Partly resolves cli#1268 and replaces cli#5652. Requires cli/go-gh#148 to be merged and optionally released.
|
Closing in lieu of #8620. @samcoe @andyfeller that and cli/go-gh#148 are ready for review. |
Partly resolves cli#1268 and replaces cli#5652. Requires cli/go-gh#148 to be merged and optionally released.
Partly resolves cli#1268 and replaces cli#5652. Requires cli/go-gh#148 to be merged and optionally released.
Partly resolves cli#1268 and replaces cli#5652. Requires cli/go-gh#148 to be merged and optionally released.
Partly resolves cli#1268 and replaces cli#5652. Requires cli/go-gh#148 to be merged and optionally released.
Partly resolves cli#1268 and replaces cli#5652. Requires cli/go-gh#148 to be merged and optionally released.
Fixes #1268