You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Friendlier recovery when issue/pr create fails #906
Unfortunately we don't at any point save issue text to the hard drive -- it's just held in RAM until the operation is submitted to the API. this is true of any data we take in; it can be lost if the operation fails.
I think it would be nice for us to address this in a general way whenever we take data in via an editor. The paths I can think off of the top of my head:
suggest users use an autosave feature on their editor. I don't love this approach because editors vary in how they do autosave and it can lead to a lot of clutter or confusion.
print out what we're going to submit so it can be copy/pasted in case of error. I'm sort of into this but I think we found with certain issue/pr submissions that it can interrupt the flow when there is a lot of text.
output a "dump" in case of error, kind of like a core dump when certain programs halt. I'd imagine this as a toggle-able feature. But a flow like:
$ gh pr create
$ # ...do input steps
X Failed to submit pull request: GH is temporarily down.
! Your submission was preserved in .gh-1589296025
@ampinsk what do you think of this kind of experience? is it worth pursuing?
To me, the best user experience would be if the person can just resume where they left off without any special intervention (i.e. without them having to manually inspect generated files such as a crash dump). So here is what I'm thinking: whenever someone authors a PR or issue, we save their title & body in a file scoped to that repository. If the create operation succeeded, we delete the file. Otherwise, the save file stays on disk and is used to pre-fill the next issue/pr create invocation, which is most likely a retry after a server or validation failure.
Additionally, for the case of issue/pr create with invalid flag input (non existing labels, for example), one approach we can do is validate the inputs before we let them author the title or body. That way they get an error early and don't lose any work. The tradeoff would be that they would always get a slight delay before the title prompt appears, since their flags need to be validated on the server.
To me, the best user experience would be if the person can just resume where they left off without any special intervention (i.e. without them having to manually inspect generated files such as a crash dump).
My initial reaction to this is that it's too implicit. A user might wander off and N days come back and use the tool to create an issue/pr only to be confused why this particular data is being pre-filled. I think I would be in favor of this approach, though, if it did something like vim's swap file detection:
$ gh pr create
! It looks like this failed the last time you ran it. Would you like to pick up where you left off? [Y/n]
Additionally, for the case of issue/pr create with invalid flag input (non existing labels, for example), one approach we can do is validate the inputs before we let them author the title or body.
I'm in favor of this sort of thing assuming we can keep the latency tolerably low but given that we'll always need to be ready for github.com potentially being down it seems like less of a priority than the ability to pick up where you left off.
A user might wander off and N days come back and use the tool to create an issue/pr only to be confused why this particular data is being pre-filled.
Agreed, we need to think this through. Hub implements this, but users have been filing issues about false-positives, meaning hub trying to helpfully restore their "lost" work, but the user has switched context in the meantime (e.g. switched to another branch).
but given that we'll always need to be ready for github.com potentially being down it seems like less of a priority than the ability to pick up where you left off.
100% agree. The feature to avoid people losing text is in my mind of larger importance than the order of how we validate inputs.
Can I suggest something? (Correct me if I'm wrong in something)
Maybe we can assign the pr or issue a totally random number (Only locally), then if the operation fails we save a file in path/to/repo/.dump/ with name <pr | issue>-<random-number>.yml, and then when the user creates a pr/issue we ask of using the MOST RECENT, and that way the user does'nt only uses the most recent but if the user has more dump files he can use that other one, like:
$ gh pr create
$ inputs
Oops, Error
! The pr was saved with title and body in pr-236174890.yml with dump-id 236174890.
$ tree
.
|
|— .dump
|
|— pr236174890.yml
|
|— <Other Files>
Yes I know, a very bad recreation of tree command,
But the point is that, so when the user runs the command again:
$ gh pr create
! Last time you ran this command It failed and created a dump file, do you want to use It?
Use the dump file? (y/N) No
Okay!
(Continues with normal pr create procedure)
If the user agreeds It takes body and title from dump file and prompts for metadata,
If the user haves more than 1 dump file:
$ gh pr create
! Last time you ran this command It failed and created a dump file, and It looks that there are more than one dump file?
Use a dump file? (y/N) Yes
Insert a Dump-ID (DUID): <dump-file-id> (<-- Note: Maybe this can be improved for it to show a list of dump files)
(The CLI recopiles title and body from dump file and prompts for metadata)
All of this applies for issue create procedure.
When the dump file is used and the procedure fails again, the dump file is conserved, if the procedure succeds, the dump file is deleted.
@Josh012422 I like this general idea, and I would say that we don't even have to make it as involved, e.g. I don't think we really need to make support for multiple dump files since the original goal is to just help people recover their authored text from the most recent crash. It could be as simple as:
$ git pr create
notice: unsaved title and body detected
? Do you want to recover title and body text that you previously entered? (Y/n)
Reacted by Amanda Pinsker, Nate Smith, Celo Reis and Philippe Blain
Thanks @mislav about the comment, and sorry for the late response, some things happened, this is what I want to say:
As I thinked of it, I realized that multiple dump files is something more useless than useful, because, the user only wants to use the last dump file, more than one dump file will occupy more space on disk and many of them will be useless
Oh, mislav, I have a question: Why the CLI doesn't use viper
And @MarcelReis, yeah metadata should also be added to dump file.
We briefly reviewed Viper, but from its project description it sounds like most of the functionality it offers is what we absolutely don't need. It sounds like Viper was primarily designed for services that are deployed to a server.
It sounds like Viper was primarily designed for services that are deployed to a server.
Well, if you say so... I am currently developing a CLI (Gocharm if you want to look it) that has multiple kinda utilities commands (like a timer, cronometer, etc) and I use viper for config proccessing, I do not know for what was Viper really designed for.
But ok, we are not here to talk about viper and its uses... so about the general issue, @mislav if you give me your permission, I will start working on this issue though a PR.
P.D: I really like the CLI, I used some code from the GH CLI to use It on my on CLI, Kudos for the great work.
I’d just like to add my voice here, I just spent 20+ minutes writing a detailed PR description only to loose it when I submitted because I had forgotten to force push my (rebased since last pushed) branch, just as described in #1455.
Having ‘gh’ do a backup of any textual input would be very helpful.
(As an aside, in this situation, or even if the push would be fast-forwad, the cli could simply warn you that your branch has unpushed commits instead of pushing them for you, but I understand that this might be a design decision. I would personally prefer that the cli would ask for confirmation before running any Git command, but I can understand that it’s not the case for everyone...)
@phil-blain We hear you. I'm sorry your work got lost! Fixing this is something that's going to be next on our roadmap after the current set of features.
Activity
vilmibm commentedon May 12, 2020
Unfortunately we don't at any point save issue text to the hard drive -- it's just held in RAM until the operation is submitted to the API. this is true of any data we take in; it can be lost if the operation fails.
I think it would be nice for us to address this in a general way whenever we take data in via an editor. The paths I can think off of the top of my head:
@ampinsk what do you think of this kind of experience? is it worth pursuing?
ampinsk commentedon May 12, 2020
I like the idea of a “dump” if the operation fails! I like the sketch you provided, I think it’s worth pursuing.
mislav commentedon May 13, 2020
To me, the best user experience would be if the person can just resume where they left off without any special intervention (i.e. without them having to manually inspect generated files such as a crash dump). So here is what I'm thinking: whenever someone authors a PR or issue, we save their title & body in a file scoped to that repository. If the create operation succeeded, we delete the file. Otherwise, the save file stays on disk and is used to pre-fill the next
issue/pr createinvocation, which is most likely a retry after a server or validation failure.Additionally, for the case of
issue/pr createwith invalid flag input (non existing labels, for example), one approach we can do is validate the inputs before we let them author the title or body. That way they get an error early and don't lose any work. The tradeoff would be that they would always get a slight delay before the title prompt appears, since their flags need to be validated on the server.Related: #678 #826
vilmibm commentedon May 13, 2020
My initial reaction to this is that it's too implicit. A user might wander off and N days come back and use the tool to create an issue/pr only to be confused why this particular data is being pre-filled. I think I would be in favor of this approach, though, if it did something like vim's swap file detection:
I'm in favor of this sort of thing assuming we can keep the latency tolerably low but given that we'll always need to be ready for github.com potentially being down it seems like less of a priority than the ability to pick up where you left off.
[-]Wrong label, deleted issue[/-][+]Friendlier recovery when issue/pr create fails[/+]mislav commentedon May 14, 2020
Agreed, we need to think this through. Hub implements this, but users have been filing issues about false-positives, meaning hub trying to helpfully restore their "lost" work, but the user has switched context in the meantime (e.g. switched to another branch).
100% agree. The feature to avoid people losing text is in my mind of larger importance than the order of how we validate inputs.
DJBlueSlime commentedon May 21, 2020
Can I suggest something? (Correct me if I'm wrong in something)
Maybe we can assign the pr or issue a totally random number (Only locally), then if the operation fails we save a file in
path/to/repo/.dump/with name<pr | issue>-<random-number>.yml, and then when the user creates a pr/issue we ask of using the MOST RECENT, and that way the user does'nt only uses the most recent but if the user has more dump files he can use that other one, like:Yes I know, a very bad recreation of
treecommand,But the point is that, so when the user runs the command again:
If the user agreeds It takes body and title from dump file and prompts for metadata,
If the user haves more than 1 dump file:
All of this applies for
issue createprocedure.When the dump file is used and the procedure fails again, the dump file is conserved, if the procedure succeds, the dump file is deleted.
@mislav @vilmibm @coot What do you think?
mislav commentedon May 22, 2020
@Josh012422 I like this general idea, and I would say that we don't even have to make it as involved, e.g. I don't think we really need to make support for multiple dump files since the original goal is to just help people recover their authored text from the most recent crash. It could be as simple as:
TheCeloReis commentedon May 28, 2020
Meta data is also important to recover, not just the body and title.
DJBlueSlime commentedon May 31, 2020
Thanks @mislav about the comment, and sorry for the late response, some things happened, this is what I want to say:
As I thinked of it, I realized that multiple dump files is something more useless than useful, because, the user only wants to use the last dump file, more than one dump file will occupy more space on disk and many of them will be useless
Oh, mislav, I have a question: Why the CLI doesn't use viper
And @MarcelReis, yeah metadata should also be added to dump file.
mislav commentedon Jun 2, 2020
We briefly reviewed Viper, but from its project description it sounds like most of the functionality it offers is what we absolutely don't need. It sounds like Viper was primarily designed for services that are deployed to a server.
DJBlueSlime commentedon Jun 2, 2020
Well, if you say so... I am currently developing a CLI (Gocharm if you want to look it) that has multiple kinda utilities commands (like a timer, cronometer, etc) and I use viper for config proccessing, I do not know for what was Viper really designed for.
But ok, we are not here to talk about viper and its uses... so about the general issue, @mislav if you give me your permission, I will start working on this issue though a PR.
P.D: I really like the CLI, I used some code from the GH CLI to use It on my on CLI, Kudos for the great work.
phil-blain commentedon Aug 2, 2020
I’d just like to add my voice here, I just spent 20+ minutes writing a detailed PR description only to loose it when I submitted because I had forgotten to force push my (rebased since last pushed) branch, just as described in #1455.
Having ‘gh’ do a backup of any textual input would be very helpful.
(As an aside, in this situation, or even if the push would be fast-forwad, the cli could simply warn you that your branch has unpushed commits instead of pushing them for you, but I understand that this might be a design decision. I would personally prefer that the cli would ask for confirmation before running any Git command, but I can understand that it’s not the case for everyone...)
mislav commentedon Aug 27, 2020
@phil-blain We hear you. I'm sorry your work got lost! Fixing this is something that's going to be next on our roadmap after the current set of features.
vilmibm commentedon Oct 28, 2020
@ampinsk @mislav @samcoe i would like initial feedback on this draft PR 🙏 : #2313