Skip to content

Add managed GCP provider, deployment rollback, and descriptions - #6810

Merged
Alek99 merged 5 commits into
mainfrom
claude/gcp-support-reflex-cli-j78sg3
Jul 25, 2026
Merged

Add managed GCP provider, deployment rollback, and descriptions#6810
Alek99 merged 5 commits into
mainfrom
claude/gcp-support-reflex-cli-j78sg3

Conversation

@Kastier1

Copy link
Copy Markdown
Contributor

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Description

This PR adds three major features to Reflex Cloud's deployment management:

  1. 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 deploy command prompts interactively when GCP is available, and --provider allows explicit selection. New CLI commands reflex cloud providers status and reflex cloud providers list provide visibility into connected cloud accounts.

  2. Deployment rollback: Added reflex cloud apps rollback DEPLOYMENT_ID to 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.

  3. Deployment descriptions: Deployments can now have optional changelog notes. Set one at deploy time with reflex deploy --description "...", or set/clear it later with reflex cloud apps describe DEPLOYMENT_ID --description "...". Descriptions appear in reflex cloud apps history output.

Changes

Core hosting utilities (packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py):

  • Added provider parameter to create_app() to pin apps to a specific hosting provider
  • New provider management functions: normalize_provider(), provider_display_name(), get_token_org_id(), get_token_tier(), get_gcp_provider_status(), gcp_deploy_available(), list_provider_accounts(), set_app_provider()
  • New deployment management functions: rollback_deployment(), update_deployment_description()
  • Provider constants and aliases mapping user-facing names to backend values

CLI commands:

  • New reflex cloud providers group with status and list subcommands (packages/reflex-hosting-cli/src/reflex_cli/v2/providers.py)
  • New reflex cloud apps rollback and reflex cloud apps describe subcommands (packages/reflex-hosting-cli/src/reflex_cli/v2/apps.py)
  • Updated reflex deploy to accept --provider and --description options, with interactive provider selection when GCP is available (reflex/reflex.py and packages/reflex-hosting-cli/src/reflex_cli/v2/cli.py)
  • Added _resolve_deploy_provider() helper to handle provider selection logic with warnings for provider switches

Documentation:

  • New docs/hosting/cloud-providers.md explaining managed GCP deploys, provider selection, and the distinction from self-service GCP deploys
  • Updated docs/hosting/app-management.md with deployment history, rollback, and description sections
  • Updated CLI reference docs to include new commands

Tests:

  • Comprehensive unit tests for all new hosting utilities and CLI commands
  • Tests cover provider normalization, GCP availability checks, provider switching, rollback, and description updates
  • Tests verify error handling and interactive mode behavior

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 updates
  • tests/units/reflex_cli/v2/test_providers.py: providers status and providers list CLI commands
  • tests/units/reflex_cli/v2/test_apps.py: apps rollback and apps describe CLI commands
  • tests/units/reflex_cli/v2/test_cli.py: _resolve_deploy_provider() logic and provider switching

Run with: uv run pytest tests/units/reflex_cli --cov

https://claude.ai/code/session_01K1YRndqwXapfwj5Rtx9Mzz

…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
@codspeed-hq

codspeed-hq Bot commented Jul 23, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 26 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing claude/gcp-support-reflex-cli-j78sg3 (56f83e9) with main (052d891)

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds three well-scoped features to Reflex Cloud's deployment management: a managed GCP provider (Enterprise tier) with interactive selection and reflex cloud providers visibility commands, reflex cloud apps rollback for quick recovery without a rebuild, and optional deployment descriptions surfaced in reflex cloud apps history. The implementation is solid, with comprehensive unit tests and the confirmation-default regressions from the previous review round addressed.

  • hosting.py grows a clean set of provider utilities (normalize_provider, gcp_deploy_available, set_app_provider, etc.) and rollback/description API wrappers following the existing error-string return convention.
  • cli.py introduces _resolve_deploy_provider and _restore_provider_on_failure to handle provider selection, teardown warnings, and best-effort restore on failure — all well-covered by tests.
  • A minor gap: both the teardown warning and the _restore_provider_on_failure rollback guard rely on app.get(\"provider\") is not None; for legacy apps whose backend response omits the field, both guards are bypassed silently.

Confidence Score: 4/5

Safe 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

Filename Overview
packages/reflex-hosting-cli/src/reflex_cli/v2/cli.py Adds _resolve_deploy_provider and _restore_provider_on_failure helpers and threads --provider/--description through deploy(); the two-step app-creation-then-provider-switch design means a new app's provider is not set atomically (existing outside-diff finding).
packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py Adds provider constants/aliases, GCP availability check, provider account listing, set_app_provider, rollback_deployment, update_deployment_description, and extends create_app/create_deployment/get_app_history — solid implementation with consistent error-string return pattern and good tests.
packages/reflex-hosting-cli/src/reflex_cli/v2/apps.py Adds app_rollback and app_describe commands and the _resolve_app_id helper; confirmation defaults to n (addressed previous feedback), logic is clean.
packages/reflex-hosting-cli/src/reflex_cli/v2/providers.py New providers_cli group with status and list subcommands; consistent error handling, JSON mode, and org resolution via token or --org-id.
tests/units/reflex_cli/v2/test_cli.py Tests _resolve_deploy_provider and _restore_provider_on_failure covering explicit selection, no-switch cases, failure recovery, and confirms confirmation defaults to n.
tests/units/reflex_cli/utils/test_hosting.py Comprehensive tests for all new hosting utilities; covers normalization, GCP availability, provider listing/switching, rollback, and description updates.
tests/units/reflex_cli/v2/test_apps.py Tests rollback and describe commands including cancellation, error exits, app-name resolution, and _resolve_app_id priority rules.
tests/units/reflex_cli/v2/test_providers.py Tests providers status and list commands including JSON output, empty provider list, error exits, and org-id resolution from token.
packages/reflex-hosting-cli/src/reflex_cli/core/config.py Adds provider: str
reflex/reflex.py Adds --provider and --description Click options to the top-level reflex deploy command and threads them through to the hosting CLI.

Reviews (5): Last reviewed commit: "Review fixes: restore provider on failed..." | Re-trigger Greptile

Comment thread packages/reflex-hosting-cli/src/reflex_cli/v2/apps.py
Comment thread packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py
claude added 2 commits July 23, 2026 23:27
- 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
Comment thread packages/reflex-hosting-cli/src/reflex_cli/v2/cli.py
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
@Kastier1
Kastier1 marked this pull request as ready for review July 24, 2026 15:33
@Kastier1
Kastier1 requested review from a team and Alek99 as code owners July 24, 2026 15:33
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@Kastier1

Copy link
Copy Markdown
Contributor Author

@codex please review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread packages/reflex-hosting-cli/src/reflex_cli/v2/cli.py
Comment thread packages/reflex-hosting-cli/src/reflex_cli/v2/apps.py Outdated
Comment thread packages/reflex-hosting-cli/src/reflex_cli/v2/apps.py Outdated
…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
@Alek99
Alek99 merged commit 416eb34 into main Jul 25, 2026
108 checks passed
@Alek99
Alek99 deleted the claude/gcp-support-reflex-cli-j78sg3 branch July 25, 2026 00:46
benedikt-bartscher pushed a commit to benedikt-bartscher/reflex that referenced this pull request Jul 30, 2026
…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>
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.

3 participants