Skip to content

support rad app graph app.bicep (modeled graphs)#12057

Merged
nithyatsu merged 8 commits into
radius-project:mainfrom
nithyatsu:modeled_graph2
Jun 9, 2026
Merged

support rad app graph app.bicep (modeled graphs)#12057
nithyatsu merged 8 commits into
radius-project:mainfrom
nithyatsu:modeled_graph2

Conversation

@nithyatsu

@nithyatsu nithyatsu commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Description

This pull request introduces a new "modeled graph" feature to the rad app graph command, allowing users to generate and persist application graphs from Bicep files without contacting the Radius control plane. The command now detects when it is running in a GitHub Actions environment and, in that case, commits the modeled graph to a special orphan branch in the repository instead of writing it locally. The implementation includes extensive new logic, environment variable handling, and tests for these scenarios. Additionally, there are minor updates to provisioning state constants and framework interfaces.

Modeled Graph Feature for rad app graph:

  • Added support for generating application graphs directly from Bicep files: if the positional argument is a .bicep file, the command compiles it and produces app-graph.json locally or commits it to the radius-graph orphan branch if running in GitHub Actions.

  • The command now distinguishes between "deployed graph" (fetching from control plane) and "modeled graph" (building from Bicep), with clear validation and execution paths for each.

  • When in GitHub Actions, the modeled graph is stored in a branch named radius-graph under a directory for the source branch, using github supplied environment variables GITHUB_HEAD_REF and GITHUB_REF_NAME to determine the branch.

Testing Improvements:

  • Comprehensive new tests for the modeled graph feature, covering local file output, orphan branch persistence, environment variable fallbacks, error handling, and mocking of Bicep compilation and persistence. [1] [2]

Other Minor Changes:

Type of change

  • This pull request fixes a bug in Radius and has an approved issue (issue link required).
  • This pull request adds or changes features of Radius and has an approved issue (issue link required).
  • This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional).
  • This pull request is a design document and only includes files in the eng/design-notes directory.

Fixes: #12009

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

@nithyatsu nithyatsu marked this pull request as ready for review June 4, 2026 23:06
@nithyatsu nithyatsu requested review from a team as code owners June 4, 2026 23:06
Copilot AI review requested due to automatic review settings June 4, 2026 23:06
@nithyatsu nithyatsu changed the title Modeled graph2 support rad app graph app.bicep Jun 4, 2026

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.

Pull request overview

This PR extends the Radius application graph surface to support modeled graphs produced from a local app.bicep (no control plane call), adds a stable per-resource diff hash to enable graph comparisons, and introduces a git-backed persistence abstraction for committing modeled graph artifacts to a dedicated orphan branch.

Changes:

  • Add diffHash (and, for Radius.Core, optional source references) to ApplicationGraphResource in TypeSpec + OpenAPI + generated Go models.
  • Introduce pkg/cli/graph helpers to build modeled graphs from ARM JSON templates and compute stable diffHash values.
  • Extend rad app graph to accept an app.bicep path (modeled graph mode) and optionally persist the graph via a persistence.Store (git-backed store wiring added to the CLI framework).

Reviewed changes

Copilot reviewed 14 out of 20 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
typespec/Radius.Core/applications.tsp Adds diffHash, appDefinitionLine, and codeReference to the Radius.Core graph resource model.
typespec/Applications.Core/applications.tsp Adds diffHash to the Applications.Core graph resource model.
swagger/specification/radius/resource-manager/Radius.Core/preview/2025-08-01-preview/openapi.json Updates OpenAPI schema for the new Radius.Core graph fields.
swagger/specification/applications/resource-manager/Applications.Core/preview/2023-10-01-preview/openapi.json Updates OpenAPI schema to include diffHash.
pkg/graph/persistence/store.go Adds a go:generate mock target for the Store interface.
pkg/graph/persistence/mock_store.go Adds generated gomock for persistence.Store.
pkg/corerp/api/v20250801preview/zz_generated_models.go Regenerates models to include the new Radius.Core graph fields.
pkg/corerp/api/v20250801preview/zz_generated_models_serde.go Updates JSON (un)marshalling to include the new fields.
pkg/corerp/api/v20231001preview/zz_generated_models.go Regenerates models to include diffHash.
pkg/corerp/api/v20231001preview/zz_generated_models_serde.go Updates JSON (un)marshalling to include diffHash.
pkg/cli/graph/modeled.go Implements modeled-graph construction from ARM templates (including symbolic-name layout normalization).
pkg/cli/graph/modeled_test.go Adds unit tests for modeled graph building and connection handling.
pkg/cli/graph/diffhash.go Implements stable sha256: hashing over authorable properties + sorted dependsOn.
pkg/cli/graph/diffhash_test.go Adds unit tests for hash stability and filtering.
pkg/cli/framework/framework.go Extends CLI factory interface/impl to provide a graph persistence store.
pkg/cli/framework/mock_factory.go Updates the framework mock factory for the new GetGraphStore() method.
pkg/cli/cmd/app/graph/graph.go Adds modeled-graph mode (rad app graph ./app.bicep) and repo-radius persistence behavior.
pkg/cli/cmd/app/graph/graph_test.go Adds tests for modeled-graph mode, local output, and persistence behavior.
pkg/armrpc/api/v1/types.go Renames provisioning state constant value from Undefined to NotSpecified.
cmd/rad/cmd/root.go Wires a git-backed graph store into the CLI framework on startup.
Files not reviewed (6)
  • pkg/cli/framework/mock_factory.go: Language not supported
  • pkg/corerp/api/v20231001preview/zz_generated_models.go: Language not supported
  • pkg/corerp/api/v20231001preview/zz_generated_models_serde.go: Language not supported
  • pkg/corerp/api/v20250801preview/zz_generated_models.go: Language not supported
  • pkg/corerp/api/v20250801preview/zz_generated_models_serde.go: Language not supported
  • pkg/graph/persistence/mock_store.go: Language not supported

Comment thread typespec/Applications.Core/applications.tsp Outdated
Comment thread cmd/rad/cmd/root.go
Comment thread typespec/Radius.Core/applications.tsp Outdated
Comment thread pkg/cli/cmd/app/graph/graph.go Outdated
Comment thread pkg/cli/graph/diffhash.go
Comment thread pkg/cli/graph/modeled.go
@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.41830% with 115 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.20%. Comparing base (8771b5b) to head (1e929b6).

Files with missing lines Patch % Lines
pkg/cli/graph/modeled.go 54.50% 86 Missing and 10 partials ⚠️
pkg/cli/cmd/app/graph/graph.go 82.89% 7 Missing and 6 partials ⚠️
cmd/rad/cmd/root.go 50.00% 1 Missing and 1 partial ⚠️
pkg/cli/framework/framework.go 0.00% 2 Missing ⚠️
pkg/cli/graph/diffhash.go 84.61% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12057      +/-   ##
==========================================
+ Coverage   52.14%   52.20%   +0.06%     
==========================================
  Files         734      736       +2     
  Lines       46704    47002     +298     
==========================================
+ Hits        24354    24539     +185     
- Misses      20015    20111      +96     
- Partials     2335     2352      +17     

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

@nithyatsu nithyatsu changed the title support rad app graph app.bicep support rad app graph app.bicep [modeled graphs] Jun 4, 2026
@nithyatsu nithyatsu changed the title support rad app graph app.bicep [modeled graphs] support rad app graph app.bicep (modeled graphs) Jun 4, 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.

🚀

Comment thread pkg/cli/cmd/app/graph/graph.go Outdated
@nithyatsu nithyatsu enabled auto-merge (squash) June 8, 2026 20:51
Comment thread pkg/armrpc/api/v1/types.go
brooke-hamilton
brooke-hamilton previously approved these changes Jun 8, 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.

🚀 🚢

@radius-functional-tests

radius-functional-tests Bot commented Jun 9, 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 nithyatsu/radius
Commit ref 1e929b6
Unique ID func621c9a6dd9
Image tag pr-func621c9a6dd9
  • 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-func621c9a6dd9
  • 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-func621c9a6dd9
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func621c9a6dd9
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func621c9a6dd9
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func621c9a6dd9
  • 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
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
✅ Recipe publishing succeeded
⌛ Starting ucp-cloud functional tests...
⌛ Starting corerp-cloud functional tests...
⌛ Starting corerp-cloud functional tests...
❌ Test tool installation for corerp-cloud failed. Please check the logs for more details
❌ Failed to install Radius for corerp-cloud functional test. Please check the logs for more details
❌ corerp-cloud functional test failed. Please check the logs for more details
✅ ucp-cloud functional tests succeeded
✅ ucp-cloud functional tests succeeded
⌛ Starting corerp-cloud functional tests...
✅ corerp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

@nithyatsu nithyatsu merged commit 77c444a into radius-project:main Jun 9, 2026
108 of 126 checks passed
Reshrahim pushed a commit to Reshrahim/radius that referenced this pull request Jun 15, 2026
# Description

This pull request introduces a new "modeled graph" feature to the `rad
app graph` command, allowing users to generate and persist application
graphs from Bicep files without contacting the Radius control plane. The
command now detects when it is running in a GitHub Actions environment
and, in that case, commits the modeled graph to a special orphan branch
in the repository instead of writing it locally. The implementation
includes extensive new logic, environment variable handling, and tests
for these scenarios. Additionally, there are minor updates to
provisioning state constants and framework interfaces.

**Modeled Graph Feature for `rad app graph`:**

* Added support for generating application graphs directly from Bicep
files: if the positional argument is a `.bicep` file, the command
compiles it and produces `app-graph.json` locally or commits it to the
`radius-graph` orphan branch if running in GitHub Actions.

* The command now distinguishes between "deployed graph" (fetching from
control plane) and "modeled graph" (building from Bicep), with clear
validation and execution paths for each.

* When in GitHub Actions, the modeled graph is stored in a branch named
`radius-graph` under a directory for the source branch, using github
supplied environment variables `GITHUB_HEAD_REF` and `GITHUB_REF_NAME`
to determine the branch.

**Testing Improvements:**

* Comprehensive new tests for the modeled graph feature, covering local
file output, orphan branch persistence, environment variable fallbacks,
error handling, and mocking of Bicep compilation and persistence.
[[1]](diffhunk://#diff-da99a20c2559c82eb4031f76e38b2e779804b73f46c7020dda30910b0e744192R10-R25)
[[2]](diffhunk://#diff-da99a20c2559c82eb4031f76e38b2e779804b73f46c7020dda30910b0e744192R280-R544)

**Other Minor Changes:**

* Updated ARM provisioning state constant from `Undefined` to
`NotSpecified` for clarity and alignment with expected values.
(https://learn.microsoft.com/en-us/javascript/api/%40azure/arm-managedapplications/provisioningstate?view=azure-node-latest)

## Type of change

<!--
Please select **one** of the following options that describes your
change and delete the others. Clearly identifying the type of change you
are making will help us review your PR faster, and is used in authoring
release notes.
If you are making a bug fix or functionality change to Radius and do not
have an associated issue link, please create one now.
-->
- This pull request fixes a bug in Radius and has an approved issue
(issue link required).
- This pull request adds or changes features of Radius and has an
approved issue (issue link required).
- This pull request is a minor refactor, code cleanup, test improvement,
or other maintenance task and doesn't change the functionality of Radius
(issue link optional).
- This pull request is a design document and only includes files in the
eng/design-notes directory.

<!-- Please update the following to link the associated issue. This is
required for some kinds of changes (see above). -->
Fixes: radius-project#12009

## 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](https://github.com/radius-project/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](https://github.com/radius-project/dashboard/) is
created, if the Radius Dashboard is affected by the changes in this PR.
    - [ ] Yes
    - [ ] Not applicable
- A PR for the [documentation
repository](https://github.com/radius-project/docs) is created, if the
changes in this PR affect the documentation or any user facing updates
are made.
    - [ ] Yes
    - [ ] Not applicable

Signed-off-by: Reshma Abdul Rahim <reshmarahim.abdul@microsoft.com>
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.

add cli for static graph

3 participants