Skip to content

Validate TypeScript CLI archive layout#17274

Open
sebastienros wants to merge 2 commits into
mainfrom
sebros/validate-cli-bundle-layout
Open

Validate TypeScript CLI archive layout#17274
sebastienros wants to merge 2 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 <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 19, 2026 21:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

🚀 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"

@sebastienros sebastienros requested a review from davidfowl May 19, 2026 21:25
Use switch output directly in Get-ArchiveRidFamily so verify-cli-archive.ps1 parses under pwsh in CI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

CLI E2E Tests unknown — 94 passed, 0 failed, 2 unknown (commit e3b4f39)

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

@IEvangelist
Copy link
Copy Markdown
Member

IEvangelist commented May 20, 2026

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.

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.

Validate shipped CLI and bundle layout for TypeScript AppHosts

3 participants