Add ATS pipeline parity for polyglot AppHosts#15826
Add ATS pipeline parity for polyglot AppHosts#15826sebastienros wants to merge 7 commits intomainfrom
Conversation
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 -- 15826Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15826" |
There was a problem hiding this comment.
Pull request overview
This PR addresses #15708 by exposing the distributed application builder pipeline to polyglot AppHosts via standard ATS exports (rather than TypeScript-only generator special-casing), and updates the generated TypeScript surface plus polyglot fixtures to use the shared shape.
Changes:
- Export
IDistributedApplicationPipelinethrough ATS and add ATS-friendlyaddStepandconfigurecapability exports. - Update the TypeScript ATS code generator and snapshot to include the builder-level
pipelinehandle and its methods. - Update TypeScript/Python/Java polyglot AppHost fixtures to exercise the builder-level pipeline API; hide an internal manifest publishing pipeline extension from the polyglot surface.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/PolyglotAppHosts/Aspire.Hosting/TypeScript/apphost.ts | Uses the generated builder-level pipeline handle (builder.pipeline.get()) and exercises addStep/configure. |
| tests/PolyglotAppHosts/Aspire.Hosting/Python/apphost.py | Uses the generated builder-level pipeline API (builder.pipeline) and exercises add_step/configure. |
| tests/PolyglotAppHosts/Aspire.Hosting/Java/AppHost.java | Uses the generated builder-level pipeline API (builder.pipeline()) and exercises addStep/configure. |
| tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts | Updates the verified generated TypeScript API surface to include pipeline handle/methods. |
| src/Aspire.Hosting/Publishing/ManifestPublishingExtensions.cs | Explicitly hides internal manifest publishing pipeline extension from ATS/polyglot export surface. |
| src/Aspire.Hosting/Ats/PipelineExports.cs | Adds ATS capability exports for pipeline addStep and configure. |
| src/Aspire.Hosting/Ats/AtsTypeMappings.cs | Adds assembly-level ATS type export for IDistributedApplicationPipeline. |
| src/Aspire.Hosting.CodeGeneration.TypeScript/AtsTypeScriptCodeGenerator.cs | Adjusts method/interface generation and callback codegen (including indentation handling). |
src/Aspire.Hosting.CodeGeneration.TypeScript/AtsTypeScriptCodeGenerator.cs
Show resolved
Hide resolved
src/Aspire.Hosting.CodeGeneration.TypeScript/AtsTypeScriptCodeGenerator.cs
Show resolved
Hide resolved
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>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🎬 CLI E2E Test Recordings — 56 recordings uploaded (commit View recordings
📹 Recordings uploaded automatically from CI run #23968838492 |
| List<AtsParameterInfo> requiredParams, | ||
| List<AtsParameterInfo> optionalParams) | ||
| List<AtsParameterInfo> optionalParams, | ||
| string indent = " ") |
There was a problem hiding this comment.
nit: I would prefer an indent level, and then repeated the indent chars by the level.
| /// <param name="requiredBy">Optional step names that require this step.</param> | ||
| [AspireExport(Description = "Adds a pipeline step to the application")] | ||
| public static void AddStep( | ||
| this global::Aspire.Hosting.Pipelines.IDistributedApplicationPipeline pipeline, |
There was a problem hiding this comment.
Why reference the type like this?
JamesNK
left a comment
There was a problem hiding this comment.
Looks good — clean approach to exporting the pipeline surface through standard ATS exports. Two minor nits on pre-existing patterns in generated snapshots (Rust unused bindings, Go/Java nil guard on required callback). No blocking issues.
| pub fn configure(&self, callback: impl Fn(Vec<Value>) -> Value + Send + Sync + 'static) -> Result<(), Box<dyn std::error::Error>> { | ||
| let mut args: HashMap<String, Value> = HashMap::new(); | ||
| args.insert("pipeline".to_string(), self.handle.to_json()); | ||
| let callback_id = register_callback(callback); |
There was a problem hiding this comment.
Pre-existing issue, good opportunity to fix during this work: Both add_step and configure assign let result = self.client.invoke_capability(...) but result is never used. This produces Rust unused_variable warnings. The idiomatic fix is either let _result = ... or let _ = ....
| reqArgs["callback"] = RegisterCallback(callback) | ||
| } | ||
| if dependsOn != nil { | ||
| reqArgs["dependsOn"] = SerializeValue(dependsOn) |
There was a problem hiding this comment.
Pre-existing issue in the Go generator: callback is a required parameter (validated with ArgumentNullException.ThrowIfNull on the C# side), but the generated code wraps callback serialization in if callback != nil, silently omitting it from rpc args if nil is passed instead of failing. Same pattern appears in the Java addStepImpl generated code (if (callbackId != null)). Not blocking — just noting the generator emits a nil guard for a parameter that should never be nil.
Description
Fixes #15708 by exposing the builder pipeline through standard ATS exports instead of TypeScript-only generator special casing. This keeps the polyglot AppHost surface aligned across TypeScript, Python, and Java while preserving the existing C# pipeline API.
This change exports
IDistributedApplicationPipeline, adds ATS-friendlyaddStepandconfiguremethods on the pipeline handle, and updates the TypeScript generator snapshot plus the TypeScript, Python, and Java polyglot fixtures to use the shared generated shape. It also explicitly hides the internal manifest publishing pipeline extension from the polyglot surface. During self-review, I fixed a shared TypeScript callback-generation bug in the multi-parameterCancellationTokenpath.Dependencies required for this change: none.
Fixes #15708
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: