Skip to content

Fix rad init to always create bicepconfig.json and remove prompt#11772

Open
Copilot wants to merge 17 commits intomainfrom
copilot/fix-rad-init-bicepconfig
Open

Fix rad init to always create bicepconfig.json and remove prompt#11772
Copilot wants to merge 17 commits intomainfrom
copilot/fix-rad-init-bicepconfig

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 28, 2026

Description

Why

The rad init command currently asks "Setup application in the current directory?" — a prompt that is vague and confusing. Answering "yes" creates both a bicepconfig.json (required for Bicep authoring with Radius) and a sample app.bicep. Answering "no" skips bicepconfig.json entirely, leaving users without the required Bicep configuration and causing downstream authoring failures. This friction has been a recurring source of confusion during onboarding.

What changed

  • Removed the "Setup application" promptrad init no longer asks users whether to scaffold an application.
  • bicepconfig.json is now always created — Since this file is required for Radius Bicep authoring, it is scaffolded unconditionally. If a bicepconfig.json already exists, it is preserved and a warning is emitted so users know to verify it contains the necessary Radius extensions.
  • app.bicep is no longer generated — The sample application file added unnecessary clutter and is no longer created.
  • Silenced Helm install logs during progress UI — Concurrent output.LogInfo writes from Helm were corrupting the Bubble Tea in-place progress rendering. A Logger field was added to ClusterOptions so callers can redirect or suppress log output.
  • Renamed internal identifierssummaryApplicationHeadingIconsummaryBicepConfigHeadingIcon, progressMsg.ApplicationCompleteBicepConfigComplete to reflect that the step now only creates bicepconfig.json.
  • Deleted application.go — Removed the enterApplicationOptions / enterApplicationName flow and applicationOptions struct, along with their tests.
  • Added new testsTest_Run_WarnsWhenBicepConfigAlreadyExists, Test_Run_InstallRadiusError, Test_ClusterOptions_logf_*, and additional ScaffoldBicepConfig error-path tests.

How this improves usability

Users running rad init will always end up with the correct Bicep configuration without needing to understand what the "setup application" prompt meant. This removes a common pitfall for new users and simplifies the init flow.

Type of change

  • This pull request adds or changes features of Radius and has an approved issue (issue link required).

Fixes: #11771

Contributor checklist

Please verify that the PR meets the following requirements, where applicable:

  • An overview of proposed schema changes is included in a linked GitHub issue.
    • Not applicable
  • A design document PR is created in the design-notes repository, if new APIs are being introduced.
    • Not applicable
  • The design document has been reviewed and approved by Radius maintainers/approvers.
    • Not applicable
  • A PR for the samples repository is created, if existing samples are affected by the changes in this PR.
    • Not applicable
  • A PR for the documentation repository is created, if the changes in this PR affect the documentation or any user facing updates are made.
    • Yes
    • Not applicable
  • A PR for the recipes repository is created, if existing recipes are affected by the changes in this PR.
    • Not applicable

Copilot AI and others added 2 commits April 28, 2026 15:23
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

Dependency Review

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

Scanned Files

None

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

Unit Tests

    2 files  ± 0    420 suites  ±0   7m 3s ⏱️ +24s
5 013 tests  - 10  5 011 ✅  - 10  2 💤 ±0  0 ❌ ±0 
6 025 runs   - 25  6 023 ✅  - 25  2 💤 ±0  0 ❌ ±0 

Results for commit 10f8e1d. ± Comparison against base commit 8ad0d19.

This pull request removes 19 and adds 9 tests. Note that renamed tests count towards both.
github.com/radius-project/radius/pkg/cli/cmd/radinit ‑ Test_Validate/Initialize_--full_with_existing_environment_create_application_-_initial_appname_is_invalid
github.com/radius-project/radius/pkg/cli/cmd/radinit ‑ Test_enterApplicationOptions
github.com/radius-project/radius/pkg/cli/cmd/radinit ‑ Test_enterApplicationOptions/create_application:_No
github.com/radius-project/radius/pkg/cli/cmd/radinit ‑ Test_enterApplicationOptions/create_application:_Yes
github.com/radius-project/radius/pkg/cli/cmd/radinit/common ‑ Test_EnterApplicationName
github.com/radius-project/radius/pkg/cli/cmd/radinit/common ‑ Test_EnterApplicationName/default_is_valid
github.com/radius-project/radius/pkg/cli/cmd/radinit/common ‑ Test_EnterApplicationName/user_is_prompted_when_application_name_contains_uppercase
github.com/radius-project/radius/pkg/cli/cmd/radinit/common ‑ Test_EnterApplicationName/user_is_prompted_when_application_name_does_not_end_with_alphanumeric
github.com/radius-project/radius/pkg/cli/cmd/radinit/common ‑ Test_EnterApplicationName/user_is_prompted_when_application_name_is_too_long
github.com/radius-project/radius/pkg/cli/cmd/radinit/common ‑ Test_EnterApplicationName/user_is_prompted_when_default_is_invalid
…
github.com/radius-project/radius/pkg/cli/cmd/radinit ‑ Test_Run_InstallRadiusError
github.com/radius-project/radius/pkg/cli/cmd/radinit ‑ Test_Run_WarnsWhenBicepConfigAlreadyExists
github.com/radius-project/radius/pkg/cli/helm ‑ Test_ClusterOptions_logf_FallsBackWhenLoggerNil
github.com/radius-project/radius/pkg/cli/helm ‑ Test_ClusterOptions_logf_UsesCustomLogger
github.com/radius-project/radius/pkg/cli/setup ‑ Test_ScaffoldBicepConfig_CreatesFile
github.com/radius-project/radius/pkg/cli/setup ‑ Test_ScaffoldBicepConfig_DoesNotCreateAppBicep
github.com/radius-project/radius/pkg/cli/setup ‑ Test_ScaffoldBicepConfig_KeepsExistingFile
github.com/radius-project/radius/pkg/cli/setup ‑ Test_ScaffoldBicepConfig_StatError
github.com/radius-project/radius/pkg/cli/setup ‑ Test_ScaffoldBicepConfig_WriteFileError

♻️ This comment has been updated with latest results.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

❌ Patch coverage is 52.00000% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.25%. Comparing base (8ad0d19) to head (10f8e1d).

Files with missing lines Patch % Lines
pkg/cli/cmd/radinit/common/display.go 0.00% 11 Missing ⚠️
pkg/cli/cmd/radinit/preview/init.go 36.36% 4 Missing and 3 partials ⚠️
pkg/cli/cmd/radinit/init.go 58.33% 2 Missing and 3 partials ⚠️
pkg/cli/helm/cluster.go 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11772      +/-   ##
==========================================
+ Coverage   51.19%   51.25%   +0.06%     
==========================================
  Files         715      712       -3     
  Lines       45081    45000      -81     
==========================================
- Hits        23079    23066      -13     
+ Misses      19803    19750      -53     
+ Partials     2199     2184      -15     

☔ View full report in Codecov by Sentry.
📢 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 and others added 2 commits April 28, 2026 16:57
@zachcasper zachcasper marked this pull request as ready for review April 28, 2026 17:40
Copilot AI review requested due to automatic review settings April 28, 2026 17:40
@zachcasper zachcasper requested review from a team as code owners April 28, 2026 17:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates rad init to always scaffold bicepconfig.json (without prompting) and to avoid corrupting the Bubble Tea progress UI by silencing Helm install info logs, with added unit tests for newly covered branches.

Changes:

  • Replace “scaffold application” prompt/flow with unconditional bicepconfig.json scaffolding and a post-run warning when the file already exists.
  • Add ClusterOptions.Logger hook to route/silence Helm informational messages during interactive UI runs.
  • Add/adjust unit tests to cover new branches and previously uncovered paths.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/cli/setup/application.go Replace ScaffoldApplication with ScaffoldBicepConfig returning (existed, err)
pkg/cli/setup/application_test.go Update/add tests for ScaffoldBicepConfig creation, preservation, and error branches
pkg/cli/helm/cluster.go Add ClusterOptions.Logger + logf; route select install messages through it
pkg/cli/helm/clusteroptions_test.go New tests covering ClusterOptions.logf (custom logger vs nil)
pkg/cli/cmd/radinit/options.go Remove application options from rad init option model
pkg/cli/cmd/radinit/options_test.go Remove application prompt expectations from option-entry tests
pkg/cli/cmd/radinit/init.go Always scaffold bicepconfig.json; silence Helm info logging during progress UI; warn if file existed
pkg/cli/cmd/radinit/init_test.go Add tests for “bicepconfig exists” warning and InstallRadius error propagation
pkg/cli/cmd/radinit/display.go Update summary/progress UI to show “Create bicepconfig.json” step
pkg/cli/cmd/radinit/display_test.go Update expected UI strings for the new bicepconfig step
pkg/cli/cmd/radinit/application.go Remove application prompt/name entry logic
pkg/cli/cmd/radinit/application_test.go Remove tests for deleted application prompt/name logic
Comments suppressed due to low confidence (1)

pkg/cli/cmd/radinit/init.go:263

  • On the InstallRadius error path, Run returns immediately while the progress UI goroutine(s) are still running. Because progressChan is never closed, the goroutine inside showProgress that ranges over progressChan can block forever, and the UI may keep running after Run returns. Ensure error paths (and ideally the success path) cancel/terminate the progress UI and close progressChan (or make showProgress exit on ctx.Done) to avoid goroutine leaks.
		err := r.HelmInterface.InstallRadius(ctx, clusterOptions, r.Options.Cluster.Context)
		if err != nil {
			return clierrors.MessageWithCause(err, "Failed to install Radius.")
		}

Comment thread pkg/cli/helm/cluster.go Outdated
Comment thread pkg/cli/cmd/radinit/display.go Outdated
Comment thread pkg/cli/setup/application.go Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Zach Casper <zachcasper@microsoft.com>
@zachcasper zachcasper changed the title [WIP] Fix rad init to always create bicepconfig.json and remove prompt Fix rad init to always create bicepconfig.json and remove prompt Apr 28, 2026
zachcasper added 9 commits May 7, 2026 10:40
Resolve conflicts after the rad init refactor on main that moved shared
prompt and display logic into pkg/cli/cmd/radinit/common.

- application.go/application_test.go: keep PR's deletion (rad init no
  longer prompts to scaffold an application).
- display.go: keep PR's BicepConfig rename. Switch to the thin wrapper
  introduced on main and pass the bicepconfig file through a new
  common.BicepConfigDisplay so the shared summary/progress views render
  the '🚧 Create bicepconfig.json' step.
- common/display.go: add BicepConfigDisplay, BicepConfigComplete, and
  the bicepconfig summary/progress rendering. Make isComplete only
  require ApplicationComplete when scaffolding and BicepConfigComplete
  when bicepconfig files are present, so both rad init and rad init
  --preview work.
- pkg/cli/setup/application.go: restore ScaffoldApplication so
  rad init --preview keeps building (it scaffolds app.bicep and reuses
  ScaffoldBicepConfig).
- init_test.go: drop the application prompt mock setup and the new
  'create application - initial appname is invalid' test case; switch
  to common.ResultConfirmed and common.ProgressModel.
Mirror the rad init change for the --preview command:

- Delete preview/application.go and preview/application_test.go.
- Drop applicationOptions, the Application field on initOptions, and the
  enterApplicationOptions call in preview/options.go.
- Replace the application scaffold step in preview/init.go with the same
  bicepconfig scaffold + warning flow used by rad init. The Application
  scaffold step is gone; a bicepconfig.json is always created and the
  user is warned if one already existed.
- Update preview/display.go to populate common.BicepConfigDisplay so the
  shared summary/progress views render the bicepconfig step.
- Strip setScaffoldApplicationPrompt* and setApplicationNamePrompt calls
  from preview/init_test.go, drop the 'create application - initial
  appname is invalid' test case and the helper functions, remove the
  Application field from the Test_Run options, and t.Chdir to a temp
  dir so bicepconfig scaffolding does not affect the source tree.
- Remove pkg/cli/setup.ScaffoldApplication; nothing references it now.
Neither rad init nor rad init --preview scaffold an application any
more, so the helpers and display fields that supported that flow are
unused.

- Delete pkg/cli/cmd/radinit/common/application.go and its test file
  (EnterApplicationOptions and the Confirm/Enter prompt constants).
- Drop ApplicationDisplay, DisplayOptions.Application, and
  ProgressMsg.ApplicationComplete from common/display.go, along with
  the SummaryApplication* constants and the application branches in
  the summary/progress views and isComplete.
- Update the rad init Run doc comment to say it scaffolds a
  bicepconfig.json (not an application).
@radius-functional-tests
Copy link
Copy Markdown

radius-functional-tests Bot commented May 8, 2026

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 10f8e1d
Unique ID func7404b46793
Image tag pr-func7404b46793
  • gotestsum 1.13.0
  • KinD: v0.29.0
  • 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>:pr-func7404b46793
  • 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:pr-func7404b46793
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func7404b46793
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func7404b46793
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func7404b46793
  • 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rad init should always create bicepconfig.json, remove confusing prompt, and not generate app.bicep

3 participants