Skip to content

Fix application graph layout and edges for Radius.Compute types - #404

Merged
nicolejms merged 4 commits into
mainfrom
nicolejms-radius-resource-migration
Oct 27, 2026
Merged

nicolejms merged 4 commits into
mainfrom
nicolejms-radius-resource-migration

Conversation

@nicolejms

@nicolejms nicolejms commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Match explicit lists of built-in resource types in AppGraph:

  • Containers: Applications.Core/containers and Radius.Compute/containers.
  • Gateways: Applications.Core/gateways and Radius.Compute/routes. Radius.Compute/routes replaces gateways for ingress.

Type matching ignores letter case. User-defined types with the same names (for example Contoso.Net/gateways) get no special handling. This PR keeps support for the legacy types. It does not remove legacy resources or migrate the saved graph records.

Reason for change

AppGraph compared resource types with the literal strings Applications.Core/containers and Applications.Core/gateways. Resources of the new built-in types thus used the wrong initial layout row, and route edges did not get the direction correction.

Issue #373 names Radius.Core/containers and Radius.Core/gateways. The Radius manifest deploy/manifest/built-in-providers/self-hosted/radius_core.yaml defines no such types. Radius.Core defines only environments, applications, recipePacks, terraformSettings, and bicepSettings. The real new types are Radius.Compute/containers (containers.yaml) and Radius.Compute/routes (routes.yaml). The graph API reports a route-to-container link as an Outbound dependency edge on the route and an Inbound copy on the container (pkg/graph/edges/edges.go). This is the same shape as legacy gateway edges, so the same direction correction applies.

Fixes #373

How to test

Use Node.js 24 and the Yarn version set in package.json. Run corepack yarn install --immutable. If the browser is not installed, run corepack yarn playwright install chromium. For browser commands below, set PLAYWRIGHT_BROWSER_CHANNEL=chromium (PowerShell: $env:PLAYWRIGHT_BROWSER_CHANNEL='chromium'). The app and Storybook test commands start and stop their own servers; no Radius cluster is needed.

  1. Run corepack yarn test --watchAll=false --runInBand --coverage=false packages/rad-components/src. Both type sets must place containers without inbound connections in the leading row. Gateway and route edges must point to the container before and after layout. User-defined */gateways, */routes, and */containers types (for example Contoso.Net/gateways and Radius.Networking/gateways) must not get the special handling.
  2. Run corepack yarn test:e2e packages/app/e2e-tests/radiusGraph.test.ts --workers=1. Open each application from the list. The Radius.Core application's graph mock returns Radius.Compute/containers, Radius.Compute/routes, and Radius.Data/redisCaches resources. Both graphs must show the gateway or route edge to frontend, not the reverse edge.
  3. Run corepack yarn test:e2e:components --workers=1. The real renderer must retain its nodes, edges, controls, and layout behavior.

Validation results (commit 2):

Command Result
corepack yarn test ... AppGraph.test.tsx graphInvariants.test.ts before the fix Failed as expected: 7 new tests failed (route direction, route topology, user-defined types, letter case); 114 passed. Tests were changed before the code.
corepack yarn test --watchAll=false --runInBand --coverage=false packages/rad-components/src after the fix Passed: 161 tests in 5 suites, including graphRecords.test.ts (saved records unchanged).
corepack yarn test:e2e packages/app/e2e-tests/radiusGraph.test.ts --workers=1 after the fix Passed: 5 tests with Chromium.
Same E2E-03 test with the previous endsWith code Failed as expected on the Radius.Compute graph.
corepack yarn test:e2e:components --workers=1 Passed: 8 tests in 3 runs in a row. The first run had 1 timing failure in GU-11 (scheduled-work check), which this PR does not touch.
corepack yarn tsc Passed.
corepack yarn lint:all Passed.
corepack yarn prettier --write on the changed files No changes after formatting.
shellcheck .devcontainer/postcreate.sh Passed. No shell files changed.
git diff --check Passed.

File change summary

File Summary of change
packages/rad-components/src/components/appgraph/AppGraph.tsx Match explicit lists of built-in container and gateway or route types, without regard to letter case.
packages/rad-components/src/components/appgraph/__test__/AppGraph.test.tsx Add unit cases for both type sets, negative cases for user-defined types such as Contoso.Net and Radius.Networking, and a letter-case case.
packages/rad-components/src/__test__/graphInvariants.test.ts Check gateway and route topology through the real model builder and layout.
packages/app/e2e-tests/radiusGraph.test.ts Return Radius.Compute and Radius.Data types for the Radius.Core application, and check the exact visible edge direction.
docs/design/2026-09-dashboard-plugin-test-plan.md Record the #373 fix, the real type names, and the coverage; remove #373 from the known-defects table; keep corpus migration separate.

Match container and gateway type suffixes across namespaces. Add tests-first unit, model integration, and browser coverage for #373.

Signed-off-by: nicolejms <nicolej@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: nicolejms <nicolej@microsoft.com>
@nicolejms
nicolejms requested review from a team as code owners October 23, 2026 20:21
@github-actions

Copy link
Copy Markdown

Dependency Review

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

Scanned Files

None

@nicolejms nicolejms added the pr:standard Standard pull request label Oct 23, 2026
@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 23, 2026
@nicolejms

Copy link
Copy Markdown
Contributor Author

Playwright screenshots for #373. All 13 tests passed: 5 app graph tests and 8 component tests. These images use mocked API data, not a live Radius deployment. The images show the Radius.Core application graph, a close-up of the Radius.Core/containers label, and the legacy graph for comparison.

Radius.Core application graph

Radius.Core container type close-up

Legacy application graph for comparison

Replace the /containers and /gateways suffix checks with explicit lists of
built-in types. Containers are Applications.Core/containers and
Radius.Compute/containers. Gateways are Applications.Core/gateways and
Radius.Compute/routes, which replaces gateways for ingress. Radius.Core
defines no containers or gateways types. User-defined types with the same
names no longer get the layout or edge-direction handling. Type matching
ignores letter case.

Update unit, graph-model, and E2E tests to use the real Radius.Compute and
Radius.Data types, and add negative tests for user-defined types.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: nicolejms <nicolej@microsoft.com>
@nicolejms nicolejms changed the title Fix namespace-aware application graph layout and gateway edges Fix application graph layout and edges for Radius.Compute types Oct 23, 2026
@nicolejms

Copy link
Copy Markdown
Contributor Author

Updated screenshots: real Radius.Compute types

These screenshots replace the earlier ones, which showed Radius.Core/containers. Radius does not define that type. The Radius.Core application's graph now uses Radius.Compute/containers, Radius.Compute/routes, and Radius.Data/redisCaches. Playwright E2E-03 captured them with mocked API data, not a live cluster.

Radius.Core application graph

The route edge points to frontend, the same direction as the legacy gateway.

Radius.Core application graph

Route and container close-ups

Radius.Compute/routes node Radius.Compute/containers node

Legacy Applications.Core graph (no change)

Legacy Applications.Core application graph

@nithyatsu nithyatsu 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.

Fix looks correct and the coverage across both type sets is good. One doc fix needed before merge, plus a nit.

@github-actions github-actions Bot added pr:waiting-for-author The author needs to address human review feedback or human-endorsed inline feedback and removed pr:waiting-for-review A reviewer owns the next action; required approval is pending or unverifiable labels Oct 27, 2026
@github-actions github-actions Bot added pr:waiting-for-review A reviewer owns the next action; required approval is pending or unverifiable and removed pr:waiting-for-author The author needs to address human review feedback or human-endorsed inline feedback labels Oct 27, 2026
Replace Radius.Core/gateways and Radius.Core/containers in the negative
AppGraph tests with Radius.Networking types. Radius.Core does not define
those types. Remove the #373 row from the known-defects table because the
issue is fixed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: nicolejms <nicolej@microsoft.com>
@nicolejms
nicolejms enabled auto-merge (squash) October 27, 2026 17:31
@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 labels Oct 27, 2026
@nicolejms
nicolejms merged commit ec9eef5 into main Oct 27, 2026
11 checks passed
@nicolejms
nicolejms deleted the nicolejms-radius-resource-migration branch October 27, 2026 17:47
@github-actions github-actions Bot removed pr:review-approved Required reviews are approved; checks may still be pending pr:ready-for-queue Review, checks and mergeability permit adding this PR to the queue labels Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:standard Standard pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AppGraph hard-codes Applications.Core/* type literals, so Radius.Core resources take different layout paths

2 participants