Skip to content

Answer an unchecked backup failure in web mode with the documented error body - #72

Merged
dmccoystephenson merged 2 commits into
mainfrom
feature/web-backup-unchecked-failure
Nov 13, 2026
Merged

dmccoystephenson merged 2 commits into
mainfrom
feature/web-backup-unchecked-failure

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

  • BackupController.createBackup now catches Exception instead of only IOException. An unchecked failure from BackupService.backupUserRepositories (such as a GHException raised by github-api while listing repositories) is answered with 500 and { "success": false, "message": "Error: ..." }, as COMMANDS.md documents, and no backup-completed event is reported. Previously the exception escaped to Spring Boot's default error handling, whose body carries no message, so the web UI showed only Failed to create backup..
  • The command line, interactive mode and daemon (Keep the daemon's scheduled run going after an unchecked failure #66) already catch Exception; this brings the web endpoint in line with them.
  • The now-unused java.io.IOException import is removed.
  • CHANGELOG.md gains a Fixed entry.

Closes #71

Test plan

  • New BackupControllerTest.createBackup_UncheckedFailure: a mocked IllegalStateException produces 500, success: false, message: "Error: Unchecked test error", and no backupCompleted() call
  • Regression confirmed empirically: with the controller change stashed, mvn test -Dtest=BackupControllerTest ran 17 tests with 1 error; with it restored, the test passes
  • mvn test: 228 tests run, 0 failures, 0 errors, 1 skipped (pre-existing)
  • CI green on the PR head

Docs

COMMANDS.md already documents the 500 BackupResponse for a failed backup without restricting the cause, so it now describes the behavior accurately and is not changed. No configuration, flag or endpoint is added, so CONFIG.md, USER_GUIDE.md and README.md are unaffected.

Skipped issues

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

dmccoystephenson and others added 2 commits November 12, 2026 20:57
…ror body (#71)

BackupController.createBackup caught only IOException, so an unchecked
failure such as a GHException escaped to Spring Boot's default error
handling, whose body has no message for the web UI to show. It now
catches Exception, as the CLI and daemon already do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (PR #72, head 5a88b98):

  • Scope: PASS — three files: the controller fix, its regression test, and one CHANGELOG.md entry; the removed IOException import became unused because of the fix.
  • Tests-new: PASS — no new public method; the changed catch is exercised by createBackup_UncheckedFailure, and the existing createBackup_Failure still covers the IOException path.
  • Tests-fix: PASS — confirmed empirically: with BackupController.java stashed, mvn test -Dtest=BackupControllerTest ran 17 tests with 1 error (the IllegalStateException escaped MockMvc); with the change restored, it passes. Full mvn test: 228 run, 0 failures, 1 skipped (pre-existing).
  • Sibling structure: PASS — the new test follows the createBackup_<Scenario> naming and the MockMvc/@MockBean pattern of its neighbors.
  • Sibling renames: PASS — no identifiers renamed.
  • Docs: PASS — COMMANDS.md already documents the 500 { success: false, message: "Error: ..." } body for a failed backup without limiting the cause, so the code now matches it; CHANGELOG.md [Unreleased]/Fixed lists the change; no flag, property or endpoint is added, so CONFIG.md, USER_GUIDE.md and README.md need nothing.
  • Issue resolution: PASS — POST /api/backups returns Spring's default error body, without a message, when a backup fails with an unchecked exception #71 names BackupController.createBackup's IOException-only catch, which is the line changed.
  • CI: PASS — build and docker-build both green on the PR head.
  • Config-doc parity: PASS — no properties touched.
  • Command-doc parity: PASS — no CLI flag, system property or endpoint added.
  • Package placement: PASS — changes stay in com.github.backup.web.
  • No credential leakage: PASS — the error text is the exception message, as for the IOException path before; nothing token-related is added.

Judgment notes (no change made):

  • src/main/java/com/github/backup/web/BackupController.java:40 — the broader catch (Exception e) also wraps usageReporting.backupCompleted(). TraceClient.report only queues the event on its executor and returns, so a throw there after a successful backup is not expected; were it to happen, the request would now be reported as failed rather than escaping as Spring's default 500, which is no worse than before.
  • An exception with a null message produces Error: null. That was already true of the IOException path and is left as is to keep this PR scoped to POST /api/backups returns Spring's default error body, without a message, when a backup fails with an unchecked exception #71.

This review was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit 670438c into main Nov 13, 2026
2 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/web-backup-unchecked-failure branch November 13, 2026 03:59
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.

POST /api/backups returns Spring's default error body, without a message, when a backup fails with an unchecked exception

1 participant