Repository navigation
Validate TypeScript CLI archive layout - #17274
Conversation
Extend the shipped CLI archive verifier to assert the bundled AppHost server layout and exercise the TypeScript starter output. Add acquisition test coverage with a synthetic bundle-shaped archive so the PowerShell verifier can be run without signed shipping artifacts. Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Pull request overview
Extends the CLI archive verifier (eng/scripts/verify-cli-archive.ps1) to validate bundle layout (managed AppHost server, dashboard wwwroot, DCP) and the TypeScript starter flow against shipped archives, plus adds a test that exercises the script end-to-end using a synthetic bundle-shaped archive.
Changes:
- Add
Test-BundleLayout,Test-CSharpStarterProject,Test-TypeScriptStarterProject, and supporting helpers (Get-ArchiveRoot,Get-ArchiveRidFamily,Get-ExecutableFileName) to the verifier and wire them into the main flow. - Extend
FakeArchiveHelperwithCreateFakeBundleArchiveAsyncthat produces a bundle-shaped archive (CLI stub,managed/aspire-managed,managed/wwwroot,dcp/dcp) plus mock CLI/managed/DCP scripts emulatingaspire newfor both starters. - Add
VerifyCliArchivePowerShellTests(non-Windows) and aScriptPaths.VerifyCliArchivePowerShellentry to drive the script against the synthetic archive.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| eng/scripts/verify-cli-archive.ps1 | Adds bundle-layout validation, TypeScript starter step, and archive-root discovery helpers. |
| tests/Aspire.Acquisition.Tests/Scripts/Common/FakeArchiveHelper.cs | Adds synthetic bundle-shaped archive builder with mock CLI/managed/DCP scripts. |
| tests/Aspire.Acquisition.Tests/Scripts/Common/ScriptPaths.cs | Registers verify-cli-archive.ps1 path for tests. |
| tests/Aspire.Acquisition.Tests/Scripts/VerifyCliArchivePowerShellTests.cs | New end-to-end test invoking the verifier against the synthetic archive. |
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17274Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17274" |
Use switch output directly in Get-ArchiveRidFamily so verify-cli-archive.ps1 parses under pwsh in CI. Co-authored-by: Copilot <[email protected]>
PR Testing ReportPR Information
CLI Version Verification
Changes AnalyzedThe PR updates Test Scenarios ExecutedScenario 1: Dogfood CLI install and version checkObjective: Verify the PR dogfood artifact is available and corresponds to the current PR head. Result: Passed Evidence:
Scenario 2: CI archive layout check against new verification expectationsObjective: Compare the actual Result: Failed Expected by the updated script:
Observed in the downloaded CI archive: I downloaded The post-install dogfood Scenario 3: C# starter creationObjective: Verify the PR CLI can still create the C# starter covered by the verification script. Steps:
Result: Passed Scenario 4: TypeScript starter creation and generated SDK layoutObjective: Verify the PR CLI can create the TypeScript starter output that the updated verification script checks. Steps:
Result: Passed Summary
Overall ResultIssue found. The PR CLI can create both C# and TypeScript starter projects, but the actual |
Move bundle layout verification from the archive root to the post-TypeScript-starter extracted bundle root. The native CLI archive embeds the bundle payload in the executable, so managed and DCP assets should be asserted after extraction rather than as sibling archive entries. Co-authored-by: Copilot <[email protected]>
…alidate-cli-bundle-layout # Conflicts: # tests/Aspire.Acquisition.Tests/Scripts/Common/ScriptPaths.cs
|
❓ CLI E2E Tests unknown — 96 passed, 0 failed, 2 unknown (commit View all recordings
📹 Recordings uploaded automatically from CI run #26197825129 |
|
✅ No documentation update needed. docs_optional → No triggered signals ( All 4 changed files are under
These are internal CI/test changes with no new public API, CLI flags, configuration keys, or user-facing behavior changes. No documentation update is needed. |
* Validate TypeScript CLI archive layout Extend the shipped CLI archive verifier to assert the bundled AppHost server layout and exercise the TypeScript starter output. Add acquisition test coverage with a synthetic bundle-shaped archive so the PowerShell verifier can be run without signed shipping artifacts. Co-authored-by: Copilot <[email protected]> * Fix archive verifier PowerShell syntax Use switch output directly in Get-ArchiveRidFamily so verify-cli-archive.ps1 parses under pwsh in CI. Co-authored-by: Copilot <[email protected]> * Validate extracted CLI bundle layout Move bundle layout verification from the archive root to the post-TypeScript-starter extracted bundle root. The native CLI archive embeds the bundle payload in the executable, so managed and DCP assets should be asserted after extraction rather than as sibling archive entries. Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
… exit 0 (#17341) 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...] 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]>
…rchive verifier The signed build+sign pipeline (microsoft-aspire, definition 1602) is broken on main since microsoft#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 microsoft#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-microsoft#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 microsoft#17345. Co-authored-by: Copilot <[email protected]>
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]>
…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]>
…7646) The signed-build verifier ran 'aspire new aspire-starter' after extracting the CLI archive, claiming to exercise 'template engine + bundle self-extraction without requiring a NuGet restore'. That claim was wrong: 'aspire new' resolves template versions via TemplateNuGetConfigService.ResolveTemplatePackageAsync, which always queries a NuGet feed. The step only ever succeeded on release branches because builds were mis-baked with AspireCliChannel=stable, which routed the implicit identity-channel lookup to nuget.org and found a previously-shipped Aspire.ProjectTemplates version. Once #17528 corrected the release-branch builds to bake AspireCliChannel=staging, the identity channel switched to a staging feed that is not reachable from the 1ES signed-build agent, and the step started failing with 'No template versions were found' in the internal build pipeline. This is the same egress reason the TypeScript starter check was already removed for (#17274, tracked in #17345). Re-adding meaningful starter coverage in the signed-build verifier requires either an internal NuGet mirror or a no-network template path. Drop the step (and the corresponding test assertion); the verifier still covers archive layout, sidecar contract, and 'aspire --version' execution. Co-authored-by: Copilot <[email protected]>
Description
The shipped CLI archive verifier only exercised the C# starter path, so it could miss archive layout problems that break TypeScript AppHosts. This change extends the verifier to assert the bundled AppHost server layout directly and to run the TypeScript starter flow against the extracted archive.
The verifier now checks for the managed AppHost server, dashboard web assets, and DCP in the extracted CLI archive before installing the CLI, then validates both
aspire-starterandaspire-ts-starteroutput. The acquisition test uses a synthetic bundle-shaped archive so the PowerShell script can be tested end-to-end without requiring signed shipping artifacts.Fixes: #17040
Checklist
<remarks />and<code />elements on your triple slash comments?