Add Radius TypeScript AppHost support#18759
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2bda71df-3380-48d1-b09b-5b1fe006f77b
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 18759Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 18759" |
Tests selector (audit mode)The full test matrix and all jobs still run in audit mode. The tests and jobs below are what selective CI would run under enforcement. 2 / 100 test projects · 4 jobs, from 25 changed files. Selected test projects (2 / 100)
Selected jobs (4)
How these were chosen — grouped by what changed🔧 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🧪 🧪 Job reasons
Selection computed for commit |
There was a problem hiding this comment.
Pull request overview
Adds TypeScript AppHost support for Radius provider configuration and generated Bicep customization.
Changes:
- Exports Radius callbacks, provider builders, and construct handles through ATS.
- Adds primitive adapters for modifying Radius infrastructure.
- Adds TypeScript validation and CLI publish coverage.
Show a summary per file
| File | Description |
|---|---|
tests/PolyglotAppHosts/Aspire.Hosting.Radius/TypeScript/tsconfig.json |
Configures TypeScript validation. |
tests/PolyglotAppHosts/Aspire.Hosting.Radius/TypeScript/package.json |
Defines validation dependencies. |
tests/PolyglotAppHosts/Aspire.Hosting.Radius/TypeScript/package-lock.json |
Locks validation dependencies. |
tests/PolyglotAppHosts/Aspire.Hosting.Radius/TypeScript/aspire.config.json |
References the Radius integration. |
tests/PolyglotAppHosts/Aspire.Hosting.Radius/TypeScript/apphost.mts |
Exercises the projected Radius API. |
tests/Aspire.Hosting.Radius.Tests/Publishing/ConfigureRadiusInfrastructureTests.cs |
Tests infrastructure adapters. |
tests/Aspire.Cli.EndToEnd.Tests/RadiusPublishTests.cs |
Publishes a customized TypeScript AppHost. |
src/Aspire.Hosting.Radius/RadiusExtensions.cs |
Exports infrastructure configuration. |
src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructurePolyglotExtensions.cs |
Implements ATS customization adapters. |
src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureOptions.cs |
Exposes infrastructure collections. |
src/Aspire.Hosting.Radius/Publishing/Constructs/RecipeEntryConstruct.cs |
Exports recipe handles. |
src/Aspire.Hosting.Radius/Publishing/Constructs/RadiusResourceTypeConstruct.cs |
Exports resource-type handles. |
src/Aspire.Hosting.Radius/Publishing/Constructs/RadiusRecipePackConstruct.cs |
Exports recipe-pack handles. |
src/Aspire.Hosting.Radius/Publishing/Constructs/RadiusEnvironmentConstruct.cs |
Exports environment handles. |
src/Aspire.Hosting.Radius/Publishing/Constructs/RadiusContainerConstruct.cs |
Exports container handles. |
src/Aspire.Hosting.Radius/Publishing/Constructs/RadiusApplicationConstruct.cs |
Exports application handles. |
src/Aspire.Hosting.Radius/Publishing/Constructs/LegacyRecipeEntryConstruct.cs |
Exports legacy recipe handles. |
src/Aspire.Hosting.Radius/Publishing/Constructs/LegacyApplicationEnvironmentConstruct.cs |
Exports legacy environment handles. |
src/Aspire.Hosting.Radius/Publishing/Constructs/LegacyApplicationConstruct.cs |
Exports legacy application handles. |
src/Aspire.Hosting.Radius/Publishing/Constructs/ContainerPortConstruct.cs |
Exports container-port handles. |
src/Aspire.Hosting.Radius/Publishing/Constructs/ContainerEnvVarConstruct.cs |
Exports environment-variable handles. |
src/Aspire.Hosting.Radius/Publishing/Constructs/ConnectionConstruct.cs |
Exports connection handles. |
src/Aspire.Hosting.Radius/CloudProviders/RadiusCloudProviderExtensions.cs |
Exports provider callbacks. |
src/Aspire.Hosting.Radius/CloudProviders/IAzureRadiusProviderBuilder.cs |
Exposes Azure credential methods. |
src/Aspire.Hosting.Radius/CloudProviders/IAwsRadiusProviderBuilder.cs |
Exposes AWS credential methods. |
Review details
Files not reviewed (1)
- tests/PolyglotAppHosts/Aspire.Hosting.Radius/TypeScript/package-lock.json: Generated file
- Files reviewed: 24/25 changed files
- Comments generated: 3
- Review effort level: Medium
| /// shape across releases of <c>Aspire.Hosting.Radius</c>. | ||
| /// </remarks> | ||
| [Experimental("ASPIRERADIUS004", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")] | ||
| [AspireExport(ExposeProperties = true)] |
| { | ||
| container.Connections[name] = new ConnectionConstruct | ||
| { | ||
| Source = new IdentifierExpression($"{sourceResourceIdentifier}.id"), |
| RadiusTestHelper.AttachDeploymentTargets(radiusEnv, model); | ||
| var bicep = new RadiusBicepPublishingContext(radiusEnv).GenerateBicep(model); | ||
|
|
||
| Assert.Contains("Custom.Resources/widgets@2025-01-01-preview", bicep); |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
mitchdenny
left a comment
There was a problem hiding this comment.
TypeScript API review findings — see the inline comments for details.
| /// <param name="environmentIdentifier">The Bicep identifier of the environment.</param> | ||
| /// <returns>The same construct for chaining.</returns> | ||
| [AspireExport] | ||
| internal static RadiusResourceTypeConstruct WithResourceScope( |
There was a problem hiding this comment.
cc @mitchdenny
'app', 'radius', 'recipepack', 'legacy_env'). Those identifiers are implementation details, are not discoverable from the TypeScript handles, and become stale if an identifier changes. Since the callback already exposes typed construct handles, can these APIs accept RadiusApplicationConstruct, RadiusEnvironmentConstruct, RadiusRecipePackConstruct, and RadiusResourceTypeConstruct directly and derive the identifier internally? The same concern applies to WithEnvironmentRecipePack, WithApplicationEnvironment, WithContainerConnection, WithContainerScope, and WithLegacyApplicationEnvironment.
| /// <param name="value">The recipe parameter value.</param> | ||
| /// <returns>The same construct for chaining.</returns> | ||
| [AspireExport] | ||
| internal static RadiusResourceTypeConstruct WithStringRecipeParameter( |
There was a problem hiding this comment.
cc @mitchdenny
RecipeParameters collection is BicepDictionary<object>, but the TypeScript projection only permits string values. Radius recipes commonly need numeric, boolean, and structured parameters, so this does not preserve the practical breadth of the C# escape hatch. Can we project the supported JSON-like value shapes, or at least add distinct string/number/boolean adapters?
| /// <param name="name">The deployed environment name.</param> | ||
| /// <returns>The same construct for chaining.</returns> | ||
| [AspireExport] | ||
| internal static RadiusEnvironmentConstruct WithEnvironmentName( |
There was a problem hiding this comment.
cc @mitchdenny
environment.withEnvironmentName(...), application.withApplicationName(...), and resource.withResourceName(...). The receiver already provides the type context. Can we use unique capability IDs with MethodName overrides to expose withName, withEnvironment, withProvider, and similar receiver-relative names, following the withImage pattern already used below?
Ref: Naming Guidelines
| /// <param name="kubernetesNamespace">The Kubernetes namespace.</param> | ||
| /// <returns>The same construct for chaining.</returns> | ||
| [AspireExport] | ||
| internal static LegacyApplicationEnvironmentConstruct WithLegacyEnvironment( |
There was a problem hiding this comment.
cc @mitchdenny
ComputeKind, Recipes, or RecipeConfig. A TypeScript callback therefore cannot express the same legacy customization as the C# callback even though legacyEnvironments() is publicly exposed. Can we either complete this adapter surface or avoid exposing the legacy collections until they can be customized coherently?
TypeScript API Review Summary0 errors, 4 warnings, 0 info across 1 file. The standard Top areas of concern:
Each finding is posted as a separate inline comment for discussion. |
Description
Radius can now be fully configured from a TypeScript AppHost. This projects the cloud-provider callbacks and the generated-infrastructure customization callback into ATS, allowing TypeScript applications to configure Azure or AWS credentials and customize the Radius Bicep model without exposing Azure Provisioning types.
The infrastructure callback exposes typed construct collections plus primitive adapters for environment, application, recipe pack, resource type, container, and legacy-resource customization. A TypeScript polyglot validation fixture exercises the complete projected surface, while the Radius CLI E2E test now publishes a TypeScript AppHost and verifies the customized Bicep output.
User-facing usage
C# AppHost:
TypeScript AppHost:
Validation includes:
Aspire.Hosting.Radius.Tests: 181 tests passed.Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?