Load polyglot AppHost settings from project root - #19719
Conversation
Use the guest AppHost directory as the inner host content root while preserving managed server configuration and logging defaults. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f941c2f4-38c9-45a6-8e6f-e5d6e6ff8847
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19719Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19719" |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Roots polyglot AppHost configuration at the guest project directory so standard .NET application settings are discovered.
Changes:
- Loads environment-specific AppHost settings with standard precedence.
- Preserves managed logging defaults while permitting overrides.
- Adds focused tests and documents usage.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/Aspire.Hosting/DistributedApplication.cs |
Sets the polyglot content root. |
src/Aspire.Hosting/DistributedApplicationBuilder.cs |
Applies content root and logging defaults. |
src/Aspire.Hosting/DistributedApplicationOptions.cs |
Adds internal content-root storage. |
tests/Aspire.Hosting.Tests/DistributedApplicationBuilderTests.cs |
Tests settings and logging precedence. |
docs/specs/polyglot-apphost.md |
Documents application settings. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f941c2f4-38c9-45a6-8e6f-e5d6e6ff8847
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
docs/specs/polyglot-apphost.md:1385
- This is inconsistent with the implemented precedence: the inner distributed application host reapplies its
Loggingsection after Aspire's defaults, so matching application settings can override those defaults. Distinguish the outer JSON-RPC host's private settings from the inner host's overridable logging defaults.
The managed server keeps its own internal configuration separate, so application settings do not replace ATS assembly discovery or server logging settings.
This comment has been minimized.
This comment has been minimized.
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f941c2f4-38c9-45a6-8e6f-e5d6e6ff8847
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f941c2f4-38c9-45a6-8e6f-e5d6e6ff8847
This comment has been minimized.
This comment has been minimized.
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
PR Testing ReportPR Information
Artifact Version Verification
Changes AnalyzedFiles Changed
Change Categories
Test Scenarios ExecutedScenario 1: Base AppHost settingsObjective: Verify a fresh TypeScript AppHost loads Coverage Type: Happy path Status: Passed The AppHost read Evidence: Scenario 2: Environment-specific settingsObjective: Verify standard environment-specific configuration works with a lowercase environment name and lowercase Coverage Type: Happy path and environment boundary Status: Passed The AppHost was started with Evidence: Scenario 3: Existing polyglot logging defaultsObjective: Verify an existing TypeScript AppHost without logging JSON preserves the managed AppHost logging defaults. Coverage Type: Backward compatibility Status: Passed The resolved values were:
Evidence: Scenario 4: User logging overrideObjective: Verify AppHost-root JSON remains authoritative over the low-priority compatibility defaults. Coverage Type: Precedence boundary Status: Passed Setting Evidence: Scenario 5: Malformed AppHost settingsObjective: Verify invalid AppHost-root JSON fails safely with an actionable diagnostic. Coverage Type: Unhappy path Status: Passed An invalid JSON token caused exit code Evidence: Summary
Overall ResultPR VERIFIED The PR artifact at the current head passed all five targeted Linux scenarios. The runner image did not include Node.js/npm, so those execution prerequisites were installed inside the ephemeral test container before running the generated TypeScript projects. |
|
Could you add some TS tests that prove this works as well, the current tests are using the C# AppHost approach. It'd be great to have some real TS verification for this. Some scenarios I'd like to see covered is JSON files, overrides, environment-specific, like you've done with the .NET tests - but not in TS, verifying that the full e2e works. Bonus points for proving contextual env vars flow from e2e too. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f941c2f4-38c9-45a6-8e6f-e5d6e6ff8847
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. 51 / 102 test projects · 4 jobs, from 9 changed files. Selected test projects (51 / 102)
Selected jobs (4)
How these were chosen — grouped by what changed
🔧 show 45
🧪 📦 affected project 📄 📄 📄 📄 📄 Job reasons
Selection computed for commit |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Documents that polyglot (TypeScript) AppHosts now load appsettings.json
and appsettings.{Environment}.json from the guest AppHost directory,
per microsoft/aspire#19719.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Pull request created: #1597
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#1597 targeting Added a new "Configuration with appsettings.json" section to Note This draft PR needs human review before merging. |
|
🔍 CI Failure Analysis: Transient Infrastructure Failure The CI build failed due to transient infrastructure issues. Failed jobs:
If a rerun was not already requested automatically, visit the workflow run page to rerun the failed jobs manually. |
* docs: document appsettings.json support for TypeScript AppHosts
Documents that polyglot (TypeScript) AppHosts now load appsettings.json
and appsettings.{Environment}.json from the guest AppHost directory,
per microsoft/aspire#19719.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Reframe TS AppHost appsettings docs as a JSON config system
Rewrite the Configuration section on the TypeScript AppHost page to describe appsettings.json purely as a JSON configuration system for TypeScript, using camelCase keys, a case-insensitive lookup note, and an ASPIRE_ENVIRONMENT-based environment section.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Show aspire start --environment switch and link CLI reference
Replace the ASPIRE_ENVIRONMENT example with the single aspire start --environment CLI command, add a LearnMore link to the aspire start CLI reference, and drop the now-unused OsAwareTabs import.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Apply suggestion from @IEvangelist
* docs: clarify TypeScript AppHost config flow
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: aspire-repo-bot[bot] <268009190+aspire-repo-bot[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: David Pine <david.pine@microsoft.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: David Pine <7679720+IEvangelist@users.noreply.github.com>
Description
Polyglot AppHosts run their managed Aspire server from a CLI-owned directory, so the server-side application builder could not discover
appsettings.jsonfiles next toapphost.mtsor other guest AppHost files.This change roots the inner distributed application host at the guest AppHost directory. Polyglot AppHosts now receive the standard .NET configuration stack, including
appsettings.json,appsettings.{Environment}.json, environment variables, and command-line arguments. The outer JSON-RPC host continues loading its private configuration for ATS assembly discovery, while the inner host explicitly preserves the managed server's logging defaults and allows application settings to override them.User-facing usage
Place application settings next to the guest AppHost:
{ "Deployment": { "Region": "westus" } }TypeScript AppHosts can consume the resulting configuration through the generated builder API:
Validation:
DistributedApplicationBuilderTestscovers base settings, environment-specific overrides, preserved managed logging defaults, and application logging overrides.Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?