Skip to content

Export remaining ATS Aspire.Hosting APIs#16227

Merged
sebastienros merged 5 commits intomainfrom
sebastienros/track-ats-api-gaps
Apr 16, 2026
Merged

Export remaining ATS Aspire.Hosting APIs#16227
sebastienros merged 5 commits intomainfrom
sebastienros/track-ats-api-gaps

Conversation

@sebastienros
Copy link
Copy Markdown
Contributor

Description

Polyglot guest apphosts were still missing several non-obsolete Aspire.Hosting extension methods that exist in the C# surface. This PR closes those ATS export gaps so the generated guest SDKs expose the same supported execution-configuration, Aspire store, and eventing-subscriber workflows as the C# AppHost.

The change adds ATS-specific shims where CLR-only shapes are not representable, marks incompatible overloads with redirecting ignores, updates the TypeScript, Python, and Java polyglot validation apphosts to exercise the new surface, and refreshes the generated SDK snapshots for TypeScript, Python, Java, Go, and Rust.

It also includes two follow-up correctness fixes from local review:

  • tryAddEventingSubscriber now deduplicates only identical callback registrations instead of suppressing all later ATS callback subscribers.
  • The Python validation AppHost now returns populated execution-configuration DTOs instead of empty dictionaries, and AtsServiceCollectionExportsTests covers the subscriber-registration behavior.

Validation:

  • ./dotnet.sh build src/Aspire.Hosting/Aspire.Hosting.csproj -p:SkipNativeBuild=true
  • npm run build --silent in tests/PolyglotAppHosts/Aspire.Hosting/TypeScript
  • ./.venv/bin/python -m py_compile apphost.py in tests/PolyglotAppHosts/Aspire.Hosting/Python
  • javac --enable-preview --source 25 -d .build @.modules/sources.txt AppHost.java in tests/PolyglotAppHosts/Aspire.Hosting/Java
  • targeted codegen snapshot tests for TypeScript, Python, Java, Go, and Rust
  • ./dotnet.sh test tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj -- --filter-class "*.AtsServiceCollectionExportsTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"

Dependencies required: none.

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Add ATS execution-configuration and service-collection exports, update the polyglot validation apphosts and codegen snapshots, and fix the review follow-ups for callback subscriber registration and Python execution-configuration DTOs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 16, 2026 00:19
@sebastienros sebastienros requested a review from davidfowl as a code owner April 16, 2026 00:19
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 16, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16227

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16227"

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

This PR closes remaining ATS export gaps so polyglot (TypeScript/Python/Java/Go/Rust) guest AppHosts can use additional Aspire.Hosting extension-method workflows that exist in the C# surface (service collection exports, Aspire store access, execution-configuration builder/result, and eventing subscriber registration).

Changes:

  • Add ATS export shims for IServiceCollection (eventing subscriber registration) and execution-configuration APIs, plus export IAspireStore.
  • Mark CLR-only / ATS-incompatible overloads with [AspireExportIgnore] and add DTO annotations needed for cross-language serialization.
  • Update polyglot validation AppHosts and refresh generated SDK/codegen snapshots; add a targeted unit test for TryAddEventingSubscriber deduping behavior.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/PolyglotAppHosts/Aspire.Hosting/TypeScript/apphost.ts Exercises new ATS service-collection subscriber + execution-configuration APIs in TS validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting/Python/apphost.py Exercises new ATS subscriber + execution-configuration APIs and Aspire store access in Python validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting/Java/AppHost.java Exercises new ATS subscriber + execution-configuration APIs and Aspire store access in Java validation AppHost.
tests/Aspire.Hosting.Tests/AtsServiceCollectionExportsTests.cs Adds unit coverage for TryAddEventingSubscriber deduping only identical callbacks.
tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts Updated TS generated SDK snapshot for newly exported types/capabilities.
tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/HostingContainerResourceCapabilities.verified.txt Updates TS capability list snapshot to include createExecutionConfiguration.
tests/Aspire.Hosting.CodeGeneration.Rust.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.rs Updated Rust generated SDK snapshot for newly exported types/capabilities.
tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py Updated Python generated SDK snapshot for newly exported types/capabilities.
tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java Updated Java generated SDK snapshot for newly exported types/capabilities.
tests/Aspire.Hosting.CodeGeneration.Go.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.go Updated Go generated SDK snapshot for newly exported types/capabilities.
src/Aspire.Hosting/Utils/LoggingUtils.cs Prevents an internal helper from being exported to ATS surface.
src/Aspire.Hosting/Pipelines/PipelineStepExtensions.cs Prevents enumerable-based pipeline step helpers from being exported to ATS surface.
src/Aspire.Hosting/Lifecycle/EventingSubscriberServiceCollectionExtensions.cs Ignores generic subscriber registration overloads that aren’t ATS-compatible.
src/Aspire.Hosting/Ats/ServiceCollectionExports.cs Adds ATS-friendly IServiceProvider/IServiceCollection exports and EventingSubscriberRegistrationContext shim.
src/Aspire.Hosting/Ats/ExecutionConfigurationExports.cs Adds ATS exports for execution-configuration builder/result and DTO shims for certificate flows.
src/Aspire.Hosting/Ats/AtsTypeMappings.cs Exports additional types (IAspireStore, execution-configuration interfaces, IServiceCollection) to ATS.
src/Aspire.Hosting/ApplicationModel/HttpsCertificateExecutionConfigurationGatherer.cs Marks HTTPS cert execution-config context as an ATS DTO.
src/Aspire.Hosting/ApplicationModel/ExecutionConfigurationResultExtensions.cs Ignores generic out-parameter helper from ATS surface.
src/Aspire.Hosting/ApplicationModel/ExecutionConfigurationBuilderExtensions.cs Exports ATS-compatible execution-config builder extension methods; ignores X509 callback overload.
src/Aspire.Hosting/ApplicationModel/CertificateTrustExecutionConfigurationGatherer.cs Marks certificate trust execution-config context as an ATS DTO.
src/Aspire.Hosting/ApplicationModel/AspireStoreExtensions.cs Exports IAspireStore.GetFileNameWithContent to ATS.

Comment thread src/Aspire.Hosting/Ats/ExecutionConfigurationExports.cs Outdated
Comment thread src/Aspire.Hosting/Ats/ExecutionConfigurationExports.cs Outdated
Return non-null execution-configuration export DTOs when certificate data is absent so the runtime matches the generated guest SDK contract.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Member

@JamesNK JamesNK left a comment

Choose a reason for hiding this comment

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

LGTM — clean ATS export surface. Two minor nits flagged inline (extraneous CS0618 pragma, BOM in 4 snapshot files).

Comment thread src/Aspire.Hosting/Ats/ExecutionConfigurationExports.cs Outdated
sebastienros and others added 2 commits April 15, 2026 17:53
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread src/Aspire.Hosting/Ats/ServiceCollectionExports.cs
Comment thread src/Aspire.Hosting/Ats/ServiceCollectionExports.cs Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sebastienros sebastienros merged commit d8b22e3 into main Apr 16, 2026
281 checks passed
@sebastienros sebastienros deleted the sebastienros/track-ats-api-gaps branch April 16, 2026 02:51
@github-actions github-actions Bot added this to the 13.3 milestone Apr 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🎬 CLI E2E Test Recordings — 71 recordings uploaded (commit 725d955)

View recordings
Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_DefaultSelection_InstallsSkillOnly ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AspireAddPackageVersionToDirectoryPackagesProps ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
Banner_NotDisplayedWithNoLogoFlag ▶️ View Recording
CertificatesClean_RemovesCertificates ▶️ View Recording
CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate ▶️ View Recording
CertificatesTrust_WithUntrustedCert_TrustsCertificate ▶️ View Recording
ConfigSetGet_CreatesNestedJsonFormat ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunEmptyAppHostProject ▶️ View Recording
CreateAndRunJavaEmptyAppHostProject ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateAndRunTypeScriptEmptyAppHostProject ▶️ View Recording
CreateAndRunTypeScriptStarterProject ▶️ View Recording
CreateJavaAppHostWithViteApp ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DashboardRunWithOtelTracesReturnsNoTraces ▶️ View Recording
DeployK8sBasicApiService ▶️ View Recording
DeployK8sWithGarnet ▶️ View Recording
DeployK8sWithMongoDB ▶️ View Recording
DeployK8sWithMySql ▶️ View Recording
DeployK8sWithPostgres ▶️ View Recording
DeployK8sWithRabbitMQ ▶️ View Recording
DeployK8sWithRedis ▶️ View Recording
DeployK8sWithSqlServer ▶️ View Recording
DeployK8sWithValkey ▶️ View Recording
DeployTypeScriptAppToKubernetes ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DoListStepsShowsPipelineSteps ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
GlobalMigration_HandlesCommentsAndTrailingCommas ▶️ View Recording
GlobalMigration_HandlesMalformedLegacyJson ▶️ View Recording
GlobalMigration_PreservesAllValueTypes ▶️ View Recording
GlobalMigration_SkipsWhenNewConfigExists ▶️ View Recording
GlobalSettings_MigratedFromLegacyFormat ▶️ View Recording
InitTypeScriptAppHost_AugmentsExistingViteRepoAtRoot ▶️ View Recording
InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View Recording
LegacySettingsMigration_AdjustsRelativeAppHostPath ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
OtelLogsReturnsStructuredLogsFromStarterApp ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
PublishWithConfigureEnvFileUpdatesEnvOutput ▶️ View Recording
PublishWithDockerComposeServiceCallbackSucceeds ▶️ View Recording
PublishWithoutOutputPathUsesAppHostDirectoryDefault ▶️ View Recording
RestoreGeneratesSdkFiles ▶️ View Recording
RestoreRefreshesGeneratedSdkAfterAddingIntegration ▶️ View Recording
RestoreSupportsConfigOnlyHelperPackageAndCrossPackageTypes ▶️ View Recording
RunFromParentDirectory_UsesExistingConfigNearAppHost ▶️ View Recording
SecretCrudOnDotNetAppHost ▶️ View Recording
SecretCrudOnTypeScriptAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StartAndWaitForTypeScriptSqlServerAppHostWithNativeAssets ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording
UnAwaitedChainsCompileWithAutoResolvePromises ▶️ View Recording

📹 Recordings uploaded automatically from CI run #24488558950

@davidfowl
Copy link
Copy Markdown
Contributor

@sebastienros I'm making an issue to make some changes about how we expose ATS APIs given our conversation today.

@aspire-repo-bot
Copy link
Copy Markdown
Contributor

No documentation PR is required for this change.

This PR closes ATS export gaps by adding [AspireExport]/[AspireExportIgnore] attributes to existing Aspire.Hosting APIs and introducing ATS-specific shims in ExecutionConfigurationExports.cs. The changes are internal to the polyglot SDK code-generation layer — they make the generated TypeScript/Python/Java/Go/Rust SDKs expose the same execution-configuration, Aspire store, and eventing-subscriber workflows that already exist in the C# AppHost surface. No new public APIs were introduced, and the existing aspire.dev documentation for polyglot apphosts already covers the underlying concepts.

Generated by PR Documentation Check for issue #16227 · ● 403.7K ·

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants