Export Dotnet Blazor gateway APIs to polyglot AppHosts - #19026
Karol Zadora-Przylecki (karolz-ms) merged 4 commits into
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19026Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19026" |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Exports the Project V2 Blazor gateway APIs to polyglot AppHosts while preserving run-only behavior.
Changes:
- Adds distinct ATS capability IDs with consistent generated method names.
- Validates generated APIs across TypeScript, Python, Java, and Go.
- Updates the Project V2 plan.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/Aspire.Hosting.Blazor/BlazorGatewayExtensions.cs |
Enables polyglot exports. |
tests/PolyglotAppHosts/Aspire.Hosting.Blazor/TypeScript/apphost.mts |
Exercises TypeScript APIs. |
tests/PolyglotAppHosts/Aspire.Hosting.Blazor/Python/apphost.py |
Exercises Python APIs. |
tests/PolyglotAppHosts/Aspire.Hosting.Blazor/Java/AppHost.java |
Exercises Java APIs. |
tests/PolyglotAppHosts/Aspire.Hosting.Blazor/Go/apphost.go |
Exercises Go APIs. |
docs/plans/project-v2-csharpprogram-watch.md |
Documents capabilities and validation. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Karol Zadora-Przylecki (karolz-ms)
left a comment
There was a problem hiding this comment.
Code review of the polyglot export flip. The capability IDs, MethodName override, and analyzer/codegen collision handling all check out — my findings are confined to the generated SDK documentation that these two exports now make user-facing, plus one stale attribute reason.
4 issues: 3 generated-documentation problems, 1 stale comment.
Karol Zadora-Przylecki (karolz-ms)
left a comment
There was a problem hiding this comment.
Review of the polyglot export + runtime-asset packaging change.
I packed Aspire.Hosting.Blazor locally to confirm the layout change: the nupkg carries both buildTransitive/<tfm>/Scripts/* and lib/<tfm>/Scripts/* with identical content and zero NuGet warnings. I also traced IntegrationLoadContext -> IntegrationPackageProbeManifest -> NuGetPackageAssetResolver and confirmed that for a package-backed integration Assembly.Location resolves into the extracted global-packages lib/<tfm> folder, so GetScriptPath() finds the scripts. The changed tests all pass locally (AddDotnetProjectBlazorGatewayTests 3/3, AspireHostingBlazorPackageContainsScriptsForBuildAndDirectLoading 1/1, RealMapBlazorRuntimeAssetChangeRunsPackageAndPolyglotRegressions 1/1), and the new E2E script's jq filter matches the real describe --format json shape.
Two findings: one test-robustness issue and one accuracy issue in the packaging comment / plan doc.
There was a problem hiding this comment.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Note
This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 601e55b7-8ab3-4a56-9d32-ad759ae37b1a
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 601e55b7-8ab3-4a56-9d32-ad759ae37b1a
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d607e42c-4b78-4ff2-b6c1-b09890fb05db
a51e870 to
737c281
Compare
This comment has been minimized.
This comment has been minimized.
Karol Zadora-Przylecki (karolz-ms)
left a comment
There was a problem hiding this comment.
Review of the polyglot export + runtime-asset packaging change.
I validated the mechanism locally rather than reading the diff alone: packed Aspire.Hosting.Blazor and confirmed the nupkg carries both buildTransitive/<tfm>/Scripts/* and lib/<tfm>/Scripts/* byte-identical with zero NuGet warnings; traced IntegrationLoadContext -> IntegrationPackageProbeManifest to confirm package-backed integrations load straight from the NuGet cache so Scripts/ really does sit next to Assembly.Location; ran the 3 Blazor unit tests, the new AspireHostingBlazorPackageContainsScriptsForBuildAndDirectLoading, and the new RealMapBlazorRuntimeAssetChangeRunsPackageAndPolyglotRegressions (all pass); and confirmed all four polyglot playground scripts are compile-only, so the publish fail-fast can't break the polyglot job. Not regenerating *.ats.txt is correct per docs/ci/typescript-api-compat.md.
3 issues: 1 correctness/API-contract gap (with the matching missing regression test), 2 test-coverage/diagnostics nits.
The headline one is that the publish fail-fast guard sits on AddDotnetProjectBlazorGateway but not on the WithBlazorClientApp overload this PR exports, so the "publishing still fails fast" claim in the description only holds for one of the two now-public entry points.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: cd7620ce-23ad-4b2c-b0d1-ca4e5b61f2ae
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. 9 / 102 test projects · 4 jobs, from 14 changed files. Selected test projects (9 / 102)
Selected jobs (4)
How these were chosen — grouped by what changed🧪 🔧 🔧 🔧 📄 📄 🧪 🧪 🧪 Job reasons
Selection computed for commit |
PR Testing ReportPR Information
Artifact Version Verification
The installed CLI reports the PR head short commit Changes AnalyzedFiles Changed
Change Categories
Test Scenarios ExecutedScenario 1: PR artifact identity and Blazor package layoutObjective: Verify the tested CLI and NuGet package contain the PR head and the new direct-load script layout. Coverage Type: Artifact/package validation Status: ✅ Passed Steps:
Observations:
Evidence:
Scenario 2: TypeScript DotnetProject Blazor gateway runtimeObjective: Verify a TypeScript AppHost can compile and invoke the two exported APIs, run the gateway, and serve a Blazor WASM client. Coverage Type: Happy-path runtime Status: ✅ Passed Steps:
Observations:
Evidence:
Scenario 3: Python generated SDK and CI validator behaviorObjective: Verify the Python SDK exposes the new members and the changed CI script invokes its fixture validator without losing existing settings. Coverage Type: Generated API and boundary/failure-path validation Status: ✅ Passed Steps:
Observations:
Expected Boundary Outcome: Temporary channel pinning must not overwrite a fixture's prior settings. Evidence:
Scenario 4: Unsupported publish pathObjective: Verify the exported DotnetProject gateway still fails fast in publish mode rather than producing an incomplete deployment. Coverage Type: Unhappy path Status: ✅ Passed Steps:
Expected Unhappy-Path Outcome: A nonzero exit code and a clear unsupported-publish error directing users to Observations:
Evidence:
CI Infrastructure ValidationGitHub ActionsWhat runs on this PR:
Automated tests:
Results validation:
Manual triggers: None. Every affected workflow path was exercised by this PR's own CI run, so an additional dispatch would duplicate coverage. Dependency graph:
Coverage-loss audit:
gh-aw: Not applicable. Failure-modes scan:
Azure DevOpsNot applicable; the PR does not change Azure DevOps pipeline infrastructure. Summary
Overall Result✅ PR VERIFIED The changed API exports, package layout, TypeScript runtime path, Python generated SDK validation, unsupported publish guard, and selective CI routing all behaved as intended. At report time, automatic CI run attempt 2 had 376 passing checks, no failed checks, one skipped check, and only the aggregate |
Sébastien Ros (sebastienros)
left a comment
There was a problem hiding this comment.
I'll refactor the python validation next
c128892
into
main
|
Pull request created: #1564
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#1564 targeting Added a new section to
Note This draft PR needs human review before merging. |
Description
Polyglot AppHosts can now use the
DotnetProjectResource-backed Blazor gateway APIs introduced for Project V2. These methods were previously marked[AspireExportIgnore]even though their parameter and return types are ATS-compatible. This follows Sebastien's feedback in the API surface review.AddDotnetProjectBlazorGatewayis now exported directly. TheDotnetProjectResourceoverload ofWithBlazorClientAppuses the distinctwithDotnetProjectBlazorClientAppcapability ID to avoid colliding with the existingProjectResourceoverload, while retainingwithBlazorClientAppas the generated method name on the new resource handle.The existing Blazor validation AppHosts now exercise both APIs in TypeScript, Go, Java, and Python. The Project V2 feature plan also records the additive capabilities and the unchanged run-only behavior; publishing this gateway variant still fails fast until
DotnetProjectResourcesupports the container-files pipeline.User-facing usage
C# AppHost:
TypeScript AppHost:
Validation
Aspire.Hosting.Blazorbuilds with zero analyzer warnings or errors.AddDotnetProjectBlazorGatewayTestspasses all 3 tests.api/*.cs,*.ats.txt, and.aspire/modulesfiles are not included.Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?