Skip to content

Validate TypeScript CLI archive layout - #17274

Merged
Sébastien Ros (sebastienros) merged 4 commits into
mainfrom
sebros/validate-cli-bundle-layout
May 21, 2026
Merged

Sébastien Ros (sebastienros) merged 4 commits into
mainfrom
sebros/validate-cli-bundle-layout

Conversation

@sebastienros

Copy link
Copy Markdown
Contributor

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-starter and aspire-ts-starter output. 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

  • 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

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]>
Copilot AI review requested due to automatic review settings May 19, 2026 21:19

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

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 FakeArchiveHelper with CreateFakeBundleArchiveAsync that produces a bundle-shaped archive (CLI stub, managed/aspire-managed, managed/wwwroot, dcp/dcp) plus mock CLI/managed/DCP scripts emulating aspire new for both starters.
  • Add VerifyCliArchivePowerShellTests (non-Windows) and a ScriptPaths.VerifyCliArchivePowerShell entry 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.

@github-actions

github-actions Bot commented May 19, 2026 •

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

Or

  • Run remotely in PowerShell:
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]>
@IEvangelist

David Pine (IEvangelist) commented May 20, 2026 •

Copy link
Copy Markdown
Member

PR Testing Report

PR Information

CLI Version Verification

  • Expected commit: e3b4f39f68a359153587f5d4cc8bf933d65fb6b0
  • Installed CLI: 13.4.0-pr.17274.ge3b4f39f
  • Status: Passed - the dogfood CLI matched the PR head commit suffix.

Changes Analyzed

The PR updates eng/scripts/verify-cli-archive.ps1 to validate bundle layout assets and TypeScript starter output, and adds acquisition tests/fakes for that script.

Test Scenarios Executed

Scenario 1: Dogfood CLI install and version check

Objective: 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 expectations

Objective: Compare the actual cli-native-archives-win-x64 artifact with the bundle assets now required by verify-cli-archive.ps1.

Result: Failed

Expected by the updated script:

  • managed\aspire-managed.exe
  • non-empty managed\wwwroot dashboard assets
  • dcp\dcp.exe

Observed in the downloaded CI archive:
ext aspire.exe Aspire.TypeSystem.xml libsodium.dll

I downloaded cli-native-archives-win-x64 from workflow run https://github.com/microsoft/aspire/actions/runs/26128901539 and inspected aspire-cli-win-x64-13.4.0-pr.17274.ge3b4f39f.zip. It did not contain managed\aspire-managed.exe, managed\wwwroot, or dcp\dcp.exe.

The post-install dogfood bin directory had the same shape:
ext .aspire-install.json aspire.exe Aspire.TypeSystem.xml libsodium.dll

Scenario 3: C# starter creation

Objective: Verify the PR CLI can still create the C# starter covered by the verification script.

Steps:

  1. Ran aspire new aspire-starter --name VerifyApp --output <temp> --non-interactive --nologo --suppress-agent-init.
  2. Verified VerifyApp.AppHost was created.

Result: Passed

Scenario 4: TypeScript starter creation and generated SDK layout

Objective: Verify the PR CLI can create the TypeScript starter output that the updated verification script checks.

Steps:

  1. Ran aspire new aspire-ts-starter --name VerifyTsApp --output <temp> --non-interactive --nologo --suppress-agent-init.
  2. Verified expected files including apphost.ts, aspire.config.json, .modules\aspire.ts, frontend\src\main.tsx, and api\src\index.ts.

Result: Passed

Summary

Scenario Status Notes
Dogfood CLI install/version check Passed Artifact version matched PR head commit suffix.
CI archive layout check Failed Required managed and dcp bundle layout assets were absent from the actual downloaded archive.
C# starter creation Passed VerifyApp.AppHost was created.
TypeScript starter creation Passed TypeScript starter and .modules SDK layout were created.

Overall Result

Issue found. The PR CLI can create both C# and TypeScript starter projects, but the actual cli-native-archives-win-x64 artifact does not include the managed and dcp directories that the updated archive verification script now requires.

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
@sebastienros
Sébastien Ros (sebastienros) merged commit 3c3f910 into main May 21, 2026
598 of 603 checks passed
@sebastienros
Sébastien Ros (sebastienros) deleted the sebros/validate-cli-bundle-layout branch May 21, 2026 01:05
@github-actions github-actions Bot added this to the 13.4 milestone May 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

❓ CLI E2E Tests unknown — 96 passed, 0 failed, 2 unknown (commit 2acf51c)

View all recordings
Status Test Recording
✅ AddPackageInteractiveWhileAppHostRunningDetached ✅ ▶️ View recording
✅ AddPackageWhileAppHostRunningDetached ✅ ▶️ View recording
✅ AgentCommands_AllHelpOutputs_AreCorrect ✅ ▶️ View recording
✅ AgentInitCommand_DefaultSelection_InstallsDefaultSkills ✅ ▶️ View recording
✅ AgentInitCommand_MigratesDeprecatedConfig ✅ ▶️ View recording
✅ AllPublishMethodsBuildDockerImages ✅ ▶️ View recording
✅ AspireAddPackageVersionToDirectoryPackagesProps ✅ ▶️ View recording
✅ AspireInitSingleFileAppHostRunsViaDotnetRunAppHost ✅ ▶️ View recording
✅ AspireInitWithExistingAppHostDirRecreatesMissingNuGetConfigAndPreservesFiles ✅ ▶️ View recording
❔ AspireInitWithSolutionFileGeneratesAppHostThatBuildsAgainstChannelHive ❔ ▶️ View recording
✅ AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ✅ ▶️ View recording
✅ AspireUpdateRemovesOrphanAppHostPackageVersionWhenSdkAlreadyCurrent ✅ ▶️ View recording
✅ Banner_DisplayedOnFirstRun ✅ ▶️ View recording
✅ Banner_DisplayedWithExplicitFlag ✅ ▶️ View recording
✅ Banner_NotDisplayedWithNoLogoFlag ✅ ▶️ View recording
✅ CertificatesClean_RemovesCertificates ✅ ▶️ View recording
✅ CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate ✅ ▶️ View recording
✅ CertificatesTrust_WithUntrustedCert_TrustsCertificate ✅ ▶️ View recording
✅ ConfigSetGet_CreatesNestedJsonFormat ✅ ▶️ View recording
✅ CreateAndRunAspireStarterProject ✅ ▶️ View recording
✅ CreateAndRunAspireStarterProjectWithBundle ✅ ▶️ View recording
✅ CreateAndRunEmptyAppHostProject ✅ ▶️ View recording
✅ CreateAndRunJavaEmptyAppHostProject ✅ ▶️ View recording
✅ CreateAndRunJsReactProject ✅ ▶️ View recording
✅ CreateAndRunPythonReactProject ✅ ▶️ View recording
✅ CreateAndRunTypeScriptEmptyAppHostProject ✅ ▶️ View recording
✅ CreateAndRunTypeScriptStarterProject ✅ ▶️ View recording
✅ CreateJavaAppHostWithViteApp ✅ ▶️ View recording
✅ CreateTypeScriptAppHostWithViteApp_UsesConfiguredToolchain ✅ ▶️ View recording
✅ DashboardRunWithOtelTracesReturnsNoTraces ✅ ▶️ View recording
✅ DeployK8sBasicApiService ✅ ▶️ View recording
✅ DeployK8sWithExternalHelmChart ✅ ▶️ View recording
✅ DeployK8sWithGarnet ✅ ▶️ View recording
✅ DeployK8sWithMongoDB ✅ ▶️ View recording
✅ DeployK8sWithMySql ✅ ▶️ View recording
✅ DeployK8sWithPostgres ✅ ▶️ View recording
✅ DeployK8sWithRabbitMQ ✅ ▶️ View recording
✅ DeployK8sWithRedis ✅ ▶️ View recording
✅ DeployK8sWithSqlServer ✅ ▶️ View recording
✅ DeployK8sWithValkey ✅ ▶️ View recording
✅ DeployTypeScriptAppToKubernetes ✅ ▶️ View recording
✅ DescribeCommandResolvesReplicaNames ✅ ▶️ View recording
✅ DescribeCommandShowsRunningResources ✅ ▶️ View recording
✅ DetachFormatJsonProducesValidJson ✅ ▶️ View recording
✅ DetachFormatJsonProducesValidJsonWhenRestartingExistingInstance ✅ ▶️ View recording
✅ DoListStepsShowsPipelineSteps ✅ ▶️ View recording
✅ DocsCommand_RendersInteractiveMarkdownFromLocalSource ✅ ▶️ View recording
✅ DoctorCommand_DetectsDeprecatedAgentConfig ✅ ▶️ View recording
✅ DoctorCommand_TypeScriptAppHostReportsMissingConfiguredToolchain ✅ ▶️ View recording
✅ DoctorCommand_WithSslCertDir_ShowsTrusted ✅ ▶️ View recording
✅ DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ✅ ▶️ View recording
✅ GeneratedAspireDevScript_StartsWatchMode_WithConfiguredToolchain ✅ ▶️ View recording
✅ GlobalMigration_HandlesCommentsAndTrailingCommas ✅ ▶️ View recording
✅ GlobalMigration_HandlesMalformedLegacyJson ✅ ▶️ View recording
✅ GlobalMigration_PreservesAllValueTypes ✅ ▶️ View recording
✅ GlobalMigration_SkipsWhenNewConfigExists ✅ ▶️ View recording
✅ GlobalSettings_MigratedFromLegacyFormat ✅ ▶️ View recording
✅ InitTypeScriptAppHost_AugmentsExistingViteRepoAtRoot ✅ ▶️ View recording
✅ InteractiveCSharpInitCreatesExpectedFiles ✅ ▶️ View recording
✅ InvalidAppHostPathWithComments_IsHealedOnRun ✅ ▶️ View recording
✅ JavaScriptHostingApisRunFromTypeScriptAppHost ✅ ▶️ View recording
✅ LatestCliCanStartStableChannelAppHost ✅ ▶️ View recording
✅ LatestCliCanStartStableChannelTypeScriptAppHost ✅ ▶️ View recording
✅ LegacySettingsMigration_AdjustsRelativeAppHostPath ✅ ▶️ View recording
✅ LogLevelTrace_ProducesTraceEntriesInCliLogFile ✅ ▶️ View recording
✅ LogsCommandShowsResourceLogs ✅ ▶️ View recording
✅ OtelLogsReturnsStructuredLogsFromStarterApp ✅ ▶️ View recording
✅ OtelLogsReturnsStructuredLogsFromStarterAppIsolated ✅ ▶️ View recording
✅ PsCommandListsRunningAppHost ✅ ▶️ View recording
✅ PsFormatJsonOutputsOnlyJsonToStdout ✅ ▶️ View recording
✅ PublishJavaScriptPatternsGeneratesExpectedDockerComposeArtifacts ✅ ▶️ View recording
✅ PublishWithConfigureEnvFileUpdatesEnvOutput ✅ ▶️ View recording
✅ PublishWithDockerComposeServiceCallbackSucceeds ✅ ▶️ View recording
✅ PublishWithoutOutputPathUsesAppHostDirectoryDefault ✅ ▶️ View recording
✅ ResourceCommand_FailedExecution_DisplaysAppHostLogPathAndLogContainsEntries ✅ ▶️ View recording
✅ ResourceCommand_FailsWhenInteractionServiceIsRequired ✅ ▶️ View recording
✅ ResourceCommand_SetAndDeleteParameterUpdatesDescribeOutput ✅ ▶️ View recording
✅ RestoreGeneratesSdkFiles ✅ ▶️ View recording
✅ RestoreGeneratesSdkFiles_WithConfiguredToolchain ✅ ▶️ View recording
✅ RestoreRefreshesGeneratedSdkAfterAddingIntegration ✅ ▶️ View recording
✅ RestoreSupportsConfigOnlyHelperPackageAndCrossPackageTypes ✅ ▶️ View recording
✅ RunFromParentDirectory_UsesExistingConfigNearAppHost ✅ ▶️ View recording
❔ RunPublishFailureScenarioAsync ❔ ▶️ View recording
✅ RunReportsSyntaxErrorsForDotNetAppHost ✅ ▶️ View recording
✅ RunReportsSyntaxErrorsForTypeScriptAppHost ✅ ▶️ View recording
✅ SecretCrudOnDotNetAppHost ✅ ▶️ View recording
✅ SecretCrudOnTypeScriptAppHost ✅ ▶️ View recording
✅ StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ✅ ▶️ View recording
✅ StartAndWaitForTypeScriptSqlServerAppHostWithNativeAssets ✅ ▶️ View recording
✅ StartReportsSyntaxErrorsForDotNetAppHost ✅ ▶️ View recording
✅ StartReportsSyntaxErrorsForTypeScriptAppHost ✅ ▶️ View recording
✅ StopAllAppHostsFromAppHostDirectory ✅ ▶️ View recording
✅ StopJavaPolyglotAppHostUsingApphostDirectory ✅ ▶️ View recording
✅ StopNonInteractiveSingleAppHost ✅ ▶️ View recording
✅ StopTypeScriptPolyglotAppHostUsingApphostDirectory ✅ ▶️ View recording
✅ StopWithNoRunningAppHostExitsSuccessfully ✅ ▶️ View recording
✅ UnAwaitedChainsCompileWithAutoResolvePromises ✅ ▶️ View recording
✅ UpdateProjectChannelToStable_TypeScript_PicksUpStablePackages ✅ ▶️ View recording

📹 Recordings uploaded automatically from CI run #26197825129

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

✅ No documentation update needed.

docs_optional → build_or_ci_only

No triggered signals (signal_count: 0); advisory only_test_or_build_changes: true.

All 4 changed files are under eng/scripts/ (acquisition/CI verification scripts):

  • eng/scripts/verify-cli-archive.ps1 — extended to validate TypeScript AppHost layout and run aspire-ts-starter
  • eng/scripts/get-aspire-cli*.{ps1,sh} — synthetic test archive support

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.

Ankit Jain (radical) pushed a commit to radical/aspire that referenced this pull request May 21, 2026
* 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]>
David Fowler (davidfowl) pushed a commit that referenced this pull request May 21, 2026
… 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]>
Ankit Jain (radical) added a commit to radical/aspire that referenced this pull request May 21, 2026
…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]>
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]>
Mitch Denny (mitchdenny) added a commit that referenced this pull request May 29, 2026
…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]>
@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.

Validate shipped CLI and bundle layout for TypeScript AppHosts

4 participants