Skip to content

[release/17.0] Close Go AppHost CLI preview readiness gaps - #22002

Closed
Mitch Denny (mitchdenny) wants to merge 1 commit into
mitchdenny-backport-17-0-04-pr21824from
mitchdenny-backport-17-0-05-pr21823
Closed

Mitch Denny (mitchdenny) wants to merge 1 commit into
mitchdenny-backport-17-0-04-pr21824from
mitchdenny-backport-17-0-05-pr21823

Conversation

@mitchdenny

Copy link
Copy Markdown
Member

Description

Backport of #21823 to release/17.0 (cherry-picked from 8e264bf with no modifications). Layer 5 of 55 in the release/17.0 backport stack; stacked on #22001.

Backport recommendation: Yes — Fixes aspire init for Go in an existing Go repo (17.0 milestone).

Backport of #21823

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

## Description

Go AppHost initialization should work in an existing Go repository
without replacing its module or requiring edits to its workspace. This
creates a separate `aspire-apphost/` module/workspace when the root
already contains `go.mod`, preserves the application's files, and
records the nested AppHost path in configuration.

Contributes to #21115, #21201, #21207 and #21208. These are umbrella
issues; this PR does not close their remaining work.

Also:
- Removes the incomplete language list from `aspire init --help` and
updates generated localization resources and the reviewed help snapshot.
- Makes the TypeScript doctor check honor a configured non-TypeScript
AppHost, while preserving the migration resolver's legacy discovery
behavior.
- Corrects the Go toolchain warning to acknowledge installed toolchains
on PATH, and extends the minimum-version guard to the Go starter modules
and hosting fallback. Includes the new runtime-read test-selection edge.
- Enables response decompression for both documentation HTTP clients.
- Excludes dev-server build output from SDK default items so copied
file-based C# sources cannot enter subsequent server compilations.

### User-facing usage

From an existing Go repository:

```console
aspire init --language go --non-interactive --suppress-agent-init
```

The existing `go.mod`, `go.work` and source files stay unchanged. New
AppHost files live in `aspire-apphost/`, and root configuration selects
`aspire-apphost/apphost.go`. Its local `go.work` isolates it from an
ancestor workspace that does not list the new module. Explicit user
`GOWORK` overrides are unchanged.

Updated help:

```text
--language <language>  The programming language for the AppHost
```

### Validation

All commands ran on Windows unless noted. `MSBUILDTERMINALLOGGER=false`
was set for .NET validation.

- `.\restore.cmd` — passed; restore reported dependency-advisory
warnings.
- `dotnet build src\Aspire.Cli\Aspire.Cli.csproj --no-restore
-t:UpdateXlf -v:quiet` — passed, no warnings/errors.
- `dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj
--no-restore --no-launch-profile -- --filter-class
'*.ScaffoldingServiceTests' --filter-class
'*.GoAppHostToolingCheckTests' --filter-class
'*.TypeScriptAppHostToolingCheckTests' --filter-class
'*.InitCommandTests' --filter-class
'*.DotNetBasedAppHostServerScaffoldCacheTests' --filter-class
'*.ProgramTests' --filter-not-trait 'quarantined=true'
--filter-not-trait 'outerloop=true'` — passed, 253 tests. The initial
run identified the intended help snapshot change and two new-test setup
issues, which were corrected before this passing run.
- `dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj
--no-restore --no-launch-profile -- --filter-class
'*.GoAppHostToolingCheckTests' --filter-not-trait 'quarantined=true'
--filter-not-trait 'outerloop=true'` — passed, 61 tests after the final
guard scope adjustment.
- `dotnet test --project
tests\Infrastructure.Tests\Infrastructure.Tests.csproj --no-restore
--no-launch-profile -- --filter-class
'Infrastructure.Tests.TestTriggerMap.TestTriggerMapTests'
--filter-not-trait 'quarantined=true' --filter-not-trait
'outerloop=true'` — passed, 174 tests.
- The documented full `--filter-namespace
'Infrastructure.Tests.TestTriggerMap'` run did **not** complete
successfully and was stopped after shell-dependent failures. Prepending
Git Bash did not repair the Windows process launch: the unchanged
comparison-base tests still invoked the WSL Bash shim. Control
`C:\Windows\System32\bash.exe --version` reproduces the missing
`/bin/bash` failure; comparison-base script/test inputs have no diff
against `origin/main`. This is not a full selector-suite pass.
- `.\.dotnet\dotnet.exe
artifacts\bin\Aspire.Cli\Debug\net11.0\aspire.dll init --help --nologo`
— passed; confirms updated help.
- A scratch Linux Docker smoke with Go 1.26.10, `GOPROXY=off
GOTOOLCHAIN=local`, root and nested workspaces, and an AppHost-shaped
local SDK replacement passed root/nested module resolution, `go build
./...`, `go vet ./...` and `go run .`. This checks Go workspace
semantics, not a full Aspire E2E run.
- `.\.dotnet\dotnet.exe msbuild <scratch>\smoke.csproj -getItem:Compile
-nologo` — passed: only `Program.cs` was included with an invalid
file-based `build/Gateway.cs` present. A full repeated Blazor AppHost
restore was not run.
- `curl.exe --silent --show-error --location --header 'Accept-Encoding:
br' --output NUL --write-out 'sitemap HTTP %{http_code}, downloaded
%{size_download} bytes\n' https://aspire.dev/sitemap-0.xml` — HTTP 200,
678,572 bytes. Unit coverage verifies both registered clients enable
automatic decompression; this curl measurement is endpoint evidence, not
a CLI transfer trace.
- `git diff --check` — passed.

Not included: Rust workspace behavior; Python/Java/Rust doctor checks;
shared language-discovery redesign; bundle-mode performance
measurements; changing Go SDK timestamp preservation; GA
support/compatibility policy. The existing empty-directory Go toolchain
probe is deliberately retained. Separate product PRs cover
runtime/export, extension, CI/scenarios and publish validation.
Root-module CLI E2E coverage is being added separately and requires this
CLI behavior.

## Checklist

- Is this feature complete?
  - [x] Yes. Ready to ship.
  - [ ] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
  - [x] Yes
  - [ ] No
- Did you add public API?
  - [ ] Yes
    - If yes, did you have an API Review for it?
      - [ ] Yes
      - [ ] No
- Did you add `<remarks />` and `<code />` elements on your triple slash
comments?
      - [ ] Yes
      - [ ] No
  - [x] No
- Does the change make any security assumptions or guarantees?
  - [ ] Yes
    - If yes, have you done a threat model and had a security review?
      - [ ] Yes
      - [ ] No
  - [x] No

---------

Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit 8e264bf)
@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

3 / 101 PR test projects · 4 PR jobs, from 30 changed files.

Selected PR test projects (3 / 101)

Aspire.Cli.EndToEnd.Tests, Aspire.Cli.Tests, Infrastructure.Tests

Selected PR jobs (4)

cli-starter-validation, extension-e2e, polyglot, typescript-api-compat


How these were chosen — grouped by what changed

📦 affected project Aspire.Cli
→ 1 test: Aspire.Cli.EndToEnd.Tests

📄 eng/github-ci/test-trigger-map.yml (changed)
→ 1 directly: Infrastructure.Tests

🔧 src/Aspire.Cli/Resources/InitCommandStrings.resx (changed source)
→ 1 directly: Infrastructure.Tests

🧪 tests/Aspire.Cli.EndToEnd.Tests/GoRootModuleInitTests.cs (changed test)
→ 1 directly: Aspire.Cli.EndToEnd.Tests

🧪 tests/Aspire.Cli.Tests/Commands/GoAppHostToolingCheckTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Commands/InitCommandTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Commands/TypeScriptAppHostToolingCheckTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/ProgramTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Projects/DotNetBasedAppHostServerScaffoldCacheTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Scaffolding/ScaffoldingServiceTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Snapshots/InitCommandTests.InitCommand_Help_ShowsFileBasedOption.verified.txt (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Infrastructure.Tests/TestTriggerMap/TestTriggerMapTests.cs (changed test)
→ 1 directly: Infrastructure.Tests

Job reasons

Job Triggered by
cli-starter-validation affected project Aspire.Cli
extension-e2e • src/Aspire.Cli/Program.cs, src/Aspire.Cli/Projects/DotNetBasedAppHostServerProject.cs, src/Aspire.Cli/Resources/InitCommandStrings.Designer.cs, src/Aspire.Cli/Resources/InitCommandStrings.resx, src/Aspire.Cli/Resources/xlf/InitCommandStrings.cs.xlf, src/Aspire.Cli/Resources/xlf/InitCommandStrings.de.xlf, src/Aspire.Cli/Resources/xlf/InitCommandStrings.es.xlf, src/Aspire.Cli/Resources/xlf/InitCommandStrings.fr.xlf, src/Aspire.Cli/Resources/xlf/InitCommandStrings.it.xlf, src/Aspire.Cli/Resources/xlf/InitCommandStrings.ja.xlf, src/Aspire.Cli/Resources/xlf/InitCommandStrings.ko.xlf, src/Aspire.Cli/Resources/xlf/InitCommandStrings.pl.xlf, src/Aspire.Cli/Resources/xlf/InitCommandStrings.pt-BR.xlf, src/Aspire.Cli/Resources/xlf/InitCommandStrings.ru.xlf, src/Aspire.Cli/Resources/xlf/InitCommandStrings.tr.xlf, src/Aspire.Cli/Resources/xlf/InitCommandStrings.zh-Hans.xlf, src/Aspire.Cli/Resources/xlf/InitCommandStrings.zh-Hant.xlf, src/Aspire.Cli/Scaffolding/ScaffoldingService.cs, src/Aspire.Cli/Utils/EnvironmentChecker/GoAppHostToolingCheck.cs, src/Aspire.Cli/Utils/EnvironmentChecker/TypeScriptAppHostToolingCheck.cs
• affected project Aspire.Cli
polyglot affected project Aspire.Cli
typescript-api-compat affected project Aspire.Cli

Selection computed for commit 2e13c8a.

@mitchdenny

Copy link
Copy Markdown
Member Author

Approved for inclusion in release/17.0. Do not merge yet.

Jose Perez Rodriguez (joperezr) pushed a commit that referenced this pull request Nov 11, 2026
Backport of #21823 to release/17.0

/cc @IEvangelist

## Description

Standalone backport of Go AppHost CLI preview readiness fixes. Targets
`release/17.0` directly; the old chained backport #22002 is left
untouched.

Contributes to #21115, #21201, #21207, and #21208 without closing those
umbrella issues.

## Checklist

- Is this feature complete?
  - [x] Yes. Ready to ship.
  - [ ] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
  - [x] Yes
  - [ ] No
- Did you add public API?
  - [ ] Yes
    - If yes, did you have an API Review for it?
      - [ ] Yes
      - [ ] No
- Did you add `<remarks />` and `<code />` elements on your triple slash
comments?
      - [ ] Yes
      - [ ] No
  - [x] No
- Does the change make any security assumptions or guarantees?
  - [ ] Yes
    - If yes, have you done a threat model and had a security review?
      - [ ] Yes
      - [ ] No
  - [x] No

## Customer Impact

`aspire init` can initialize a Go AppHost inside an existing Go
repository without replacing its application module or workspace. The
change also corrects tooling checks and help, enables
documentation-response decompression, and prevents copied file-based C#
sources from entering subsequent dev-server compilations.

## Testing

Backport verification: the aggregate diff has the same stable patch ID
as merged source commit `8e264bfdae2931bd41a485f908887db997127984`:
`04b990263618ffbd44a817150577e5c356df6cdb`. The PR targets
`release/17.0` directly and has no native stack membership.

Source-PR validation, not rerun locally on this backport:

```powershell
dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj --no-restore --no-launch-profile -- --filter-class '*.GoAppHostToolingCheckTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'
```

Passed: 61 tests after the final guard-scope adjustment. The source also
records a combined CLI selection with 253 passed and TestTriggerMapTests
with 174 passed. The broader selector namespace run was not green on the
Windows host and is not counted as successful validation; details and
controls are recorded in #21823.

No local release-branch tests were rerun. Release-branch CI was pending
when this section was written; this is not a claim that backport CI has
passed.

## Risk

Medium. Touches shared scaffolding, tooling checks, HTTP clients, and
dev-server build inputs in addition to the Go-specific behavior.

## Regression?

Unknown. The source PR does not identify a regressing release.

---------

Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: David Pine <david.pine@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants