Fix --alias to also match by userId for UUID-aliased sessions#6933
Open
GeorgiZhelev wants to merge 1 commit intoShopify:mainfrom
Open
Fix --alias to also match by userId for UUID-aliased sessions#6933GeorgiZhelev wants to merge 1 commit intoShopify:mainfrom
GeorgiZhelev wants to merge 1 commit intoShopify:mainfrom
Conversation
Author
|
Not sure how to rerun the CLA check, but I signed it at cla.shopify.com |
|
🤖 Code Review · #projects-dev-ai for questions ✅ Complete - No issues 📋 History✅ No issues |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
When a session's email alias fails to resolve during login, the
aliasfield ends up asundefined. The session list display falls back to showinguserId(UUID) viasession.identity.alias ?? userId. ButfindSessionByAliasonly matches againstsession.identity.alias, so--alias <UUID>doesn't find anything and falls through to the interactive prompt.(The personal context is that I have a few different staff/partner accounts I work through so in every separate theme folder on my machine I automatically run
shopify auth login --aliaswith the appropriate account - around 15 times a day).WHAT is this pull request doing?
findSessionByAliasnow also matches on the session'suserIdkey as a fallback, so--alias <UUID>works for sessions where the alias was never set.One-line change in
store.ts, one new test instore.test.ts.Note: this does not fix the display issue — sessions with undefined aliases will still show as UUIDs in the session picker. That would require re-fetching the email at some point (e.g. during token refresh).
How to test your changes?
pnpm -F @shopify/cli-kit test -- src/private/node/session/store.test.tsshopify auth login --alias "<UUID>"falls through to the interactive prompt instead of selecting the session. On the patched build, it selects the session correctly.Measuring impact
Checklist