Add polyglot endpoint callback exports#15856
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15856Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15856" |
There was a problem hiding this comment.
Pull request overview
This PR adds polyglot-safe endpoint mutation callback exports so TypeScript/Java/Python AppHosts can update already-created endpoints (e.g., auto-created http endpoints) by name without changing existing endpoint creation semantics.
Changes:
- Introduces
EndpointUpdateContextas an ATS-safe wrapper for mutating endpoint settings in polyglot callbacks. - Adds new exported mutation capabilities:
withEndpointCallback(...)andwithHttpEndpointCallback(...)(plus generated SDK surface updates). - Updates polyglot AppHost samples and codegen snapshots to validate the new callback APIs.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/PolyglotAppHosts/Aspire.Hosting/TypeScript/apphost.ts | Adds usage coverage for endpoint callback mutation APIs in TS AppHost sample. |
| tests/PolyglotAppHosts/Aspire.Hosting/Python/apphost.py | Adds usage coverage for endpoint callback mutation APIs in Python AppHost sample. |
| tests/PolyglotAppHosts/Aspire.Hosting/Java/AppHost.java | Adds usage coverage for endpoint callback mutation APIs in Java AppHost sample. |
| tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts | Updates TS generated surface to include EndpointUpdateContext and callback methods/options. |
| tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/HostingContainerResourceCapabilities.verified.txt | Adds the new capability IDs to the TS codegen capability snapshot. |
| tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py | Updates Python generated surface to include EndpointUpdateContext and callback methods/kwargs. |
| tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java | Updates Java generated surface to include EndpointUpdateContext and callback methods/options. |
| src/Aspire.Hosting/ResourceBuilderExtensions.cs | Adds internal exported endpoint mutation methods and updates polyglot guidance/ignore reason text. |
| src/Aspire.Hosting/ApplicationModel/EndpointUpdateContext.cs | Introduces the new exported context wrapper type for endpoint mutation. |
JamesNK
left a comment
There was a problem hiding this comment.
3 comments: 1 likely bug (missing WithHttpsEndpointCallback symmetry), 1 unnecessary complexity (reflection in test when InternalsVisibleTo is available), 1 minor (unrelated blank line removal).
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>
ab19db9 to
60fc265
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🎬 CLI E2E Test Recordings — 68 recordings uploaded (commit View recordings
📹 Recordings uploaded automatically from CI run #24353404414 |
* Add endpoint callback exports for polyglot apphosts Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Make endpoint update context internal Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix HTTP endpoint callback creation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Regenerate endpoint callback snapshots Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address PR review comments Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Description
Add polyglot-safe endpoint mutation callbacks for AppHosts so existing endpoints can be updated by name without changing the creation semantics of
withEndpoint(...)orwithHttpEndpoint(...).This change introduces an ATS-safe
EndpointUpdateContextwrapper and exports separate callback-based mutation APIs:withEndpointCallback(...)withHttpEndpointCallback(...)These are generated into the TypeScript, Java, and Python AppHost surfaces and covered by the shared polyglot apphost samples. This enables scenarios like mutating an auto-created
httpendpoint, including the Vite endpoint case from the issue.Fixes #15854
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: