Skip to content

ENG-9522: Fix CLI: Lists projects as "Unknown"#6530

Merged
Kastier1 merged 2 commits into
mainfrom
carlos/cli-list-projects-unknown
May 19, 2026
Merged

ENG-9522: Fix CLI: Lists projects as "Unknown"#6530
Kastier1 merged 2 commits into
mainfrom
carlos/cli-list-projects-unknown

Conversation

@carlosabadia
Copy link
Copy Markdown
Contributor

No description provided.

@carlosabadia carlosabadia requested a review from a team as a code owner May 19, 2026 11:26
@carlosabadia carlosabadia added the cloud https://cloud.reflex.dev/ label May 19, 2026
@linear
Copy link
Copy Markdown

linear Bot commented May 19, 2026

ENG-9522

@carlosabadia carlosabadia requested a review from Kastier1 May 19, 2026 11:27
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 19, 2026

Merging this PR will not alter performance

✅ 24 untouched benchmarks


Comparing carlos/cli-list-projects-unknown (054c274) with main (3c5b9ce)

Open in CodSpeed

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 19, 2026

Greptile Summary

This PR fixes the CLI listing projects as "Unknown" by avoiding a redundant get_project API call and instead reading the project name from the embedded project dict already present in the search_app response. It also adds normalize_project_id to treat blank/non-string project IDs as None, preventing whitespace-only values in hosting.json or config files from being forwarded to the backend.

  • normalize_project_id is applied at every ingestion point (config file, CLI arg, hosting.json, and search_project result), and get_selected_project is now called once per deploy invocation with the result cached in selected_project_id.
  • Project display names now fall back gracefully: embedded app["project"]["name"]project_name arg → project_id"your default project", eliminating the "Unknown" label entirely.
  • Nine new tests cover the refactored paths, including the blank-project-in-config guard and the single-get_project-call contract.

Confidence Score: 4/5

Safe to merge — the core logic is correct, well-covered by new tests, and no data-path regressions were found.

The refactoring is clean and all the critical paths (blank project ID, embedded project name, single API call contract) are exercised by the new test suite. The only finding is a now-dead branch in cli.py (lines 217-218) where search_project_id = selected_project_id can never have any effect after project_id already absorbed selected_project_id earlier in the function — it is a no-op rather than a logic error.

packages/reflex-hosting-cli/src/reflex_cli/v2/cli.py — the dead branch at lines 217-218 is worth removing for clarity.

Important Files Changed

Filename Overview
packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py Adds normalize_project_id helper that strips whitespace/non-string values to None; get_selected_project now delegates to it, fixing the silent pass-through of blank IDs.
packages/reflex-hosting-cli/src/reflex_cli/v2/cli.py Refactors deploy to call get_selected_project once, reuse validated_project instead of a second get_project call, and derive the app's project display name from the embedded app["project"] dict; contains one now-dead branch (lines 217-218).
tests/units/reflex_cli/utils/test_hosting.py Adds parametrized tests for normalize_project_id (all edge cases covered) and get_selected_project normalization via file-mock.
tests/units/reflex_cli/v2/test_cli.py Adds 9 new integration-style tests covering the refactored deploy paths: embedded project name, single get_project call, non-default project confirmation, fallback to project ID, decline cancellation, and empty-project-in-config guard.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[deploy called] --> B[Load config / CLI args]
    B --> C[normalize_project_id on project_id]
    C --> D{project_name and no project_id?}
    D -- Yes --> E[search_project]
    E --> F[normalize_project_id on result id]
    D -- No --> G
    F --> G[get_selected_project to selected_project_id]
    G --> H{project_id is None?}
    H -- Yes --> I[project_id = selected_project_id]
    H -- No --> J
    I --> J{project_id set?}
    J -- Yes --> K[get_project to validated_project]
    J -- No --> L[validated_project = None]
    K --> M[search_app]
    L --> M
    M --> N{App found?}
    N -- Yes, interactive --> O{app project != selected?}
    O -- Yes --> P[Name from app.project.name OR app_project_id]
    O -- No --> Q[Proceed to deploy]
    P --> Q
    N -- No, interactive --> R{needs_confirmation?}
    R -- Yes, project_id set --> S[Name from validated_project or project_name or project_id]
    R -- Yes, no project_id --> T[get_default_project for display name]
    S --> U[Ask to create and deploy]
    T --> U
    U --> V[create_app and deploy]
    Q --> V
Loading

Reviews (1): Last reviewed commit: "ENG-9522: Fix CLI: Lists projects as "Un..." | Re-trigger Greptile

Comment thread packages/reflex-hosting-cli/src/reflex_cli/v2/cli.py Outdated
@Kastier1 Kastier1 merged commit 21f11df into main May 19, 2026
70 checks passed
@Kastier1 Kastier1 deleted the carlos/cli-list-projects-unknown branch May 19, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cloud https://cloud.reflex.dev/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants