Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configlet shouldn't *REQUIRE* internet access #683

Closed
serialhex opened this issue Oct 23, 2022 · 4 comments · Fixed by #684
Closed

configlet shouldn't *REQUIRE* internet access #683

serialhex opened this issue Oct 23, 2022 · 4 comments · Fixed by #684
Assignees
Labels
cmd: sync kind: bug User-facing incorrect behavior

Comments

@serialhex
Copy link

I had some time to do a few things with a track, but no internet access. I had run this command the day before, but upon running it configlet crashes. I was able to set up a hotspot really quickly but, really, it shouldn't need internet access for something like this. Issue a warning that 'problem-specifications' might not be up to date? Sure! But fail completely? Absolutely not.

The exact error:

configlet sync --tests --docs --metadata --filepaths
Updating cached 'problem-specifications' data...
fatal: unable to access 'https://github.com/exercism/problem-specifications/': Could not resolve host: github.com

failed to fetch 'main' in problem-specifications directory: 'C:\Users\Welcome\AppData\Local\exercism\configlet\problem-specifications'
exec.nim(68)             execAndCheck
Error: unhandled exception:  [OSError]

This is but one example I can easily show, but all operations should succeed (with warnings if necessary) without internet access, unless the operation itself access the internet (like you don't need internet to git commit but do need it to git pull for instance).

@serialhex
Copy link
Author

Just went through the docs and there is an -o option for offline stuff, but IMHO it should work (again, with warnings) without this flag. Feel free to close this if the powers-that-be feel this is unnecessary.

@ee7
Copy link
Member

ee7 commented Oct 23, 2022

Thanks for creating this issue. Sorry for the inconvenience.

it shouldn't need internet access for something like this. Issue a warning that 'problem-specifications' might not be up to date? Sure! But fail completely? Absolutely not.

I think we really do want configlet sync to exit immediately with an error if it couldn't fetch the latest problem-specifications data and --offline was not passed. configlet sync is used in scripts, and will eventually be used in track CI, and in automated PRs that update exercises - it shouldn't have the potential to quietly behave differently when offline, or if there's a temporary network problem.

So I think we want the current behavior, but with a better error message. It should advise the user to pass --offline if they cannot update prob-specs at the current time. Does that sound OK to you?

@ee7 ee7 self-assigned this Oct 23, 2022
@ee7 ee7 added kind: bug User-facing incorrect behavior cmd: sync labels Oct 23, 2022
@serialhex
Copy link
Author

That sounds great! It was only in looking up other things I noticed the -o flag, and I've been burned too many times with software that needs internet access for no good reason that I mistakenly assumed something like that wasn't there. Thank you @ee7!

@ee7
Copy link
Member

ee7 commented Oct 24, 2022

Great. Thanks again for reporting the problem.

I'll re-open this issue so that it'll be closed automatically when we merge #684.

I've been burned too many times with software that needs internet access for no good reason

Me too. Being able to use configlet offline is important to me.

There was already a good error message for the more obscure situation of "no prob-specs cache, but --offline was passed":

$ configlet sync --offline
Error: --offline was passed, but there is no cached 'problem-specifications' repo at:
  '/home/foo/.cache/exercism/configlet/problem-specifications'
Please run once without --offline to clone 'problem-specifications' to that location.

If you currently have no (or limited) network connectivity, but you do have a local
'problem-specifications' elsewhere, you can copy it to the above location and then
use it with --offline

But configlet didn't cover the case reported in this issue. And there are some similar errors that we'll improve in the future.

@ee7 ee7 reopened this Oct 24, 2022
@ee7 ee7 closed this as completed in #684 Oct 27, 2022
ee7 added a commit that referenced this issue Oct 27, 2022
Before this commit, running a `configlet sync` or `configlet info`
command when all these conditions were satisfied:

- The problem-specifications cache was present and valid
- and the --offline option was not passed
- but we failed to update the cache due to a network error

produced an unhelpful error:

    $ configlet sync
    Updating cached 'problem-specifications' data...
    fatal: unable to access 'https://github.com/exercism/problem-specifications/': Could not resolve host: github.com

    failed to fetch 'main' in problem-specifications directory: '/home/foo/.cache/exercism/configlet/problem-specifications'
    exec.nim(68)             execAndCheck
    Error: unhandled exception:  [OSError]

With this commit, configlet explains what the user can do next:

    $ configlet sync
    Updating cached 'problem-specifications' data...
    fatal: unable to access 'https://github.com/exercism/problem-specifications/': Could not resolve host: github.com

    failed to fetch 'main' in problem-specifications directory: '/home/foo/.cache/exercism/configlet/problem-specifications'
    Error: Unable to update the problem-specifications cache.

    You can either:

    - ensure that you have network connectivity, and run the same configlet command again
    - or add the '--offline' option to skip updating the cache

    The most recent commit in the problem-specifications cache is:

        commit 7012a73188698b2b7a2c340c1753d0198a38d8fa
        Author:     Katrina Owen <katrina.owen@gmail.com>
        CommitDate: Mon, 17 Oct 2022 16:36:08 +0200

            Change wording in tournament instructions (#2135)

Fixes: #683
@ee7 ee7 moved this to Done in Configlet roadmap Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmd: sync kind: bug User-facing incorrect behavior
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants