Skip to content

Notify users when update available and allow them to update #85

Closed

Description

@billygriffin

Users should have some way of learning when there's an update available and it's obvious how they go about updating.

Activity

  1. added
    needs-designAn engineering task needs design to proceed
    and removed
    needs-designAn engineering task needs design to proceed
    on Nov 18, 2019
  2. probablycorey commented on Nov 19, 2019

    @probablycorey
    Contributor

    Before I get too deep into this I wanted to validate some thinking. Here are some assumptions that might not be correct.

    1. To avoid adding extra time to each execution, we will only check for a new release after X hours have passed.
    2. We don't want to remind the user after each execution that there is a new version available, show the message once every X hours
    3. Assumption 1 & 2 requires that we keep state somewhere. In order to reuse code I'm assuming we should reuse gh's config file.

    Based on that the logic of the "check for upgrade" flow would look like this...

    There are three flags, UPGRADE_CHECKED_AT, UPGRADE_VERSION, and UPGRADE_REMINDED_AT
    
    - if not tty, exit
    - Get the current version
    - if current version == UPGRADE_VERSION exit
    - if UPGRADE_REMINDED_AT is set and is less than 24 hours old, exit
    - if UPGRADE_REMINDED_AT is set and more than 24 hours old, ping the user, update UPGRADE_REMINDED_AT and exit
    
    - if UPGRADE_CHECKED_AT < 24 hours exit
    - Get the released version
    - update UPGRADE_CHECKED_AT and UPGRADE_VERSION
    - If the current version equals the released version exit
    

    @billygriffin @vilmibm @mislav should I change any of my assumptions? Am I overcomplicating this?

  3. billygriffin commented on Nov 20, 2019

    @billygriffin
    ContributorAuthor

    To avoid adding extra time to each execution, we will only check for a new release after X hours have passed.

    We don't want to remind the user after each execution that there is a new version available, show the message once every X hours

    Both of these seem completely reasonable to me from a user perspective! I would definitely not want it to seem like we're spamming people with update notifications if they're just trying to use the tool to get their work done and don't want to update right now.

  4. probablycorey commented on Nov 20, 2019

    @probablycorey
    Contributor

    An example of how npm does this

  5. mislav commented on Nov 21, 2019

    @mislav
    Contributor

    Most of your laid out plan I agree with, @probablycorey.

    3. Assumption 1 & 2 requires that we keep state somewhere. In order to reuse code I'm assuming we should reuse gh's config file.

    We can do that for now, but ideally I would like us to save state elsewhere than our main config file. When gh's config file includes more useful configuration, and after we figure out how to securely save an OAuth token elsewhere than to this file, ~/.config/gh will theoretically become suitable and safe to check into version control by people who version their dotfiles, but if we keep updating it with a timestamp every 24h, then we break that use-case.

  6. mislav commented on Dec 4, 2019

    @mislav
    Contributor

    Closing since we've shipped a release that checks for and notifies about version upgrades!

    The remaining work is around improving that mechanism (e.g. avoid checking too often, give concrete upgrade instructions such as “brew upgrade gh” when applicable, etc.), but these are going to be performed as follow-up tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions