Skip to content

refactor(cli)!: remove unused --preview helpers and stale preview wording - #13326

Merged
lakshmimsft merged 1 commit into
mainfrom
lakshmimsft/remove-preview-helpers
Oct 20, 2026
Merged

lakshmimsft merged 1 commit into
mainfrom
lakshmimsft/remove-preview-helpers

Conversation

@lakshmimsft

Copy link
Copy Markdown
Contributor

Summary

Removes the remaining --preview plumbing from the rad CLI, and the code paths that #13306, #13316, #13317 and #13319 made unreachable.

  • rad deploy: removes the --preview flag and RADIUS_PREVIEW support. The application type now always follows the environment type: a Radius.Core/environments environment gets a Radius.Core/applications application, and an Applications.Core/environments environment gets an Applications.Core/applications application.
  • Root command: removes wirePreviewSubcommand, resolveUsePreview and withPreviewEnvVarNote, plus their tests. No command uses them any more.
  • Diagnostics client:
    • Removes the legacy Applications.Core/containers path from ARMDiagnosticsClient: the Preview flag, the ApplicationClient, ContainerClient and EnvironmentClient fields, the legacy findNamespaceOfContainer, and getAppContainerName. Since feat(cli)!: make rad resource expose and logs target Radius.Compute/containers without --preview #13319, rad resource logs and rad resource expose accept only Radius.Compute/containers, so nothing reached this path.
    • Merges CreateDiagnosticsClientPreview into CreateDiagnosticsClient and removes it from the connections.Factory interface and MockFactory.
    • GetPublicEndpoint, used by rad app status and deploy progress, is unchanged.
  • Dead code: deletes cli.RequireEnvironmentName, prompt.ValidateApplicationName and its message constant. deadcode reported them as unreachable, and nothing calls them, including tests.
  • Renames:
    • cmd.PreviewResourceID, PreviewApplicationID, PreviewEnvironmentID and ListPreviewApplicationsInEnvironment become cmd.ResourceID, ApplicationID, EnvironmentID and ListApplicationsInEnvironment.
    • pkg/cli/cmd/previewdelete.go becomes cascadedelete.go.
    • The inline ID-string builders in rad app status, rad workspace create and rad resource list now call these helpers, and the private resourceID helper in rad resource list is removed.
  • Test script: removes export RADIUS_PREVIEW=true from .github/scripts/test-repo-radius-state-e2e.sh. The script creates its environment with rad env create, so its deploys still produce Radius.Core applications.
  • New test: Test_Deploy_RegisteredWithoutPreview checks that rad deploy has no --preview flag and still registers every flag its runner reads.

Breaking changes

  • rad deploy --preview fails with unknown flag: --preview.
  • RADIUS_PREVIEW is no longer read by any rad command.
  • rad deploy -a <app> into an Applications.Core/environments environment always creates an Applications.Core/applications application. Before, --preview or RADIUS_PREVIEW=true created a Radius.Core/applications application pointing at the legacy environment.

Cross-repo follow-ups:

Reason for change

Part of #11803. Earlier PRs in the series made Radius.Core the default for rad env, rad app, rad init, rad workspace create, rad resource list, rad resource expose and rad resource logs. This PR removes the last --preview flag (on rad deploy) and deletes the duplicate legacy code paths and preview-named helpers those PRs left behind.

How to test

Prerequisites:

  • A Kubernetes cluster with Radius installed as the current kubectl context.
  • Go and GNU Make.
  • A workspace with a Radius.Core environment named default, and an app.bicep that declares a Radius.Compute/containers resource named web in an application named demo.
  1. Build the CLI from this branch:

    make build-rad
    RAD=$PWD/dist/$(go env GOOS)_$(go env GOARCH)/release/rad
  2. Run the commands:

    Command Expected result
    $RAD deploy app.bicep -a demo -e default Creates Radius.Core/applications/demo and deploys it
    $RAD deploy app.bicep -a demo -e default --preview unknown flag: --preview
    RADIUS_PREVIEW=true $RAD deploy --help No --preview flag and no RADIUS_PREVIEW note
    $RAD app status demo Shows the application status
    $RAD resource logs Radius.Compute/containers web -a demo Logs from the web container
    $RAD resource expose Radius.Compute/containers web -a demo --port 5000 --remote-port 80 Port-forward starts
    $RAD app delete demo -y Deletes the application
  3. Run the unit tests and lint. They pass:

    go test ./cmd/rad/... ./pkg/cli/...
    golangci-lint run ./cmd/rad/... ./pkg/cli/...

File change summary

File Change
cmd/rad/cmd/root.go, root_test.go Remove the preview wiring helpers and their tests; add Test_Deploy_RegisteredWithoutPreview
cmd/rad/cmd/resourceExpose.go, resourceLogs.go Use CreateDiagnosticsClient
pkg/cli/cmd/deploy/deploy.go, deploy_test.go Remove --preview and RADIUS_PREVIEW; the application type follows the environment type
pkg/cli/deployment/diagnostics.go, diagnostics_test.go Remove the legacy container path; Radius.Compute/containers only
pkg/cli/connections/factory.go, mock_factory.go Merge the two diagnostics client constructors
pkg/cli/cmd/previewdelete.go → cascadedelete.go (and test) Rename the file and its helpers
pkg/cli/cmd/app/delete/delete.go, env/delete/delete.go, env/delete/cascade_test.go Use the renamed helpers and message constants
pkg/cli/cmd/app/status/status.go, workspace/create/create.go, resource/list/list.go, list_test.go Replace inline ID builders with the shared helpers
pkg/cli/clivalidation.go, pkg/cli/prompt/validator.go Delete the dead RequireEnvironmentName and ValidateApplicationName
pkg/cli/cmd/deleteorder_test.go, env/update/update_test.go Remove stale "preview" wording
.github/scripts/test-repo-radius-state-e2e.sh Drop RADIUS_PREVIEW=true

Signed-off-by: lakshmimsft <ljavadekar@microsoft.com>
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@radius-functional-tests

radius-functional-tests Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Radius functional test overview

🔍 Go to test action run

Click here to see the test run details
Name Value
Repository radius-project/radius
Commit ref 5ed2726
Unique ID func5734f7eb97
Image tag test-func5734f7eb97-39011682112-1
  • Dapr: 1.14.4
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:test-func5734f7eb97-39011682112-1
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:test-func5734f7eb97-39011682112-1
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:test-func5734f7eb97-39011682112-1
  • controller test image location: ghcr.io/radius-project/dev/controller:test-func5734f7eb97-39011682112-1
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:test-func5734f7eb97-39011682112-1
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting ucp-cloud functional tests...
⌛ Starting corerp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

@lakshmimsft lakshmimsft added the pr:standard Ongoing maintenance, minor improvements, documentation updates, and routine development work label Oct 17, 2026
@github-actions

Copy link
Copy Markdown

Unit Tests

    2 files  +    2    422 suites  +422   17m 55s ⏱️ + 17m 55s
7 179 tests +7 179  7 177 ✅ +7 177  2 💤 +2  0 ❌ ±0 
8 351 runs  +8 351  8 349 ✅ +8 349  2 💤 +2  0 ❌ ±0 

Results for commit 5ed2726. ± Comparison against base commit 97e14dc.

@codecov

codecov Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.91304% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.35%. Comparing base (97e14dc) to head (5ed2726).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
pkg/cli/connections/factory.go 0.00% 2 Missing ⚠️
cmd/rad/cmd/resourceExpose.go 0.00% 1 Missing ⚠️
cmd/rad/cmd/resourceLogs.go 0.00% 1 Missing ⚠️
pkg/cli/cmd/env/delete/delete.go 80.00% 1 Missing ⚠️
pkg/cli/deployment/diagnostics.go 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13326      +/-   ##
==========================================
+ Coverage   60.27%   60.35%   +0.07%     
==========================================
  Files         748      748              
  Lines       44255    44129     -126     
==========================================
- Hits        26676    26634      -42     
+ Misses      17579    17495      -84     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

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.

🟢 Approval recommended

The cleanup matches the documented behavior changes, and static review identified no blocking defects.

No open issues 🎉

What changed in this PR

Completes the CLI preview cleanup for #11803 after earlier commands moved to Radius.* defaults.

Changes:

  • Removes rad deploy --preview and RADIUS_PREVIEW; application types now follow environment types.
  • Consolidates diagnostics clients and removes unreachable legacy paths.
  • Renames shared helpers, removes unused validators, and updates tests and script configuration.
File Description
pkg/​cli/​prompt/​validator.go Removes unused application-name validation.
pkg/​cli/​deployment/​diagnostics.go Removes legacy container diagnostics.
pkg/​cli/​deployment/​diagnostics_test.go Updates diagnostics tests.
pkg/​cli/​connections/​mock_factory.go Removes duplicate diagnostics constructor.
pkg/​cli/​connections/​factory.go Consolidates diagnostics construction.
pkg/​cli/​cmd/​workspace/​create/​create.go Uses shared environment ID helper.
pkg/​cli/​cmd/​resource/​list/​list.go Uses shared resource ID helpers.
pkg/​cli/​cmd/​resource/​list/​list_test.go Renames an environment ID constant.
pkg/​cli/​cmd/​env/​update/​update_test.go Removes stale preview flag descriptions.
pkg/​cli/​cmd/​env/​delete/​delete.go Uses renamed helpers and message constants.
pkg/​cli/​cmd/​env/​delete/​cascade_test.go Updates message constant references.
pkg/​cli/​cmd/​deploy/​deploy.go Removes preview-based application selection.
pkg/​cli/​cmd/​deploy/​deploy_test.go Removes obsolete preview tests.
pkg/​cli/​cmd/​deleteorder_test.go Updates test case names.
pkg/​cli/​cmd/​cascadedelete.go Renames file and shared helpers.
pkg/​cli/​cmd/​cascadedelete_test.go Updates helper tests.
pkg/​cli/​cmd/​app/​status/​status.go Uses shared application ID helper.
pkg/​cli/​cmd/​app/​delete/​delete.go Uses renamed application ID helper.
pkg/​cli/​clivalidation.go Removes unused environment-name validation.
cmd/​rad/​cmd/​root.go Removes preview dispatch helpers.
cmd/​rad/​cmd/​root_test.go Adds deploy flag-registration coverage.
cmd/​rad/​cmd/​resourceLogs.go Uses consolidated diagnostics constructor.
cmd/​rad/​cmd/​resourceExpose.go Uses consolidated diagnostics constructor.
.github/​scripts/​test-repo-radius-state-e2e.sh Removes obsolete preview environment variable.

Review effort: Balanced

@lakshmimsft
lakshmimsft marked this pull request as ready for review October 19, 2026 22:17
@lakshmimsft
lakshmimsft requested review from a team as code owners October 19, 2026 22:17
@github-actions github-actions Bot added the pr:waiting-for-review A reviewer owns the next action; required approval is pending or unverifiable label Oct 19, 2026

@brooke-hamilton brooke-hamilton left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No actionable findings in the reviewed changes. Targeted unit tests could not run because this checkout requires Go 1.27.2, the installed toolchain is 1.27.0, and automatic toolchain verification failed offline. No live-cluster tests were run.

@github-actions github-actions Bot added pr:ready-for-queue Review, checks and mergeability permit adding this PR to the queue pr:review-approved Required reviews are approved; checks may still be pending and removed pr:waiting-for-review A reviewer owns the next action; required approval is pending or unverifiable pr:ready-for-queue Review, checks and mergeability permit adding this PR to the queue labels Oct 20, 2026
@lakshmimsft
lakshmimsft added this pull request to the merge queue Oct 20, 2026
@github-actions github-actions Bot removed the pr:ready-for-queue Review, checks and mergeability permit adding this PR to the queue label Oct 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 20, 2026
@lakshmimsft
lakshmimsft added this pull request to the merge queue Oct 20, 2026
Merged via the queue into main with commit 33753d9 Oct 20, 2026
109 of 110 checks passed
@lakshmimsft
lakshmimsft deleted the lakshmimsft/remove-preview-helpers branch October 20, 2026 17:48
@github-actions github-actions Bot removed the pr:review-approved Required reviews are approved; checks may still be pending label Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:standard Ongoing maintenance, minor improvements, documentation updates, and routine development work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants