Skip to content

[rush] Support workspace aliases using caret shorthand - #6236

Open
whoalin1 wants to merge 2 commits into
microsoft:mainfrom
whoalin1:devin/1796127000-rush-workspace-caret-alias
Open

whoalin1 wants to merge 2 commits into
microsoft:mainfrom
whoalin1:devin/1796127000-rush-workspace-caret-alias

Conversation

@whoalin1

Copy link
Copy Markdown

Summary

Fixes #6222.

Rush now accepts pnpm workspace package aliases that use caret shorthand, such as "ui-core-v1": "workspace:@example/ui-core@^". Previously DependencySpecifier passed the shorthand ^ to npm-package-arg as though it were a complete npm range, causing commands such as rush update, rush build, and rush list --to to fail with Invalid tag name "^".

Details

Workspace aliases still expose their target package through aliasTarget, which allows Rush's project dependency graph to resolve the aliased workspace project. For the pnpm-only ^ and ~ shorthand forms, the target is represented directly as a workspace range instead of being validated as a standalone npm specifier. Full ranges such as workspace:alias@^1.2.3 continue through the existing npm-package-arg path unchanged.

This is backwards compatible and limited to parsing workspace protocol aliases. It does not change how normal npm aliases, catalog specifiers, or non-aliased workspace specifiers are parsed.

How it was tested

  • Added a regression test for workspace:@example/ui-core@^. The same input fails on the baseline implementation with Invalid tag name "^": Tags may not have any characters that encodeURIComponent encodes. and parses successfully with this change.
  • rush build --to @microsoft/rush-lib passed.
  • rushx test in libraries/rush-lib passed: 1980 successes, 0 failures, 2 skipped.
  • rush build --to @microsoft/rush passed.
  • Created a fresh local reproduction with @example/web-app depending on "ui-core-v1": "workspace:@example/ui-core@^"; the locally built Rush completed rush update, rush list --to @example/web-app, and rush build successfully.
  • rush change --verify --no-fetch exited successfully.
  • The pre-commit rush prettier hook ran during commit.

Impacted documentation

No documentation impact identified.

whoalin1 and others added 2 commits November 30, 2026 05:26
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@whoalin1

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@whoalin1

Copy link
Copy Markdown
Author

CI note: the Windows Node 26 failure is in RushFrontend.test.ts (runs the real custom command fixture with unsupported reporter as a custom value) as a 5-second Jest timeout. The DependencySpecifier tests and all Linux Node 22/24/26 jobs pass, so this appears unrelated to the workspace-alias parsing change rather than a regression in the PR.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

[rush] Workspace alias with caret shorthand ("workspace:pkg@^") fails with Invalid tag name "^"

1 participant