Skip to content

fix: stop treating restic auth failures as an uninitialized repository - #81

Merged
nikchester merged 1 commit into
devfrom
fix/backup-oauth-invalid-grant
Nov 6, 2026
Merged

nikchester merged 1 commit into
devfrom
fix/backup-oauth-invalid-grant

Conversation

@nikchester

Copy link
Copy Markdown
Owner

Summary

  • backup.sh runs restic init only when restic exits 10 (repository does not exist); any other failure fails the backup.
  • On invalid_grant the Telegram alert says to re-authorize rclone; otherwise it reports the restic exit code.
  • Regression test expired Google OAuth token fails backup without restic init (restic shim RESTIC_SHIM_INVALID_GRANT=1).
  • Runbook in docs/BACKUP_RESTORE.md and a note in docs/SECRETS.md about the 7-day token life of Testing OAuth apps.

Production was already recovered on 2026-11-06: new published OAuth project minecraft-backup-rclone, new rclone.conf on the VPS and in YANDEX_RCLONE_CONFIG, snapshot 0f160de4, healthcheck passed.

Test plan

  • Exit codes verified on the VPS with restic 0.18: expired token → 1, missing repository → 10.
  • backup.sh simulated locally for invalid_grant / network error / fresh repo / normal run.
  • test/local docker suite and shellcheck in CI (Docker is not available locally).

Closes #80

Production backups stopped on 2026-11-04 because Google expired the rclone
OAuth refresh token (consent screen in Testing status, 7-day token life).
backup.sh misread the resulting restic failure as "repository not
initialized", ran a doomed restic init and alerted without the cause.

- Run restic init only on exit code 10 (repository does not exist).
- Fail with a Telegram hint on invalid_grant, or the exit code otherwise.
- Regression test via a RESTIC_SHIM_INVALID_GRANT restic shim.
- Runbook for re-authorizing Google Drive and the new published
  minecraft-backup-rclone OAuth project.

Closes #80
@nikchester nikchester added bug Something isn't working area:infrastructure Infrastructure, operations, CI, or documentation change priority:critical Critical priority labels Nov 6, 2026
@nikchester
nikchester merged commit 33eb1f4 into dev Nov 6, 2026
3 checks passed
@nikchester
nikchester deleted the fix/backup-oauth-invalid-grant branch November 6, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:infrastructure Infrastructure, operations, CI, or documentation change bug Something isn't working priority:critical Critical priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant