Skip to content

Fix internal build break: 'aspire-managed --help' in CLI archive verifier returns exit 1 - #17341

Merged
David Fowler (davidfowl) merged 1 commit into
microsoft:mainfrom
radical:radical/fix-verify-cli-archive-aspire-managed-help
May 21, 2026
Merged

David Fowler (davidfowl) merged 1 commit into
microsoft:mainfrom
radical:radical/fix-verify-cli-archive-aspire-managed-help

Conversation

@radical

Copy link
Copy Markdown
Member

The signed build+sign pipeline (microsoft-aspire, definition 1602) started failing on main in all three RIDs (osx-arm64, linux-x64, win-x64) right after #17274 merged. The new 🟣Verify CLI archive step fails with:

❌ Verification failed: aspire-managed failed with exit code 1. Output: Usage: aspire-managed <dashboard|server|nuget> [args...]

See https://dev.azure.com/dnceng/internal/_build/results?buildId=2980569.

Root cause

eng/scripts/verify-cli-archive.ps1 smoke-tests the bundled server with aspire-managed --help and asserts exit 0. But Aspire.Managed's entry point is a hard args switch on dashboard|server|nuget; anything else — including --help — falls through to ShowUsage(), which prints the usage banner to stderr and returns 1 (src/Aspire.Managed/Program.cs:22-28,58-62). So the assertion was guaranteed to fail against the real binary.

The bug was not caught pre-merge because the AzDO build+sign pipeline doesn't run on GitHub PRs (it's the post-merge signed pipeline), and the acquisition test added alongside the verifier uses a synthetic fake archive whose aspire-managed doesn't share the real binary's exit behavior.

Fix

Invoke aspire-managed nuget --help instead. The nuget subcommand dispatches through System.CommandLine's RootCommand, which adds --help automatically and returns 0 — so it both smoke-tests the NativeAOT-compiled CommandLine path and satisfies the verifier's exit-code assertion. The Aspire.Managed binary itself is unchanged.

Surprises

None. No behavior change for users of the shipped CLI; only the post-merge verifier script changes.

… exit 0

The signed build+sign pipeline (microsoft-aspire, definition 1602) started
failing on main in all three RIDs (osx-arm64, linux-x64, win-x64) right
after microsoft#17274 merged. The new "Verify CLI archive" step fails with:

    Verification failed: aspire-managed failed with exit code 1.
    Output: Usage: aspire-managed <dashboard|server|nuget> [args...]

verify-cli-archive.ps1 smoke-tested the bundled server with
`aspire-managed --help` and asserted exit 0, but Aspire.Managed's entry
point is a hard `args switch` on dashboard|server|nuget; anything else --
including --help -- falls through to ShowUsage(), which writes the usage
banner to stderr and returns 1 (src/Aspire.Managed/Program.cs:22-28,58-62).
So the assertion was guaranteed to fail against the real binary.

Not caught pre-merge because the AzDO build+sign pipeline doesn't run on
GitHub PRs (it's the post-merge signed pipeline), and the acquisition test
added alongside the verifier uses a synthetic fake archive whose
aspire-managed doesn't share the real binary's exit behavior.

Invoke `aspire-managed nuget --help` instead. The nuget subcommand
dispatches through System.CommandLine's RootCommand, which adds --help
automatically and returns 0 -- so it both smoke-tests the NativeAOT-
compiled CommandLine path and satisfies the verifier's exit-code
assertion. The Aspire.Managed binary itself is unchanged.

Co-authored-by: Copilot <[email protected]>
@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 -- 17341

Or

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

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.

Pull request overview

Fixes a post-merge internal signed pipeline build break by updating the CLI archive verifier’s smoke test to invoke aspire-managed in a way that correctly returns exit code 0 for --help, matching the real binary’s command dispatch behavior.

Changes:

  • Update verify-cli-archive.ps1 to run aspire-managed nuget --help (instead of aspire-managed --help) so the smoke test uses a valid top-level subcommand and gets a successful help exit code.
  • Add explanatory comments documenting why top-level --help fails and why nuget --help is the appropriate verification target.

@davidfowl
David Fowler (davidfowl) merged commit 72888db into microsoft:main May 21, 2026
304 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.4 milestone May 21, 2026
@radical
Ankit Jain (radical) deleted the radical/fix-verify-cli-archive-aspire-managed-help branch May 21, 2026 04:32
Ankit Jain (radical) added a commit to radical/aspire that referenced this pull request May 21, 2026
verify-cli-archive.ps1 only runs in the post-merge AzDO build+sign
pipeline (never on GitHub PRs), so regressions in its contract surface
days late. The recent microsoft#17274 -> microsoft#17341 -> microsoft#17345 chain is the case in
point: the verifier was broken on main for hours before anyone noticed.

Add a synthetic-archive E2E test that exercises the verifier's current
contract in GitHub CI against a fake `aspire` binary, with no real CLI,
no bundle, and no network access:

- VerifyCliArchive_AcceptsCleanPerRidArchive: per-RID archive with the
  fake `aspire` mock handles `aspire --version` and `aspire new
  aspire-starter`; asserts the verifier exits 0 and emits the expected
  per-step success lines.

- VerifyCliArchive_RejectsArchiveWithStraySidecar: per-RID archive
  containing a stray `.aspire-install.json`; asserts the verifier
  exits non-zero with the user-facing error text from
  Test-ArchiveSidecar. This is the contract from microsoft#16817 that the
  verifier was originally written to enforce.

Adds FakeArchiveHelper.CreateFakeVerifyArchiveAsync to produce these
archives. Pre-existing CreateFakeArchiveAsync stays as-is so the
install-script tests are unaffected. Unix-only because the fake aspire
mock is a bash script.

Co-authored-by: Copilot <[email protected]>
Ankit Jain (radical) added a commit that referenced this pull request May 21, 2026
…erifier checks, add GitHub-CI coverage, fix latent sidecar-scope bug (#17346)

* Remove failing TypeScript starter and bundle-layout checks from CLI archive verifier

The signed build+sign pipeline (microsoft-aspire, definition 1602) is
broken on main since #17274 merged. Two checks added by that PR fail in
the 1ES signed-build agent -- the only environment that actually runs
verify-cli-archive.ps1 against the real signed archive:

1. Test-TypeScriptStarterProject runs `aspire new aspire-ts-starter`,
   whose packager-managed AppHost bootstrap performs a NuGet restore
   that resolves transitive deps (Microsoft.Extensions.*, Grpc.*,
   OpenTelemetry.*, etc.) to https://api.nuget.org/v3/index.json. The
   signed-build agent has no public-internet egress and the restore
   fails with `Permission denied (api.nuget.org:443)`.

2. Test-ExtractedBundleLayout's file assertions only succeed when the
   prior TypeScript starter step has triggered the AppHost server
   bootstrap and extracted ~/.aspire/bundle. The C# starter doesn't
   exercise that path. With the TS starter removed there's no trigger
   for the bundle layout to be populated, and its embedded
   `aspire-managed --help` smoke call returns exit 1 by design (the
   binary's top-level dispatch is dashboard|server|nuget; anything
   else falls through to ShowUsage()).

This is the same class of regression as the earlier `aspire-managed
--help` failure in the same script: the verifier doesn't run on
GitHub PRs and only fires in the post-merge build+sign pipeline, so
the incompatibility wasn't caught pre-merge.

Surgical removal of the failing pieces:

- Drop Test-TypeScriptStarterProject (function + call site).
- Drop Test-ExtractedBundleLayout (function + call site).
- Drop tests/Aspire.Acquisition.Tests/Scripts/VerifyCliArchivePowerShellTests.cs,
  which only covered the removed functions.
- Drop CreateFakeBundleArchiveAsync and CreateFakeCliScript additions
  from FakeArchiveHelper.cs, which had no other consumers.
- Drop the unused ScriptPaths.VerifyCliArchivePowerShell entry.

Keep all the orthogonal infrastructure #17274 added so it can be
reused when the TS check returns:

- Helpers Get-ExecutableFileName, Get-ArchiveRoot, Get-ArchiveRidFamily.
- Refactored Test-CSharpStarterProject function (functionally equivalent
  to the pre-#17274 inline C# starter check).
- Test-ArchiveSidecar's use of Get-ArchiveRidFamily.
- aspireBin discovery via Get-ArchiveRoot.

The script header's step list is updated to match what now runs.

Re-adding the TS coverage will require either an internal NuGet mirror
config the agent can reach (e.g. dropping a NuGet.config that maps
* -> dotnet-public into the temp project root before `aspire new`),
or a way to skip the auto-restore on `aspire new aspire-ts-starter`.
Tracked in #17345.

Co-authored-by: Copilot <[email protected]>

* Add slim GitHub-CI coverage for verify-cli-archive.ps1

verify-cli-archive.ps1 only runs in the post-merge AzDO build+sign
pipeline (never on GitHub PRs), so regressions in its contract surface
days late. The recent #17274 -> #17341 -> #17345 chain is the case in
point: the verifier was broken on main for hours before anyone noticed.

Add a synthetic-archive E2E test that exercises the verifier's current
contract in GitHub CI against a fake `aspire` binary, with no real CLI,
no bundle, and no network access:

- VerifyCliArchive_AcceptsCleanPerRidArchive: per-RID archive with the
  fake `aspire` mock handles `aspire --version` and `aspire new
  aspire-starter`; asserts the verifier exits 0 and emits the expected
  per-step success lines.

- VerifyCliArchive_RejectsArchiveWithStraySidecar: per-RID archive
  containing a stray `.aspire-install.json`; asserts the verifier
  exits non-zero with the user-facing error text from
  Test-ArchiveSidecar. This is the contract from #16817 that the
  verifier was originally written to enforce.

Adds FakeArchiveHelper.CreateFakeVerifyArchiveAsync to produce these
archives. Pre-existing CreateFakeArchiveAsync stays as-is so the
install-script tests are unaffected. Unix-only because the fake aspire
mock is a bash script.

Co-authored-by: Copilot <[email protected]>

* Fix Test-ArchiveSidecar scope and pin the regression with a test

Test-ArchiveSidecar was called with $archiveRoot (the directory
Get-ArchiveRoot picks out as the binary's home), not $extractDir (the
true extraction directory). When a per-RID archive nests its binary
under a single sub-directory (e.g. {.aspire-install.json, payload/aspire}),
Get-ArchiveRoot returns the sub-directory, and the sidecar scan only
recurses into that sub-directory -- missing a stray .aspire-install.json
at the actual archive root.

The sidecar contract from #16817 ("per-RID archives are shared across
install routes; each route authors its own sidecar after extraction")
is about the archive, not whichever directory happens to hold the
binary. Scan the full extraction directory instead.

Latent bug only -- today's signed archives put `aspire` at the
extraction root, so Get-ArchiveRoot returns $extractDir unchanged and
the scope-narrowing didn't matter in practice. A producer-side
refactor that introduced a top-level directory would have silently
hidden a contract violation.

Add VerifyCliArchive_RejectsStraySidecarWhenBinaryIsNestedUnderSubdirectory
to pin the fix: it builds an archive with the binary nested under
`payload/` and a stray sidecar at the archive root, and asserts the
verifier rejects it. Without the script fix the verifier accepts the
archive; with it the test passes. CreateFakeVerifyArchiveAsync gains
a nestAspireUnderSubdir parameter so the same helper covers both the
binary-at-root and binary-in-subdir shapes Get-ArchiveRoot has to
handle.

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants