Skip to content

[release/17.0] Add Go AppHost initialization and stable restore E2E coverage - #21998

Closed
Mitch Denny (mitchdenny) wants to merge 1 commit into
release/17.0from
mitchdenny-backport-17-0-01-pr21806
Closed

Mitch Denny (mitchdenny) wants to merge 1 commit into
release/17.0from
mitchdenny-backport-17-0-01-pr21806

Conversation

@mitchdenny

Copy link
Copy Markdown
Member

Description

Backport of #21806 to release/17.0 (cherry-picked from 1b946a7 with no modifications). Layer 1 of 55 in the release/17.0 backport stack; based on release/17.0.

Backport recommendation: Yes — Test-only coverage for Go AppHost init/restore, which ship in 17.0 (17.0 milestone).

Backport of #21806

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

Adds focused Go AppHost E2E coverage for the initialization and
package-resolution gaps identified while reviewing the Preview
flag-removal PR.

- Extends SDK-refresh coverage to interactive init, non-interactive
`init --language go` in an empty directory, and non-interactive init
alongside an existing Go application. The brownfield case verifies
source preservation and wires the existing application through the
default Go integration.
- Builds and vets the consumer and explicitly vets the generated
`.aspire/modules` module, which Go's root `./...` traversal skips.
- Adds a separate stable-identity starter restore/build test with an
isolated NuGet cache, exact Go/Redis package pins, SDK regeneration, and
NuGet metadata assertions proving the packages came from the local hive.
- Retains normal-channel starter startup coverage and adds guaranteed
stop cleanup after resource assertions.

Contributes to #21108 and #21110; companion coverage for #21183. This
does not close either readiness issue or include the flag-removal
changes. Existing flag-setup calls are unchanged so #21183 can remove
them as planned.

### Execution lanes

Initialization, code generation, build/vet, and normal-channel startup
run in the existing regular CLI E2E lane. The stable restore/build test
requires a stable-shaped local-hive archive and explicitly skips
ordinary prerelease PR archives, matching the existing stable-emulation
tests. The stabilization job in `ci.yml` is currently hard-disabled;
this PR does not enable it or claim automated stable-release gating.

The existing runtime-package routes already cover Go, its generator,
Redis and SQL Server. The selector attributes the changed test files to
`Aspire.Cli.EndToEnd.Tests`; no map changes are required.

### Validation

| Command | Result |
| --- | --- |
| `.\restore.cmd` | Passed; reported existing dependency-advisory
warnings. |
| `dotnet build
tests\Aspire.Cli.EndToEnd.Tests\Aspire.Cli.EndToEnd.Tests.csproj
--no-restore -m:2 -v:quiet` | Passed, 0 warnings, 0 errors. |
| `dotnet test --project
tests\Aspire.Cli.EndToEnd.Tests\Aspire.Cli.EndToEnd.Tests.csproj
--no-launch-profile -- --filter-class "*.GoCodegenValidationTests"
--filter-class "*.GoStarterTemplateTests" --filter-not-trait
"quarantined=true" --filter-not-trait "outerloop=true"` | Initial run:
all three init/codegen cases and normal-channel startup passed. An
initially broader stable scenario failed at startup, after
restore/build/vet passed, because the PR-stamped binary requested its
original prerelease SDK from nuget.org. Stable restore/build is now a
separate test, scoped to the requested package-resolution coverage. |
| `dotnet test --project
tests\Aspire.Cli.EndToEnd.Tests\Aspire.Cli.EndToEnd.Tests.csproj
--no-launch-profile -- --filter-method
"*.RestoreAndBuildGoStarterFromStablePackages" --filter-not-trait
"quarantined=true" --filter-not-trait "outerloop=true"` | Passed, 1
test, 0 skipped, against the final stable restore/build scenario. |
| `.\localhive.ps1 -Version 17.0.99 -Output .\artifacts\go-stable-e2e
-Rid linux-x64 -Archive` | Blocked by NU5104 for stable component
packages depending on preview .NET 11 packages. The pack excludes the
changed test project. A consumer-only retry with `$env:NoWarn='NU5104'`
packed the packages, then hit Windows-to-Linux NativeAOT dashboard
publishing restrictions. No warning suppression or build-policy changes
are committed. |
| `git diff --check` | Passed. |

For the Docker executions,
`ASPIRE_E2E_POLYGLOT_GO_IMAGE=aspire-go-e2e-6972:latest` selected an
existing Go 1.26.10 image. `ASPIRE_E2E_ARCHIVE` pointed to a consumer
archive assembled from the approved #21183 native CLI (`ecee5b208e`) and
real `17.0.99` packages built from this worktree. This validates the
consumer scenarios, not a fully rebuilt stable native bundle or
stable-identity startup. Linux stable-hive reproduction commands are
documented in `docs/contributing.md`.

## 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 1b946a7)
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21998

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21998"

@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

1 / 101 PR test projects · 0 PR jobs, from 4 changed files.

Selected PR test projects (1 / 101)

Aspire.Cli.EndToEnd.Tests

Selected PR jobs (0)

none


How these were chosen — grouped by what changed

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

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

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

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

Job reasons

none


Selection computed for commit 7a0e262.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the test-only Go AppHost coverage backport.

No open issues 🎉

What changed in this PR

Backports #21806 to release/17.0, adding test-only coverage for Go AppHost initialization, SDK regeneration, and stable-package resolution.

Changes:

  • Covers interactive and non-interactive initialization, including preserving an existing Go application, with build and vet checks.
  • Adds stable-identity restore coverage with an isolated NuGet cache and local-hive source assertions, while retaining normal-channel startup coverage.
  • Documents stable-archive prerequisites and execution limits; ordinary prerelease archives skip the stable test.
File Description
tests/​Aspire.Cli.EndToEnd.Tests/​Helpers/​CliInstallStrategyTests.cs Tests stable-version detection from local-hive archive entries.
tests/​Aspire.Cli.EndToEnd.Tests/​Helpers/​CliE2ETestHelpers.cs Adds stable-version discovery within local-hive archives.
tests/​Aspire.Cli.EndToEnd.Tests/​GoStarterTemplateTests.cs Adds stable restore/build checks and cleanup after startup assertions.
tests/​Aspire.Cli.EndToEnd.Tests/​GoCodegenValidationTests.cs Expands initialization, source-preservation, and build/vet coverage.
docs/​contributing.md Documents Go E2E scenarios, archive prerequisites, and execution commands.

Review effort: Balanced

@mitchdenny
Mitch Denny (mitchdenny) marked this pull request as ready for review November 10, 2026 04:05
@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
…overage (#22114)

## Description

Backport of #21806 to `release/17.0`, protecting Go AppHost
initialization, source preservation, generated SDK build/vet, and stable
restore package provenance. Test and contributing-documentation changes
only; no production behavior change.

This standalone replacement for closed #21998 cherry-picks the exact
final merged squash `1b946a70114eaf152778109bd0b86df19ae47006` with `git
cherry-pick -x`, without conflicts or adaptations, directly onto release
tip `cec195f2d0bf3f1d714badf74f205fa855fdf963`. It has no stack or PR
dependencies. It does not reopen or modify the previous stack, retry the
bot, merge, or enable auto-merge.

Relates to #21108 and #21110; neither issue is closed by this PR.

## 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

Adds coverage protecting Go AppHost initialization, existing application
source preservation, generated SDK build/vet, and stable-package restore
provenance. No production behavior change.

## Testing

### Release-branch validation performed for this PR

| Exact command | Result |
| --- | --- |
| `.\restore.cmd` | Passed (exit 0); dependency-advisory warnings
reported. |
| `dotnet build
tests\Aspire.Cli.EndToEnd.Tests\Aspire.Cli.EndToEnd.Tests.csproj
--no-restore -m:2 -v:quiet` | Passed; 0 warnings, 0 errors. |
| `dotnet test --project
tests\Aspire.Cli.EndToEnd.Tests\Aspire.Cli.EndToEnd.Tests.csproj
--no-launch-profile -- --filter-class '*.CliInstallStrategyTests'
--filter-not-trait 'quarantined=true' --filter-not-trait
'outerloop=true'` | Passed: 72 succeeded, 0 failed, 0 skipped. Tests the
changed archive/stable-version helpers without Docker. |
| `git diff --check upstream/release/17.0 HEAD` | Passed. |
| `git diff --binary 1b946a7^
1b946a7` compared with `git diff
--binary upstream/release/17.0 HEAD` | Exact diff text identical; all
five changed files also have identical source/backport Git blob IDs. |
| `git diff 1b946a7^
1b946a7 \| git patch-id --stable`
compared with `git diff upstream/release/17.0 HEAD \| git patch-id
--stable` | Matching patch ID:
`6dedbdbd911c022351e03d7b8fba822692d43b33`. |
| `git status --porcelain=v1` | Clean after validation; no accepted
snapshot drift. |

Release runtime validation of `GoCodegenValidationTests` /
`GoStarterTemplateTests` was **not run**: no `ASPIRE_E2E_ARCHIVE` is
configured and no existing archive is present under this worktree's
artifacts. No local-hive or native AOT build was initiated. The stable
restore case additionally requires a stable-shaped local-hive archive.
These runtime scenarios are not claimed as passed or as automated
stable-release gating.

### Source PR evidence only (not release-branch validation)

Source #21806 records a clean E2E-project build, passing
initialization/codegen and normal-channel startup cases, and one passing
stable restore/build case. Full stable native-bundle build/startup was
not validated.

| Exact source command | Source result |
| --- | --- |
| `.\restore.cmd` | Passed with dependency-advisory warnings. |
| `dotnet build
tests\Aspire.Cli.EndToEnd.Tests\Aspire.Cli.EndToEnd.Tests.csproj
--no-restore -m:2 -v:quiet` | Passed; 0 warnings, 0 errors. |
| `dotnet test --project
tests\Aspire.Cli.EndToEnd.Tests\Aspire.Cli.EndToEnd.Tests.csproj
--no-launch-profile -- --filter-class "*.GoCodegenValidationTests"
--filter-class "*.GoStarterTemplateTests" --filter-not-trait
"quarantined=true" --filter-not-trait "outerloop=true"` | Source initial
run: three initialization/codegen cases and normal-channel startup
passed. An initially broader stable scenario failed at startup after
restore/build/vet passed; the final patch separates stable restore/build
from startup. Not a claim of a final all-green class run. |
| `dotnet test --project
tests\Aspire.Cli.EndToEnd.Tests\Aspire.Cli.EndToEnd.Tests.csproj
--no-launch-profile -- --filter-method
"*.RestoreAndBuildGoStarterFromStablePackages" --filter-not-trait
"quarantined=true" --filter-not-trait "outerloop=true"` | Source final
stable restore/build case passed: 1 succeeded, 0 skipped, with a special
consumer archive using the approved #21183 native CLI and real 17.0.99
packages. This setup is not available in this release worktree. |
| `.\localhive.ps1 -Version 17.0.99 -Output .\artifacts\go-stable-e2e
-Rid linux-x64 -Archive` | Source full stable archive attempt was
blocked by NU5104; a consumer-only retry then hit Windows-to-Linux
NativeAOT restrictions. No warning suppression or build-policy changes
are included. |

## Risk

Low, test-only changes, with possible effects limited to E2E execution.

## Regression?

Unknown; source 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants