Skip to content

Fix --alias to also match by userId for UUID-aliased sessions#6933

Open
GeorgiZhelev wants to merge 1 commit intoShopify:mainfrom
GeorgiZhelev:fix/find-session-by-alias-or-userid
Open

Fix --alias to also match by userId for UUID-aliased sessions#6933
GeorgiZhelev wants to merge 1 commit intoShopify:mainfrom
GeorgiZhelev:fix/find-session-by-alias-or-userid

Conversation

@GeorgiZhelev
Copy link

WHY are these changes introduced?

When a session's email alias fails to resolve during login, the alias field ends up as undefined. The session list display falls back to showing userId (UUID) via session.identity.alias ?? userId. But findSessionByAlias only matches against session.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 --alias with the appropriate account - around 15 times a day).

WHAT is this pull request doing?

findSessionByAlias now also matches on the session's userId key as a fallback, so --alias <UUID> works for sessions where the alias was never set.

One-line change in store.ts, one new test in store.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.ts
  • Manual: on the live build, shopify auth login --alias "<UUID>" falls through to the interactive prompt instead of selecting the session. On the patched build, it selects the session correctly.
image

Measuring impact

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

@GeorgiZhelev GeorgiZhelev requested a review from a team as a code owner March 3, 2026 19:55
@GeorgiZhelev
Copy link
Author

Not sure how to rerun the CLA check, but I signed it at cla.shopify.com

@binks-code-reviewer
Copy link

🤖 Code Review · #projects-dev-ai for questions
React with 👍/👎 or reply — all feedback helps improve the agent.

Complete - No issues

📋 History

✅ No issues

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.

1 participant