Repository navigation
Add ATS exported value catalogs - #16287
Conversation
Co-authored-by: Copilot <[email protected]>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16287Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16287" |
left a comment
There was a problem hiding this comment.
Pull request overview
Adds ATS support for exporting predefined immutable values (via a new [AspireValue] attribute) so generated guest SDKs can expose value catalogs (e.g., FoundryModels.OpenAI.Gpt41Mini) and polyglot AppHosts can reuse shared DTO instances instead of reconstructing them.
Changes:
- Introduces
[AspireValue]plus ATS scanning/storage of exported values inAtsContext.ExportedValues. - Extends guest SDK generators (TypeScript/Java/Python/Go/Rust) to emit exported value catalogs and updates tests/snapshots accordingly.
- Updates Foundry model generation to annotate predefined models for export, and updates polyglot Foundry AppHosts + docs to use/describe catalogs.
Reviewed changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/PolyglotAppHosts/Aspire.Hosting.Foundry/TypeScript/apphost.ts | Uses FoundryModels catalog values instead of hand-constructed model DTOs. |
| tests/PolyglotAppHosts/Aspire.Hosting.Foundry/Python/apphost.py | Uses FoundryModels catalog values and aligns Python validation AppHost with TS surface. |
| tests/PolyglotAppHosts/Aspire.Hosting.Foundry/Java/AppHost.java | Uses FoundryModels catalog values instead of mutating a DTO instance. |
| tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/TestTypes/TestTypes.cs | Adds [AspireValue]-annotated static members to drive exported-value codegen tests. |
| tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts | Updates TS snapshot to include exported value namespaces/constants. |
| tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/AtsGeneratedAspire.verified.ts | Updates TS snapshot to include exported value namespaces/constants. |
| tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/AtsTypeScriptCodeGeneratorTests.cs | Adds assertions that exported values are scanned and emitted in TS output. |
| tests/Aspire.Hosting.CodeGeneration.Rust.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.rs | Updates Rust snapshot to include exported value modules/functions. |
| tests/Aspire.Hosting.CodeGeneration.Rust.Tests/Snapshots/AtsGeneratedAspire.verified.rs | Updates Rust snapshot to include exported value modules/functions. |
| tests/Aspire.Hosting.CodeGeneration.Rust.Tests/AtsRustCodeGeneratorTests.cs | Adds assertions that exported values are scanned and emitted in Rust output. |
| tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py | Updates Python snapshot to include exported values (SimpleNamespace catalogs). |
| tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/AtsGeneratedAspire.verified.py | Updates Python snapshot to include exported values (SimpleNamespace catalogs). |
| tests/Aspire.Hosting.CodeGeneration.Python.Tests/AtsPythonCodeGeneratorTests.cs | Adds assertions that exported values are scanned and emitted in Python output. |
| tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java | Updates Java snapshot to include an exported-values catalog type. |
| tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/AtsGeneratedAspire.verified.java | Updates Java snapshot to include an exported-values catalog type. |
| tests/Aspire.Hosting.CodeGeneration.Java.Tests/AtsJavaCodeGeneratorTests.cs | Adds assertions that exported values are scanned and emitted in Java output. |
| tests/Aspire.Hosting.CodeGeneration.Go.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.go | Updates Go snapshot to include exported value catalog struct/literals. |
| tests/Aspire.Hosting.CodeGeneration.Go.Tests/Snapshots/AtsGeneratedAspire.verified.go | Updates Go snapshot to include exported value catalog struct/literals. |
| tests/Aspire.Hosting.CodeGeneration.Go.Tests/AtsGoCodeGeneratorTests.cs | Adds assertions that exported values are scanned and emitted in Go output. |
| src/Aspire.TypeSystem/HostingTypeHelpers.cs | Adds HostingTypeNames.AspireValueAttribute constant. |
| src/Aspire.TypeSystem/AttributeDataReader.cs | Adds attribute parsing for [AspireValue] (field/property) and AspireValueData. |
| src/Aspire.TypeSystem/AtsExportedValueInfo.cs | Introduces exported-value metadata model (path/type/value/description). |
| src/Aspire.TypeSystem/AtsContext.cs | Extends ATS context to include ExportedValues and updates docs in XML comments. |
| src/Aspire.Hosting/Ats/AspireValueAttribute.cs | Adds new public [AspireValue] attribute API. |
| src/Aspire.Hosting.RemoteHost/AtsContextFilter.cs | Filters ExportedValues when slicing context by assemblies. |
| src/Aspire.Hosting.RemoteHost/AtsContextFactory.cs | Logs exported-value count during scanning. |
| src/Aspire.Hosting.RemoteHost/AtsCapabilityScanner.cs | Scans static fields/properties with [AspireValue] and snaps JSON payloads. |
| src/Aspire.Hosting.Foundry/tools/GenModel.cs | Annotates generated Foundry model descriptors with [AspireValue("FoundryModels")]. |
| src/Aspire.Hosting.Foundry/FoundryModel.Local.Generated.cs | Adds [AspireValue("FoundryModels")] to local Foundry model descriptors. |
| src/Aspire.Hosting.Foundry/FoundryModel.Generated.cs | Adds [AspireValue("FoundryModels")] to hosted Foundry model descriptors. |
| src/Aspire.Hosting.CodeGeneration.TypeScript/AtsTypeScriptCodeGenerator.cs | Emits exported value namespaces/constants into generated TypeScript SDK. |
| src/Aspire.Hosting.CodeGeneration.Rust/AtsRustCodeGenerator.cs | Emits exported value modules/functions into generated Rust SDK. |
| src/Aspire.Hosting.CodeGeneration.Python/PythonModuleBuilder.cs | Adds module section support + types import for exported values. |
| src/Aspire.Hosting.CodeGeneration.Python/AtsPythonCodeGenerator.cs | Emits exported value SimpleNamespace catalogs into generated Python SDK. |
| src/Aspire.Hosting.CodeGeneration.Java/AtsJavaCodeGenerator.cs | Emits exported value catalog classes into generated Java SDK. |
| src/Aspire.Hosting.CodeGeneration.Go/AtsGoCodeGenerator.cs | Emits exported value catalog structs/literals into generated Go SDK. |
| docs/specs/polyglot-apphost.md | Documents exported values and [AspireValue] in the ATS/polyglot spec. |
| docs/specs/bundle.md | Updates ATS attribute list to include [AspireValue]. |
Co-authored-by: Copilot <[email protected]>
commented
Apr 18, 2026
|
In reply to the Copilot review summary at #16287 (review): no action was needed on the overview itself. I addressed the actionable inline review comments separately. |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
left a comment
There was a problem hiding this comment.
Reviewed the exported value catalog implementation. Found 2 issues:
- 1 bug in Rust code generation (missing
useimports in generatedpub modblocks) - 1 bug in all code generators (
BuildExportedValueTreesilently drops child values when a node is both a leaf and a parent)
Co-authored-by: Copilot <[email protected]>
commented
Apr 22, 2026
|
Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
|
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
left a comment
There was a problem hiding this comment.
Reviewed the full PR (56 files, ~3.9K additions). No issues found.
The exported value feature is well-structured: proper type validation (rejects mutable collections/handles), deduplication with exact-path and prefix-conflict detection, defensive error handling with diagnostics, and consistent tree-building across all 5 language generators. Test coverage is thorough — scanner validation tests, context filter tests with referenced type traversal, snapshot tests for all languages, and SDK dump format tests including Unicode content. Previous review comments have all been addressed.
left a comment
•
There was a problem hiding this comment.
Looks great overall - the design is solid, the diagnostic coverage for duplicate / parent-child / mutable-shape paths is good, and the snapshot coverage across all five guest languages plus the Foundry polyglot harness is thorough.
I left four inline comments (one false-negative validation gap on [AspireExportIgnore], one identifier-sanitization concern on [AspireValue(Name = ...)], plus two minor cleanups). None are blockers.
One additional non-blocking note (no inline because it's not tied to a specific line): DeduplicateExportedValues / TryFindConflictingExportedValuePath is O(N^2) in the number of exported values * path depth. With Foundry exporting ~80 entries today this is fine, but if exported-value catalogs become a popular pattern across integrations it's worth replacing with a path trie keyed by PathSegments. Not a bug today, just a heads-up.
| Immutable predefined values can be emitted into generated guest SDKs with `[AspireValue]`: | ||
|
|
||
| ```csharp | ||
| [AspireDto] |
There was a problem hiding this comment.
This is more of an observation about the naming of these attributes. It's bugging me that they don't include Ats in their name (or AspireTypeSystem*), just simply being prefixed with Aspire* doesn't really tell me as a consumer - what they're really used for. I think we should consider renaming them.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
commented
Apr 27, 2026
|
🎬 CLI E2E Test Recordings — 77 recordings uploaded (commit View all recordings
📹 Recordings uploaded automatically from CI run #25022871799 |
commented
Apr 27, 2026
|
Pull request created: #757
|
commented
Apr 27, 2026
|
A draft documentation PR has been opened on microsoft/aspire.dev to document the new Target branch: Branch: Documentation changes
The draft PR needs human review before merging.
|
Description
Adds ATS support for exporting predefined immutable values so polyglot guest SDKs can surface generated value catalogs such as
FoundryModels.OpenAI.Gpt41Mini. This lets AppHost code use shared predefined DTO instances in guest languages instead of reconstructing those DTOs manually.The implementation introduces
[AspireValue]and scans annotated static fields and properties intoAtsContext.ExportedValues. Each guest generator then emits those values in a language-appropriate form, while Foundry model generation annotates the predefined models soaddDeploymentFromModelandaddModelDeploymentFromModelcan use the exported catalog values directly. The PR also updates ATS docs and the Foundry polyglot apphost coverage in TypeScript, Java, and Python.Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: