Skip to content

Conversation

TheMythologist
Copy link

If getting of the latest version fails (due to Github API rate limiting or other reasons), the following error will be thrown:

~ gitmastery version
Traceback (most recent call last):
  File "main.py", line 6, in <module>
  File "app\cli.py", line 51, in start
  File "click\core.py", line 1442, in __call__
  File "click\core.py", line 1363, in main
  File "app\cli.py", line 18, in invoke
  File "click\core.py", line 1827, in invoke
  File "click\core.py", line 1226, in invoke
  File "click\core.py", line 794, in invoke
  File "click\decorators.py", line 34, in new_func
  File "app\cli.py", line 30, in cli
KeyError: 0
[PYI-15420:ERROR] Failed to execute script 'main' due to unhandled exception!

This PR fixes this error by only validating the version string if the request succeeds

@woojiahao
Copy link
Member

@TheMythologist Thank you for this! This was something glossed over before, but I would also like to gather some thoughts on this (cc @damithc ).

If the version check already times out, it is likely that the other instructions could fail as well. Do we want to gracefully abort the moment the version check fails? Or do we want to let those bits fail on their own?

@TheMythologist
Copy link
Author

Do the other requests also query the same domain (api.github.com)? If it is requests to the root domain github.com, the rate limits are separate so there may not be an issue.

@damithc
Copy link

damithc commented Sep 5, 2025

Also, perhaps it is possible to get the version without using the API? For example, https://github.com/git-mastery/app/releases/latest redirects to https://github.com/git-mastery/app/releases/tag/v4.12.0 The second URL contains the version number.

@woojiahao
Copy link
Member

@TheMythologist The other calls mostly use the raw.github API call. Seems like the public unauthenticated API calls are 60/hour which is really low (here)

@damithc We might be able to work with this instead. @TheMythologist would you be able to modify the check to use the redirected path instead? I don't think github.com is subjected to the same public API rate limit

@woojiahao
Copy link
Member

@TheMythologist bumping on this! Would you wanna take on the fix to modify the check path?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants