Repository navigation
Report failed repositories to the caller and in the exit status - #57
Merged
Merged
Conversation
A failed clone or fetch only printed a warning, so POST /api/backups answered 200 with a success message and the command line exited 0. BackupService now throws after attempting every repository, and a non-interactive run that fails exits with status 1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric, run against head
Regression gate: the fix tests listed above satisfy it. Do-not-auto-merge paths: none matched (no Findings:
This comment 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
BackupService.backupUserRepositoriesstill attempts every repository, but now throws anIOExceptionnaming the failed ones (Failed to back up 1 of 8 repositories for octocat: Hello-World). All three callers already catchIOException, soPOST /api/backupsanswers500instead of200with a success message, and the daemon logs the failure as an error.1and ends withBackup completed with errors.instead of exiting0afterBackup completed!.BackupCommandLineRunnerimplementsExitCodeGenerator, andGhBackupApplication.mainexits throughSpringApplication.exitonly when that runner is present, so web and daemon modes keep running.COMMANDS.mdgains an Exit Status section and the new500case,USER_GUIDE.mdgains a scenario for detecting a failure from a script, andCHANGELOG.mdis updated.Behaviour changes worth checking
backup-completedusage event, because the controller sends it only on success. This matches how a fatal failure already behaved. Command-line and daemon runs still report the event when they fail, as the existing tests specify.0, since each failure is reported at the prompt.Test plan
mvn -o test: 196 tests run, 0 failures, 0 errors, 1 skippedBackupServicechange stashed,testBackupUserRepositories_FailedRepositoryIsSummarizedAndOthersContinueandtestBackupUserRepositories_AllRepositoriesFailing_AreAllNamedfail; with the assignment of the exit code removed,testGetExitCode_FailedUser,testGetExitCode_LaterSuccessDoesNotClearAnEarlierFailureandtestExitStatus_FailedBackupReachesSpringApplicationExitfail. All pass with the fix restored.System.exitcall inGhBackupApplication.mainwas not executed, because launching the JAR was refused by this session's sandbox. Its condition (isCommandLineRun, in default, web and daemon modes) and the status returned bySpringApplication.exitare tested in a Spring context, but the real process status has not been observed. A manual check is recommended: run the JAR with a nonexistent user and read$?.Closes #55
Closes #56
Skipped issues
#8 (missing
LICENSE) remains deferred: it requires the maintainer to choose the license text, copyright holder and year.This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
drafted by Claude on behalf of Daniel Stephenson
🤖 Generated with Claude Code