Add managed GCP provider, deployment rollback, and descriptions - #6810
Conversation
…osting CLI Port the cloud GCP provider feature set to the reflex-hosting-cli client and document it. The backend endpoints already exist; this wires them into the CLI with a focus on UX. reflex deploy: - Prompt for "Reflex Cloud vs. Google Cloud (GCP)" when the org has a GCP account connected and GCP deploys are allowed (Enterprise). Add --provider to skip the prompt and a `provider` config-file field. The provider is pinned before the hostname is reserved so a GCP app bakes its *.run.app backend URL into the exported frontend, and region/VM-type are dropped for GCP (they come from the connected account). - Add --description to record an optional changelog note on the deployment. reflex cloud apps: - rollback DEPLOYMENT_ID: redeploy a previous deployment's image without rebuilding from source. - describe DEPLOYMENT_ID --description: set/clear a deployment's note. - history now surfaces each deployment's description and rollback eligibility. reflex cloud providers (new group): - status / list: inspect the cloud provider accounts connected to the org. Docs: new "Cloud Providers" page, app-management history/description/rollback sections, a self-service-vs-managed note on deploy-to-gcp, CLI-reference wiring, and towncrier news fragments. Tests: unit coverage for the new hosting client functions, the deploy provider-selection flow, the apps rollback/describe commands, and the providers group. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1YRndqwXapfwj5Rtx9Mzz
Merging this PR will not alter performance
Comparing Footnotes
|
Greptile SummaryThis PR adds three well-scoped features to Reflex Cloud's deployment management: a managed GCP provider (Enterprise tier) with interactive selection and
Confidence Score: 4/5Safe to merge with awareness of the legacy-app edge case in provider switching. The core new flows are well-tested and the critical confirmation-default regressions are confirmed fixed. The remaining gap — legacy apps with a null provider field bypassing both the teardown warning and the rollback-safety context manager — is a realistic scenario but bounded in impact. packages/reflex-hosting-cli/src/reflex_cli/v2/cli.py — the _resolve_deploy_provider guard and switched_from tracking both branch on current is not None, which may be falsy for pre-existing apps. Important Files Changed
Reviews (5): Last reviewed commit: "Review fixes: restore provider on failed..." | Re-trigger Greptile |
- reflex cloud apps rollback: default the confirmation to "n" so pressing
Enter cancels rather than replacing the running deployment (matches
apps delete).
- Remove the "fly" alias from PROVIDER_ALIASES so `--provider fly` is not
accepted — users shouldn't couple deploy scripts to how Reflex Cloud is
hosted. Only provider-agnostic names (reflex-cloud/reflex/cloud/gcp/...)
are exposed; "fly" stays an internal wire value. De-emphasize "fly" in
docstrings and comments in favor of "Reflex Cloud".
- Tests: rollback now defaults to cancel; normalize_provider("fly") is None.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1YRndqwXapfwj5Rtx9Mzz
The pre-commit `pyright` hook (which checks `reflex tests`) flagged the new tests: - The shared `_ok` helper is typed for dict payloads; add a small `_ok_body` helper for the list/str JSON responses (provider list, history list, deployment id). - rollback_deployment / update_deployment_description return `str | None`, so narrow with `assert result is not None` before `.startswith(...)`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1YRndqwXapfwj5Rtx9Mzz
The "Continue?" prompt shown before switching a deployed app to a different provider (which tears down the current deployment) defaulted to "y", so pressing Enter alone proceeded with the destructive teardown. Default it to "n" to match the rollback confirmation, and add a regression test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1YRndqwXapfwj5Rtx9Mzz
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
@codex please review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 77f197e954
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…back hint Addresses three review comments: - P1 (cli.py): a provider switch on an already-deployed app tears its old resources down before hostname reservation, export, and deployment creation — any of which can fail, stranding the app on the new provider. Wrap that pipeline in `_restore_provider_on_failure`: on failure, best-effort re-pin the previous provider so its last deployment stays a valid `reflex cloud apps rollback` target, and tell the user how to recover. - P2 (apps.py `_resolve_app_id`): honor an explicit `--app-name` before the cloud.yml/pyproject `appid` fallback, so `--app-name` is no longer silently ignored when a config appid is present. Precedence is now --app-id > --app-name > config. - P2 (apps.py rollback): include the deployment id and `--watch` in the post-rollback tracking hint (the bare `reflex cloud apps status` exits with a missing-argument error). Adds regression tests for all three. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1YRndqwXapfwj5Rtx9Mzz
…ex-dev#6810) * Add GCP managed provider, rollbacks, and deployment descriptions to hosting CLI Port the cloud GCP provider feature set to the reflex-hosting-cli client and document it. The backend endpoints already exist; this wires them into the CLI with a focus on UX. reflex deploy: - Prompt for "Reflex Cloud vs. Google Cloud (GCP)" when the org has a GCP account connected and GCP deploys are allowed (Enterprise). Add --provider to skip the prompt and a `provider` config-file field. The provider is pinned before the hostname is reserved so a GCP app bakes its *.run.app backend URL into the exported frontend, and region/VM-type are dropped for GCP (they come from the connected account). - Add --description to record an optional changelog note on the deployment. reflex cloud apps: - rollback DEPLOYMENT_ID: redeploy a previous deployment's image without rebuilding from source. - describe DEPLOYMENT_ID --description: set/clear a deployment's note. - history now surfaces each deployment's description and rollback eligibility. reflex cloud providers (new group): - status / list: inspect the cloud provider accounts connected to the org. Docs: new "Cloud Providers" page, app-management history/description/rollback sections, a self-service-vs-managed note on deploy-to-gcp, CLI-reference wiring, and towncrier news fragments. Tests: unit coverage for the new hosting client functions, the deploy provider-selection flow, the apps rollback/describe commands, and the providers group. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1YRndqwXapfwj5Rtx9Mzz * Address review: safer rollback default, drop user-facing "fly" alias - reflex cloud apps rollback: default the confirmation to "n" so pressing Enter cancels rather than replacing the running deployment (matches apps delete). - Remove the "fly" alias from PROVIDER_ALIASES so `--provider fly` is not accepted — users shouldn't couple deploy scripts to how Reflex Cloud is hosted. Only provider-agnostic names (reflex-cloud/reflex/cloud/gcp/...) are exposed; "fly" stays an internal wire value. De-emphasize "fly" in docstrings and comments in favor of "Reflex Cloud". - Tests: rollback now defaults to cancel; normalize_provider("fly") is None. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1YRndqwXapfwj5Rtx9Mzz * Fix pyright errors in test_hosting.py (pre-commit) The pre-commit `pyright` hook (which checks `reflex tests`) flagged the new tests: - The shared `_ok` helper is typed for dict payloads; add a small `_ok_body` helper for the list/str JSON responses (provider list, history list, deployment id). - rollback_deployment / update_deployment_description return `str | None`, so narrow with `assert result is not None` before `.startswith(...)`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1YRndqwXapfwj5Rtx9Mzz * Default provider-switch teardown confirmation to "n" The "Continue?" prompt shown before switching a deployed app to a different provider (which tears down the current deployment) defaulted to "y", so pressing Enter alone proceeded with the destructive teardown. Default it to "n" to match the rollback confirmation, and add a regression test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1YRndqwXapfwj5Rtx9Mzz * Review fixes: restore provider on failed switch, arg precedence, rollback hint Addresses three review comments: - P1 (cli.py): a provider switch on an already-deployed app tears its old resources down before hostname reservation, export, and deployment creation — any of which can fail, stranding the app on the new provider. Wrap that pipeline in `_restore_provider_on_failure`: on failure, best-effort re-pin the previous provider so its last deployment stays a valid `reflex cloud apps rollback` target, and tell the user how to recover. - P2 (apps.py `_resolve_app_id`): honor an explicit `--app-name` before the cloud.yml/pyproject `appid` fallback, so `--app-name` is no longer silently ignored when a config appid is present. Precedence is now --app-id > --app-name > config. - P2 (apps.py rollback): include the deployment id and `--watch` in the post-rollback tracking hint (the bare `reflex cloud apps status` exits with a missing-argument error). Adds regression tests for all three. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1YRndqwXapfwj5Rtx9Mzz --------- Co-authored-by: Claude <noreply@anthropic.com>
Type of change
Description
This PR adds three major features to Reflex Cloud's deployment management:
Managed GCP provider support: Organizations with Enterprise tier can now deploy to their own Google Cloud (GCP) account connected via the Reflex Cloud dashboard. The
reflex deploycommand prompts interactively when GCP is available, and--providerallows explicit selection. New CLI commandsreflex cloud providers statusandreflex cloud providers listprovide visibility into connected cloud accounts.Deployment rollback: Added
reflex cloud apps rollback DEPLOYMENT_IDto roll an app back to a previous deployment by redeploying its already-built image without rebuilding from source. This is useful for quick recovery from bad deployments.Deployment descriptions: Deployments can now have optional changelog notes. Set one at deploy time with
reflex deploy --description "...", or set/clear it later withreflex cloud apps describe DEPLOYMENT_ID --description "...". Descriptions appear inreflex cloud apps historyoutput.Changes
Core hosting utilities (
packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py):providerparameter tocreate_app()to pin apps to a specific hosting providernormalize_provider(),provider_display_name(),get_token_org_id(),get_token_tier(),get_gcp_provider_status(),gcp_deploy_available(),list_provider_accounts(),set_app_provider()rollback_deployment(),update_deployment_description()CLI commands:
reflex cloud providersgroup withstatusandlistsubcommands (packages/reflex-hosting-cli/src/reflex_cli/v2/providers.py)reflex cloud apps rollbackandreflex cloud apps describesubcommands (packages/reflex-hosting-cli/src/reflex_cli/v2/apps.py)reflex deployto accept--providerand--descriptionoptions, with interactive provider selection when GCP is available (reflex/reflex.pyandpackages/reflex-hosting-cli/src/reflex_cli/v2/cli.py)_resolve_deploy_provider()helper to handle provider selection logic with warnings for provider switchesDocumentation:
docs/hosting/cloud-providers.mdexplaining managed GCP deploys, provider selection, and the distinction from self-service GCP deploysdocs/hosting/app-management.mdwith deployment history, rollback, and description sectionsTests:
Test Plan
All new functionality is covered by unit tests:
tests/units/reflex_cli/utils/test_hosting.py: Provider utilities, GCP status, provider account listing, rollback, and description updatestests/units/reflex_cli/v2/test_providers.py:providers statusandproviders listCLI commandstests/units/reflex_cli/v2/test_apps.py:apps rollbackandapps describeCLI commandstests/units/reflex_cli/v2/test_cli.py:_resolve_deploy_provider()logic and provider switchingRun with:
uv run pytest tests/units/reflex_cli --covhttps://claude.ai/code/session_01K1YRndqwXapfwj5Rtx9Mzz