Skip to content

a better "push needs pull" dialog to avoid race condition - #6610

Merged
outofambit merged 13 commits into
developmentfrom
shiftkey/push-needs-pull-defer-dialog
Feb 22, 2019
Merged

outofambit merged 13 commits into
developmentfrom
shiftkey/push-needs-pull-defer-dialog

Conversation

@shiftkey

@shiftkey shiftkey commented Jan 14, 2019 •

Copy link
Copy Markdown
Member

Overview

Fixes #2738
Fixes #5451

While troubleshooting #6593 and doing some groundwork testing for the upcoming rebase flows, I noticed a bug with the classic "push needs pull" error handling that meant you could get stuck in a loop and never be able to see what's changed.

Description

The easiest way to reproduce this issue:

  • create a new repository with a default branch and some commits, push it to GitHub
  • create a new branch, and publish it to GitHub without making any commits
  • switch over on GitHub, add a commit to the branch
  • back in the app, create a different commit
  • try to push the commit

The generic Git error handler is displayed with a message, and Dispatcher.fetch fires in the background:

// Since they need to pull, go ahead and do a fetch for them.
dispatcher.fetch(repository, FetchType.UserInitiatedTask)
return error

It's at this point that I'd expect to see the push/pull button update to show there's both a commit ahead and behind, but it never updates:

What's happening underneath is the concurrent network operation check (which was set to true when the push was started) has not been cleared (the error handing is being performed, but this flag is only cleared after the error handling completes), so the fetch is considered re-entrant and it's not perforrmed.

// Don't allow concurrent network operations.
if (state.isPushPullFetchInProgress) {
return
}

I suspect this only way this eventually "comes good" is when the background fetch eventually kicks in, and nothing changes while the impatient user (i.e me) repeatedly presses "Push" and wonders what happened.

This PR replaces that "fire and forget" fetch with a proper dialog to better explain the situation and run the fetch outside the error handler. I haven't finalized the flow yet, but here's the current message you will see:

I'd love your ideas about what we want to explain here @desktop/product @desktop/design

TODO

  • confirm bug is resolved
  • polish dialog message
  • cleanup tracing work

Release notes

Notes: fix "push needs pull" flow to explain context and actions better

@outofambit

Copy link
Copy Markdown
Contributor

and run the fetch outside the error handler.

@shiftkey what do you mean by this? Are you planning to modify the underlying handling of fetching while another network operation is in process or is this PR only dealing with the dialog displayed?

@shiftkey

shiftkey commented Jan 14, 2019 •

Copy link
Copy Markdown
Member Author

@outofambit I don't plan to change the concurrent network check in this PR. #6141 leverages this behaviour to address some long-running issues with concurrent fetches, and the only motivator for changing this behaviour that I can currently think of is #1011.

The new behaviour is to perform the fetch when the user presses Fetch in the new dialog.

@allthesignals

Copy link
Copy Markdown

I am also seeing this - I'm not sure if I have my remote tracking set up incorrectly or not, but there is no option anywhere to sync with origin or pull latest commits from the branch.

I know I have commits on the remote but I can't pull them down through this interface. Fine, I can just do it through command line, but then this is pretty disruptive of a common git workflow.

@shiftkey
shiftkey force-pushed the shiftkey/push-needs-pull-defer-dialog branch from 8f5d96d to 0495c59 Compare January 22, 2019 13:41
@shiftkey shiftkey added this to the 1.7.0 milestone Jan 22, 2019
@shiftkey
shiftkey force-pushed the shiftkey/push-needs-pull-defer-dialog branch from 9abbf27 to 6158791 Compare January 22, 2019 21:48
@shiftkey

Copy link
Copy Markdown
Member Author

Dropping in some updated screenshots of the dialog (my screen recording setup is busted right now, apologies for the lo-fi info):

I also added in a Loading spinner to the fetch button because the user might not see the fetch progress because of how the dialog steals the attention (screenshot is a bit darker because I literally had to debugger to take a decent shot):

I went down this path because it felt like a little "what is happening" moment and showing some progress before closing the dialog seemed like a good way to help transition the user back to try and pull again.

@shiftkey shiftkey added the ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jan 22, 2019
@shiftkey

Copy link
Copy Markdown
Member Author

I've assigned this to 1.7.0 because it's was something I encountered easily while testing rebase flows, but this could be pulled in sooner if we want to address the original bug #2738 before then.

@shiftkey
shiftkey force-pushed the shiftkey/push-needs-pull-defer-dialog branch from f90aa75 to 05dab54 Compare February 3, 2019 15:59
@shiftkey
shiftkey force-pushed the shiftkey/push-needs-pull-defer-dialog branch from 05dab54 to c5895be Compare February 17, 2019 19:52
outofambit
outofambit previously approved these changes Feb 21, 2019

@outofambit outofambit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a good chat with @shiftkey about this and I'm feeling good about this as a next step.

I had some concerns about why we couldn't resolve this for users by reworking some of our error handling logic, but I think that may be too much magic without rethinking how we fetching in the UI. I'll fully defer diving into that. :)

@outofambit outofambit self-assigned this Feb 21, 2019
@shiftkey

Copy link
Copy Markdown
Member Author

Just merged development into this branch because of some conflicts with #6755

@outofambit
outofambit merged commit 2a15834 into development Feb 22, 2019
@outofambit
outofambit deleted the shiftkey/push-needs-pull-defer-dialog branch February 22, 2019 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

5 participants