Repository navigation
Classify GitHub failures by type instead of guessing - #62
Merged
Merged
Conversation
Only a 401 now drops GITHUB_TOKEN; any other failed startup check keeps the token and says it could not be verified, so a brief outage no longer leaves a daemon anonymous until it is restarted. A name is reported as not found on FileNotFoundException rather than when the message contains "404", which the URL in a connection failure's message could supply. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric (head
Findings and limits:
This review was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GITHUB_TOKENis now only dropped when the startup check is answered with a401. Any other failure, such as a connection failure, a5xxor a403fromGET /user, is reported asCould not verify GITHUB_TOKENand the token is kept. Previously all of them were reported as an invalid token, and a daemon was left at the anonymous rate limit until it was restarted.FileNotFoundExceptionis raised, which is what github-api raises for a 404, instead of when the exception message contains404. A connection failure for a name such asteam404is no longer misreported, and a real 404 no longer depends on the digits appearing in GitHub's response body.GitHubService(String token)constructor was added so the token paths can be tested whatever the environment holds. The unusedorgExceptionlocal was removed.USER_GUIDE.md,CONFIG.mdandCHANGELOG.mdwere updated. No flag, property or endpoint was added, soCOMMANDS.mdis unchanged.Closes #60
Closes #61
Evidence
The exception types and messages the fix relies on were observed by running github-api 1.318 against a loopback stub (a scratch test, not committed). They are tabulated in #60 and #61.
Skipped issues
#8 (missing
LICENSEfile) was not picked: a license and copyright holder have to be chosen by the maintainer, as recorded on that issue.Behavior note
If the startup check fails for a transient reason and the token also turns out to be invalid, later requests fail with GitHub's
401instead of falling back to anonymous access, until the process is restarted. That was judged preferable to a silently degraded daemon, because the failure is visible in the error output.Test plan
mvn test: 212 tests run, 0 failures, 1 skipped (the live-token test, which needsGITHUB_TOKEN)GitHubServiceTesttests failed; the tests passed again once it was removedBuildworkflow is green on the PR head (buildanddocker-buildon8f2031a)This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson