Skip to content

Reject Yarn Classic for TypeScript AppHosts - #16620

Merged
Eric Erhardt (eerhardt) merged 3 commits into
mainfrom
eerhardt/typescript-apphost-yarn-args
May 5, 2026
Merged

Eric Erhardt (eerhardt) merged 3 commits into
mainfrom
eerhardt/typescript-apphost-yarn-args

Conversation

@eerhardt

@eerhardt Eric Erhardt (eerhardt) commented Apr 30, 2026 •

Copy link
Copy Markdown
Member

Description

Yarn Classic is not supported for TypeScript AppHosts. Its command and argument forwarding behavior differs from supported package managers and can break Aspire publish/deploy argument handling.

This keeps the existing TypeScript AppHost command shapes for supported JavaScript package managers. Instead, the resolver now detects Yarn Classic from explicit packageManager: "[email protected]" declarations and Yarn v1 lockfiles (# yarn lockfile v1) in the AppHost directory or eligible parent workspace, then fails early with guidance to use Yarn 4 or later, npm, pnpm, or Bun.

Validation:

  • dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.TypeScriptAppHostToolchainResolverTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"
  • pnpm 10.20.0 smoke: aspire publish --list-steps and aspire run --detach --isolated against a TypeScript empty AppHost
  • Bun 1.3.13 smoke: aspire publish --list-steps and aspire run --detach --isolated against a TypeScript empty AppHost

Fixes #16616

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
  • Does the change require an update in our Aspire docs?

@github-actions

github-actions Bot commented Apr 30, 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 -- 16620

Or

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

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

Updates the TypeScript AppHost runtime command specs used by the Aspire CLI during publish/deploy so that operation arguments are reliably forwarded through JavaScript package managers (notably Yarn Classic, which otherwise drops trailing args without a -- separator). This prevents TypeScript AppHosts from accidentally running in normal “run” mode (starting DCP) when invoked via aspire publish / aspire deploy.

Changes:

  • Adds a publish-specific runtime command (PublishExecute) for the default TypeScript runtime spec that ends with -- to preserve forwarded publish/deploy args.
  • Extends the TypeScript toolchain resolver to generate publish-specific command specs for Bun/Yarn/pnpm that include the separator.
  • Adds/updates unit tests validating PublishExecute shapes and argument appending behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/TypeScriptLanguageSupportTests.cs Verifies the TypeScript runtime spec now provides a publish command spec with a trailing --.
tests/Aspire.Cli.Tests/Projects/TypeScriptAppHostToolchainResolverTests.cs Adds coverage for Bun/Yarn/pnpm publish command shapes including the separator.
tests/Aspire.Cli.Tests/Projects/GuestRuntimeTests.cs Adds coverage ensuring additional publish args are appended after an existing -- token in the spec.
src/Aspire.Hosting.CodeGeneration.TypeScript/TypeScriptLanguageSupport.cs Introduces PublishExecute for the default TypeScript runtime spec using npx ... {appHostFile} --.
src/Aspire.Cli/Projects/TypeScriptAppHostToolchainResolver.cs Generates toolchain-specific PublishExecute commands for Bun/Yarn/pnpm that include --.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good overall. Left a few non-blocking thoughts inline - mostly around verifying the -- actually gets consumed for non-Yarn toolchains, and a couple of small test/maintainability nits. Approving.

@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Re-running the failed jobs in the CI workflow for this pull request because 3 jobs were identified as retry-safe transient failures in the CI run attempt.
GitHub was asked to rerun all failed jobs for that attempt, and the rerun is being tracked in the rerun attempt.
The job links below point to the failed attempt jobs that matched the retry-safe transient failure rules.

Matched test failure patterns (3 tests)
  • Aspire.Cli.EndToEnd.Tests.StartStopTests.AddPackageWhileAppHostRunningDetached — MCR registry rate limiting (HTTP 403)
  • Aspire.Cli.EndToEnd.Tests.StartStopTests.StopWithNoRunningAppHostExitsSuccessfully — MCR registry rate limiting (HTTP 403)
  • Aspire.Cli.EndToEnd.Tests.StartStopTests.AddPackageInteractiveWhileAppHostRunningDetached — MCR registry rate limiting (HTTP 403)

@eerhardt

Copy link
Copy Markdown
Member Author

I'm updating this - the original proposal was bad.

Instead, the decision is that we aren't going to support Yarn Classic v1 until we receive user signal that we need to.

Yarn Classic is not supported for TypeScript AppHosts because its command behavior differs from supported package managers and can break Aspire argument forwarding.

Detect Yarn Classic through packageManager declarations and Yarn v1 lockfiles, then fail early with guidance to use Yarn 4 or later, npm, pnpm, or Bun.

Co-authored-by: Copilot <[email protected]>
@eerhardt
Eric Erhardt (eerhardt) force-pushed the eerhardt/typescript-apphost-yarn-args branch from 53eb41f to 29105c8 Compare May 4, 2026 20:42
@eerhardt Eric Erhardt (eerhardt) changed the title Fix TypeScript AppHost publish args for JS package managers Reject Yarn Classic for TypeScript AppHosts May 4, 2026

@IEvangelist David Pine (IEvangelist) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice, focused change — early rejection with clear upgrade guidance is a much better failure mode than the silent arg-passing breakage Yarn Classic was causing, and the version detection ([email protected] only, lockfile-based fallback bounded to 5 lines, exception-tolerant) looks right. The unit tests cover the new branches well.

One CI breakage worth addressing before merge — left an inline note. Otherwise LGTM, approving.

@eerhardt
Eric Erhardt (eerhardt) enabled auto-merge (squash) May 5, 2026 14:46
@eerhardt
Eric Erhardt (eerhardt) merged commit 2972fec into main May 5, 2026
272 of 287 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.4 milestone May 5, 2026
@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

🎬 CLI E2E Test Recordings — 57 recordings uploaded (commit f0d9477)

View all recordings
Status Test Recording
❔ AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
❔ AddPackageWhileAppHostRunningDetached ▶️ View Recording
❔ AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
❔ AgentInitCommand_DefaultSelection_InstallsSkillOnly ▶️ View Recording
❔ AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
❔ AspireAddPackageVersionToDirectoryPackagesProps ▶️ View Recording
❔ AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
❔ Banner_DisplayedOnFirstRun ▶️ View Recording
❔ Banner_DisplayedWithExplicitFlag ▶️ View Recording
❔ Banner_NotDisplayedWithNoLogoFlag ▶️ View Recording
❔ ConfigSetGet_CreatesNestedJsonFormat ▶️ View Recording
❔ CreateAndRunAspireStarterProject ▶️ View Recording
❔ CreateAndRunJsReactProject ▶️ View Recording
❔ CreateAndRunPythonReactProject ▶️ View Recording
❔ CreateAndRunTypeScriptEmptyAppHostProject ▶️ View Recording
❔ CreateAndRunTypeScriptStarterProject ▶️ View Recording
❔ CreateJavaAppHostWithViteApp ▶️ View Recording
❔ CreateTypeScriptAppHostWithViteApp_UsesConfiguredToolchain ▶️ View Recording
❔ DashboardRunWithOtelTracesReturnsNoTraces ▶️ View Recording
❔ DeployK8sWithGarnet ▶️ View Recording
❔ DeployK8sWithRabbitMQ ▶️ View Recording
❔ DeployK8sWithValkey ▶️ View Recording
❔ DeployTypeScriptAppToKubernetes ▶️ View Recording
❔ DescribeCommandResolvesReplicaNames ▶️ View Recording
❔ DescribeCommandShowsRunningResources ▶️ 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
❔ InteractiveCSharpInitCreatesExpectedFiles ▶️ View Recording
❔ InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View Recording
❔ LatestCliCanStartStableChannelAppHost ▶️ View Recording
❔ LatestCliCanStartStableChannelTypeScriptAppHost ▶️ View Recording
❔ LegacySettingsMigration_AdjustsRelativeAppHostPath ▶️ View Recording
❔ LogsCommandShowsResourceLogs ▶️ View Recording
❔ OtelLogsReturnsStructuredLogsFromStarterAppCore ▶️ View Recording
❔ PsCommandListsRunningAppHost ▶️ View Recording
❔ PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
❔ PublishWithoutOutputPathUsesAppHostDirectoryDefault ▶️ View Recording
❔ RestoreGeneratesSdkFiles ▶️ View Recording
❔ RestoreGeneratesSdkFiles_WithConfiguredToolchain ▶️ View Recording
❔ RestoreRefreshesGeneratedSdkAfterAddingIntegration ▶️ View Recording
❔ RestoreSupportsConfigOnlyHelperPackageAndCrossPackageTypes ▶️ View Recording
❔ SecretCrudOnDotNetAppHost ▶️ View Recording
❔ SecretCrudOnTypeScriptAppHost ▶️ View Recording
❔ StartAndWaitForTypeScriptSqlServerAppHostWithNativeAssets ▶️ View Recording
❔ StopAllAppHostsFromAppHostDirectory ▶️ View Recording
❔ StopNonInteractiveSingleAppHost ▶️ View Recording
❔ StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording
❔ UnAwaitedChainsCompileWithAutoResolvePromises ▶️ View Recording

📹 Recordings uploaded automatically from CI run #25383652633

aspire-repo-bot Bot added a commit to microsoft/aspire.dev that referenced this pull request May 5, 2026
…Hosts

Documents the change introduced in microsoft/aspire#16620, which rejects Yarn Classic
(v1) for TypeScript AppHosts. Adds a supported package managers table and an Aside
warning in the TypeScript AppHost project structure page.

Co-authored-by: Copilot <[email protected]>
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Pull request created: #830

Generated by PR Documentation Check

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

📝 A draft documentation PR has been opened on microsoft/aspire.dev to document this change.

Target branch: main (falling back from release/13.4 because that branch doesn't yet exist on microsoft/aspire.dev)

What was changed: Updated the [TypeScript AppHost project structure]((aspire.dev/redacted) page to:

  • Add a Supported package managers table listing npm, pnpm, Yarn 4+, and Bun
  • Add a caution note explaining that Yarn Classic (v1) is not supported and directing users to upgrade or switch package managers

The draft PR needs human review before merging.

Generated by PR Documentation Check for issue #16620 · ● 1.9M · ◷

David Pine (IEvangelist) pushed a commit to microsoft/aspire.dev that referenced this pull request May 5, 2026
…Hosts

Documents the change introduced in microsoft/aspire#16620, which rejects Yarn Classic
(v1) for TypeScript AppHosts. Adds a supported package managers table and an Aside
warning in the TypeScript AppHost project structure page.

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

Copy link
Copy Markdown
Member Author

/backport to release/13.3

@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

Started backporting to release/13.3 (link to workflow run)

Nell Shamrell-Harrington (nellshamrell) pushed a commit to nellshamrell/aspire that referenced this pull request May 18, 2026
* Reject Yarn Classic for TypeScript AppHosts

Yarn Classic is not supported for TypeScript AppHosts because its command behavior differs from supported package managers and can break Aspire argument forwarding.

Detect Yarn Classic through packageManager declarations and Yarn v1 lockfiles, then fail early with guidance to use Yarn 4 or later, npm, pnpm, or Bun.

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

* Update yarn tests to v4

---------

Co-authored-by: Copilot <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 5, 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.

TypeScript AppHost deploy/publish starts DCP when launched through Yarn Classic because operation args are dropped

4 participants