fix: surface GitHub auth failures and allow skipping repo creation#462
Open
shannah wants to merge 1 commit into
Open
fix: surface GitHub auth failures and allow skipping repo creation#462shannah wants to merge 1 commit into
shannah wants to merge 1 commit into
Conversation
- Throw GitHubAuthenticationException (an IOException subtype) on HTTP 401 in GitHubRepositoryInitializer and GitHubUsernameService so callers can distinguish bad/expired credentials from other I/O errors. - Add a createGitHubRepository flag to ProjectGeneratorRequest (default true) and honor it in ProjectGenerator so an existing repository can be used as a push target without attempting to create it. - Roll back the freshly-created project directory (and its -releases sibling) when generation fails, so a failed attempt doesn't leave a directory behind that blocks retrying. https://claude.ai/code/session_0156xouo4EmaKjSihdHSDXxF
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
This is the CLI-side half of a two-PR fix for the GitHub "Bad credentials" (HTTP 401) problem reported in shannah/jdeploy-desktop-gui#80, where the desktop GUI fails to create a project with a 401 and never offers a way to fix the credentials. The companion GUI PR is shannah/jdeploy-desktop-gui (branch
claude/sleepy-thompson-sl3q4).These changes make the CLI's GitHub integration easier to recover from and less destructive on failure.
Changes
Typed authentication failure — new
GitHubAuthenticationException(a subclass ofIOException, so existingcatch (IOException)callers are unaffected).GitHubRepositoryInitializer.createGitHubRepository()andGitHubUsernameService.getGitHubUsername()now throw it on HTTP 401, so callers (e.g. the desktop GUI) can distinguish an invalid/expired token from other I/O errors and prompt the user to re-authenticate.Optional repository creation — added a
createGitHubRepositoryflag toProjectGeneratorRequest/ProjectGeneratorRequestBuilder(defaults totrue, so existing behaviour is unchanged). Whenfalse,ProjectGeneratorskips thePOST /user/reposcall and uses the repository purely as a push target. This lets a project target an already-existing repo without attempting to create it.Rollback on failure —
ProjectGenerator.generate()now deletes the freshly-created project directory (and its-releasessibling) if generation fails after the directory was created. Previously a failed attempt (e.g. a 401 during repo creation) left the directory on disk, which then tripped the "Project directory already exists" check on the next attempt.Testing
mvn -pl shared,cli -am install— builds cleanly.mvn -pl cli test(integration tests skipped) — passes.Existing behaviour is preserved: the new flag defaults to
trueand the new exception is anIOExceptionsubtype.https://claude.ai/code/session_0156xouo4EmaKjSihdHSDXxF
Generated by Claude Code