Export remaining ATS Aspire.Hosting APIs#16227
Conversation
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>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16227Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16227" |
There was a problem hiding this comment.
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 exportIAspireStore. - 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
TryAddEventingSubscriberdeduping 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. |
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>
JamesNK
left a comment
There was a problem hiding this comment.
LGTM — clean ATS export surface. Two minor nits flagged inline (extraneous CS0618 pragma, BOM in 4 snapshot files).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🎬 CLI E2E Test Recordings — 71 recordings uploaded (commit View recordings
📹 Recordings uploaded automatically from CI run #24488558950 |
|
@sebastienros I'm making an issue to make some changes about how we expose ATS APIs given our conversation today. |
|
No documentation PR is required for this change. This PR closes ATS export gaps by adding
|
Description
Polyglot guest apphosts were still missing several non-obsolete
Aspire.Hostingextension 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:
tryAddEventingSubscribernow deduplicates only identical callback registrations instead of suppressing all later ATS callback subscribers.AtsServiceCollectionExportsTestscovers the subscriber-registration behavior.Validation:
./dotnet.sh build src/Aspire.Hosting/Aspire.Hosting.csproj -p:SkipNativeBuild=truenpm run build --silentintests/PolyglotAppHosts/Aspire.Hosting/TypeScript./.venv/bin/python -m py_compile apphost.pyintests/PolyglotAppHosts/Aspire.Hosting/Pythonjavac --enable-preview --source 25 -d .build @.modules/sources.txt AppHost.javaintests/PolyglotAppHosts/Aspire.Hosting/Java./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
<remarks />and<code />elements on your triple slash comments?aspire.devissue: