Skip to content

add reflex hosting cli#6369

Merged
adhami3310 merged 16 commits into
mainfrom
import-hosting-cli
Apr 23, 2026
Merged

add reflex hosting cli#6369
adhami3310 merged 16 commits into
mainfrom
import-hosting-cli

Conversation

@adhami3310
Copy link
Copy Markdown
Member

No description provided.

Comment thread packages/reflex-hosting-cli/.github/workflows/pre-commit.yml Fixed
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 23, 2026

Merging this PR will not alter performance

✅ 9 untouched benchmarks


Comparing import-hosting-cli (1ac5a95) with main (2fe1a44)

Open in CodSpeed

@adhami3310 adhami3310 marked this pull request as ready for review April 23, 2026 01:28
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 23, 2026

Greptile Summary

This PR introduces the reflex-hosting-cli package — a standalone CLI for managing Reflex cloud deployments, projects, secrets, and app lifecycle — along with a comprehensive test suite. The majority of issues raised in earlier review rounds have been addressed (token logging, file truncation on re-login, URL injection via f-strings, pagination recursion, missing raise statements, and unguarded PackageNotFoundError).

  • P1 (v2/cli.py): The envfile ImportError handler in deploy does not call raise click.exceptions.Exit(1), so when python-dotenv is absent the deploy proceeds with no environment variables — silently omitting all intended secrets. The same bug was already fixed in secrets.py.

Confidence Score: 4/5

Safe to merge after the envfile silent-drop bug in deploy is fixed; all other previously flagged P0/P1 issues are resolved.

One remaining P1 defect: the envfile ImportError in v2/cli.py:deploy falls through without exiting, causing a deploy with no env vars when python-dotenv is missing. All other major issues from prior review rounds are addressed. The P2 mutation in ScaleParams.as_json does not block merge.

packages/reflex-hosting-cli/src/reflex_cli/v2/cli.py — the envfile ImportError handler in deploy()

Important Files Changed

Filename Overview
packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py Core hosting utilities (2227 lines): auth, token management, app/project CRUD, log fetching, deployment — previously flagged issues (token logging, file truncation, URL injection, pagination) are addressed; minor side-effect mutation in ScaleParams.as_json remains.
packages/reflex-hosting-cli/src/reflex_cli/v2/cli.py Top-level deploy/login/logout entry points: contains a P1 bug where envfile ImportError does not exit, causing deploy to proceed with no env vars; otherwise structure is sound.
packages/reflex-hosting-cli/src/reflex_cli/v2/deployments.py hosting_cli group callback: PackageNotFoundError for reflex is now properly guarded; check_version still hard-exits on any newer patch (acknowledged as follow-up).
packages/reflex-hosting-cli/src/reflex_cli/v2/apps.py App management commands (stop/start/delete/logs/scale/inspect/list): app_logs now uses a while loop with isinstance cursor check; list_apps and app_logs both catch NotAuthenticatedError; looks correct.
packages/reflex-hosting-cli/src/reflex_cli/v2/project.py Project management commands: missing raise statements for NotAuthenticatedError are fixed; select_project now catches NotAuthenticatedError alongside HTTPStatusError.
packages/reflex-hosting-cli/src/reflex_cli/v2/secrets.py Secrets commands: envfile ImportError now exits cleanly; NotAuthenticatedError handled in all three commands; correct.

Reviews (8): Last reviewed commit: "add any missing timeouts and guard again..." | Re-trigger Greptile

Comment thread packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py
Comment thread packages/reflex-hosting-cli/src/reflex_cli/v2/project.py
Comment thread packages/reflex-hosting-cli/src/reflex_cli/v2/project.py
Comment thread packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py
Comment thread packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py
@adhami3310
Copy link
Copy Markdown
Member Author

@greptile

Comment thread packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py
Comment thread packages/reflex-hosting-cli/src/reflex_cli/v2/deployments.py Outdated
@adhami3310
Copy link
Copy Markdown
Member Author

@greptile

Comment thread packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py Outdated
@adhami3310
Copy link
Copy Markdown
Member Author

@greptile

Comment thread packages/reflex-hosting-cli/src/reflex_cli/v2/secrets.py Outdated
@adhami3310
Copy link
Copy Markdown
Member Author

@greptile

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
@adhami3310
Copy link
Copy Markdown
Member Author

@greptile

Comment thread packages/reflex-hosting-cli/src/reflex_cli/v2/deployments.py
Comment thread packages/reflex-hosting-cli/src/reflex_cli/v2/project.py
@adhami3310
Copy link
Copy Markdown
Member Author

@greptile

Comment thread packages/reflex-hosting-cli/src/reflex_cli/v2/apps.py Outdated
@adhami3310
Copy link
Copy Markdown
Member Author

@greptile

Comment on lines +380 to +389
if envfile:
try:
from dotenv import dotenv_values # pyright: ignore[reportMissingImports]

processed_envs = dotenv_values(envfile)
except ImportError:
console.error(
"""The `python-dotenv` package is required to load environment variables from a file. Run `pip install "python-dotenv>=1.0.1"`."""
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 envfile ImportError falls through — deployment uses wrong env vars

When --envfile is given but python-dotenv is not installed, the ImportError is caught and logged, but execution falls through without exiting. The processed_envs variable retains whatever was set earlier (typically None when only --envfile was provided, since the --env flags are ignored when --envfile is set), so create_deployment is called with no env vars at all — silently dropping every intended secret from the deployment. The identical bug was already fixed in secrets.py's update_secrets; a raise click.exceptions.Exit(1) from None is needed inside this except ImportError block.

@adhami3310 adhami3310 merged commit 4710b25 into main Apr 23, 2026
67 of 68 checks passed
@adhami3310 adhami3310 deleted the import-hosting-cli branch April 23, 2026 17:43
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