Skip to content

Add --preview flag for 'rad app graph' and 'rad app status' #11983

Merged
lakshmimsft merged 1 commit into
mainfrom
feature/app-preview-graph-status
May 27, 2026
Merged

Add --preview flag for 'rad app graph' and 'rad app status' #11983
lakshmimsft merged 1 commit into
mainfrom
feature/app-preview-graph-status

Conversation

@lakshmimsft
Copy link
Copy Markdown
Contributor

This pr adds --preview flag support to rad app graph and rad app status commands. When --preview is passed, these commands operate againstRadius.Core/applications resources via the v20250801preview API surface, instead of the default Applications.Core/applications.
This completes the rad app preview command set, following the prior PR that added rad app show/list/delete --preview.

Notes:

  • rad app graph --preview — Calls the v20250801preview GetGraph custom action directly. Renders the application graph in table (text) or JSON format. Returns a friendly 404 error if the application does not exist. Includes a v20250801preview-specific display() function for graph rendering.
  • rad app status --preview — Fetches the Radius.Core/applications resource via the new client, enumerates owned child resources usingownership-based filtering (properties.application), and gathers public endpoints via the diagnostics client. Outputs status table andgateway table.
  • Exported helpers — StatusFormat(), GatewayFormat(), ProviderFromID(), and MakeResourceHyperlink() are now exported from existingpackages so preview subpackages can reuse them without duplication.
  • Test client factory — NewRadiusCoreTestClientFactory gains a variadic applicationsServer parameter (backwards compatible).WithApplicationsServerNoError() now includes GetGraph support.
  • wirePreviewSubcommand tests — Added unit tests verifying the --preview routing dispatches correctly.

Type of change

Fixes: #11675

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.
    • Yes
    • Not applicable
  • A design document is added or updated under eng/design-notes/ in this repository, if new APIs are being introduced.
    • Yes
    • Not applicable
  • The design document has been reviewed and approved by Radius maintainers/approvers.
    • Yes
    • Not applicable
  • A PR for resource-types-contrib is created, if resource types or recipes are affected by the changes in this PR.
    • Yes
    • Not applicable
  • A PR for dashboard is created, if the Radius Dashboard is affected by the changes in this PR.
    • Yes
    • 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

@lakshmimsft lakshmimsft requested a review from a team as a code owner May 21, 2026 23:08
Copilot AI review requested due to automatic review settings May 21, 2026 23:08
@lakshmimsft lakshmimsft requested a review from a team as a code owner May 21, 2026 23:08
@lakshmimsft lakshmimsft requested a review from sk593 May 21, 2026 23:08
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 21, 2026

Dependency Review

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

Scanned Files

None

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

Adds --preview support for rad app graph and rad app status so these commands can operate against Radius.Core/applications@2025-08-01-preview (v20250801preview) resources, completing the rad app preview command set.

Changes:

  • Add preview implementations for rad app graph and rad app status and wire them via --preview routing in the CLI root.
  • Export shared formatting and hyperlink/provider helpers so preview subpackages can reuse existing logic.
  • Extend the Radius.Core CLI test client factory and add unit tests for preview command behavior and --preview routing.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/cli/test_client_factory/radius_core.go Adds fake GetGraph behavior for preview Applications server to support new preview command tests.
pkg/cli/cmd/app/status/status.go Switches to exported formatter helpers (StatusFormat, GatewayFormat).
pkg/cli/cmd/app/status/status_test.go Updates tests to use exported formatter helpers.
pkg/cli/cmd/app/status/preview/status.go New preview rad app status implementation using Radius.Core v20250801preview APIs and ownership filtering.
pkg/cli/cmd/app/status/preview/status_test.go New unit tests covering preview status output, errors, and JSON/table behavior.
pkg/cli/cmd/app/status/objectformats.go Exports formatter helpers for reuse by preview package.
pkg/cli/cmd/app/status/objectformats_test.go Updates formatter tests to use exported helpers.
pkg/cli/cmd/app/graph/preview/graph.go New preview rad app graph implementation calling v20250801preview GetGraph and rendering table/JSON.
pkg/cli/cmd/app/graph/preview/graph_test.go New unit tests for preview graph behavior, including 404 handling and JSON output.
pkg/cli/cmd/app/graph/display.go Exports MakeResourceHyperlink and refactors hyperlink creation to use it.
pkg/cli/cmd/app/graph/compute.go Exports ProviderFromID for reuse by preview graph rendering.
pkg/cli/cmd/app/graph/compute_test.go Updates tests for exported ProviderFromID.
cmd/rad/cmd/root.go Wires preview subcommands for app status and app graph behind --preview.
cmd/rad/cmd/root_test.go Adds unit tests validating wirePreviewSubcommand routing behavior.

Comment thread pkg/cli/cmd/app/status/preview/status.go Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 21, 2026

Unit Tests

    2 files  ± 0    435 suites  +4   7m 28s ⏱️ +3s
5 247 tests +27  5 245 ✅ +27  2 💤 ±0  0 ❌ ±0 
6 369 runs  +51  6 367 ✅ +51  2 💤 ±0  0 ❌ ±0 

Results for commit 262cedc. ± Comparison against base commit 7c8dc6d.

This pull request removes 3 and adds 30 tests. Note that renamed tests count towards both.
github.com/radius-project/radius/pkg/cli/cmd/app/graph ‑ Test_providerFromID
github.com/radius-project/radius/pkg/cli/cmd/app/graph ‑ Test_providerFromID/parse_invalid_resource_ID
github.com/radius-project/radius/pkg/cli/cmd/app/graph ‑ Test_providerFromID/parse_valid_resource_ID
github.com/radius-project/radius/cmd/rad/cmd ‑ Test_wirePreviewSubcommand
github.com/radius-project/radius/cmd/rad/cmd ‑ Test_wirePreviewSubcommand/routes_to_legacy_runner_when_--preview_is_not_set
github.com/radius-project/radius/cmd/rad/cmd ‑ Test_wirePreviewSubcommand/routes_to_preview_runner_when_--preview_is_set
github.com/radius-project/radius/pkg/cli/cmd/app/graph ‑ Test_ProviderFromID
github.com/radius-project/radius/pkg/cli/cmd/app/graph ‑ Test_ProviderFromID/parse_invalid_resource_ID
github.com/radius-project/radius/pkg/cli/cmd/app/graph ‑ Test_ProviderFromID/parse_valid_resource_ID
github.com/radius-project/radius/pkg/cli/cmd/app/graph/preview ‑ Test_CommandValidation
github.com/radius-project/radius/pkg/cli/cmd/app/graph/preview ‑ Test_Run
github.com/radius-project/radius/pkg/cli/cmd/app/graph/preview ‑ Test_Run/Error:_GetGraph_failure_is_propagated
github.com/radius-project/radius/pkg/cli/cmd/app/graph/preview ‑ Test_Run/Error:_application_not_found_(404)
…

♻️ This comment has been updated with latest results.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 62.26415% with 80 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.89%. Comparing base (7c8dc6d) to head (262cedc).

Files with missing lines Patch % Lines
pkg/cli/cmd/app/graph/preview/graph.go 55.88% 37 Missing and 8 partials ⚠️
pkg/cli/cmd/app/status/preview/status.go 68.96% 15 Missing and 12 partials ⚠️
pkg/cli/test_client_factory/radius_core.go 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11983      +/-   ##
==========================================
+ Coverage   51.85%   51.89%   +0.04%     
==========================================
  Files         730      732       +2     
  Lines       46069    46272     +203     
==========================================
+ Hits        23889    24014     +125     
- Misses      19904    19958      +54     
- Partials     2276     2300      +24     

☔ 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.

@lakshmimsft lakshmimsft force-pushed the feature/app-preview-graph-status branch from 38acd8a to 7c5c820 Compare May 21, 2026 23:34
@lakshmimsft lakshmimsft linked an issue May 26, 2026 that may be closed by this pull request
@lakshmimsft lakshmimsft force-pushed the feature/app-preview-graph-status branch from 7c5c820 to 8e91fcf Compare May 26, 2026 17:25
Signed-off-by: lakshmimsft <ljavadekar@microsoft.com>
@lakshmimsft lakshmimsft force-pushed the feature/app-preview-graph-status branch from 8e91fcf to 262cedc Compare May 27, 2026 23:08
@radius-functional-tests
Copy link
Copy Markdown

radius-functional-tests Bot commented May 27, 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 262cedc
Unique ID func455f490d3b
Image tag pr-func455f490d3b
  • 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-func455f490d3b
  • 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-func455f490d3b
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func455f490d3b
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func455f490d3b
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func455f490d3b
  • 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 corerp-cloud functional tests...
⌛ Starting ucp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

@lakshmimsft lakshmimsft merged commit 947d655 into main May 27, 2026
66 of 73 checks passed
@lakshmimsft lakshmimsft deleted the feature/app-preview-graph-status branch May 27, 2026 23:53
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.

update rad app * commands with --preview flag rad app commands don't work for applications created by Radius.Core/applications type

3 participants