feat: add optional Google Drive OAuth setup - #15
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 957f12453f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| with patch( | ||
| "bbackup.management.gdrive_auth._load_installed_app_flow", | ||
| side_effect=gdrive_auth.OptionalDependencyMissing(gdrive_auth.INSTALL_HINT), | ||
| ): |
There was a problem hiding this comment.
Mock rclone before asserting missing OAuth extras
When this test runs on a machine without rclone, the command never reaches the patched _load_installed_app_flow: auth_gdrive() calls _preflight_rclone_config() first and returns the rclone-missing system error instead of the optional-dependency hint asserted below. Since rclone is an optional external tool for this repo, please mock the rclone preflight/config dump here so the unit test exercises the missing-extra path deterministically.
Useful? React with 👍 / 👎.
| BBACKUP_NO_INTERACTIVE_ENV, | ||
| ) | ||
| from bbackup.skills import get_skill | ||
| from bbackup.management import gdrive_auth as gdrive_auth_module |
There was a problem hiding this comment.
Avoid eager management imports in bbman startup
Importing gdrive_auth through bbackup.management eagerly executes bbackup/management/__init__.py, which imports modules that require packages such as yaml and docker. In a partially installed checkout where bbman check-deps is supposed to report or install missing Python dependencies, any bbman invocation now aborts during import before the dependency checker can run; import this helper lazily inside auth-gdrive or from the submodule without triggering the package initializer.
Useful? React with 👍 / 👎.
| "opt": {"obscure": True, "nonInteractive": True, "noOutput": True}, | ||
| } | ||
|
|
||
| _call_rclone_rc(method, payload, secrets) |
There was a problem hiding this comment.
Handle rclone's non-interactive config response
When rclone still has a Drive config question to ask, the RC API documents nonInteractive as “don't interact with a user, return questions” (rclone RC docs), but this call discards that response and reports the remote as configured. In those cases, for example post-token Drive/team-drive prompts, bbman auth-gdrive can exit 0 even though rclone did not finish writing a usable remote; check the returned body for a continuation/question state and either answer it or fail explicitly.
Useful? React with 👍 / 👎.
Summary
bbman auth-gdrivesetup for a dedicated rclone Google Drive remote.This branch is refreshed onto current
mainand contains no GitPython/management extra. It includes cryptography 50.0.0, health-floor enforcement, restic retention safety, and bounded xdist tests from main.Live Google authorization remains unverified because the Google API client was deleted; the implementation is validated through mocked OAuth/config flows, dry-run behavior, redaction tests, authenticated local rclone RC transport, and CLI/docs integration.
Verification
rclone core/versionRC smoke passed.