[eas-cli] Prompt for account when linking unconfigured project - #4054
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4054 +/- ##
==========================================
+ Coverage 61.09% 61.13% +0.05%
==========================================
Files 968 969 +1
Lines 43384 43392 +8
Branches 9131 9130 -1
==========================================
+ Hits 26499 26524 +25
+ Misses 15439 15423 -16
+ Partials 1446 1445 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…t-for-account-on-unlinked-project # Conflicts: # CHANGELOG.md
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
|
Subscribed to pull request
Generated by CodeMention Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead. |
🤖 AI code reviewDecision: Approve All specialist reviewers (correctness, security, and consistency) returned no findings. The PR is clean with no critical or warning issues identified. No findings. This review is advisory — it never blocks a merge and never auto-approves. |
| // sorted by account creation date from newest to oldest | ||
| const sortedAccounts = [...actor.accounts].sort( | ||
| (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime() | ||
| ); |
There was a problem hiding this comment.
- i really don't like this approach, in part because the sorting criteria is not a known value to the user, so it looks arbitrary. when you join a new org, it will just appear in some random position in the list. it is better to sort it by data that is visible to the user
- i also don't like it because it is inconsistent with how we sort accounts elsewhere
- on the website account selector we do: personal account, team accounts, organization accounts. within team accounts and org accounts, they're sorted alphabetically. https://github.com/expo/universe/blob/b3e7591d40b70dc79a776fe21a9ce2eb35c2ec0c/server/website/ui/components/SidebarNavigation/components/AccountSelectorContent.tsx#L57-L93. it'd be great to update to using this same convention here if we aren't doing it already. (edit: oh i see we were doing that before and this code changes that. let's revert this change).
There was a problem hiding this comment.
Good points. I added the sorting in the last commit. The idea was that first-selection bias was affecting people's choice of selecting the personal account instead of the org they recently created. I'm good with reverting back to previous behavior and discussing another approach if it's a consistent problem.
|
✅ Thank you for adding the changelog entry! |
|
@brentvatne Account selector now uses the original sorting behavior: prompt-with-previous-sort.mov |
Why
When a project has no
extra.eas.projectIdand noownerin its app config, project-scoped commands (eas build,eas submit,eas update, etc.) silently linked or created the EAS project under the user's personal account. For users in multiple accounts, this often put projects under the wrong account.How
eas inituses:ownerset or single account: no prompt, behavior unchangedgetAccountChoicesand the ViewOnly-permission filter into a sharedsrc/project/accountSelection.tsmodule, and sorted account choices by creation date, newest first (addedcreatedAtto theCurrentUserquery). This also applies to theeas initprompt.Test Plan
Unit tests added:
accountSelection-test.ts(choice ordering and personal/team/organization annotations) andgetProjectIdAsync-test.ts(prompt,ownerfield, single-account, non-interactive, and robot paths).In a fresh app with no
extra.eas.projectIdand noownerinapp.json, prompts for account selection:prompt-for-account.mov
With
ownerset inapp.json, no prompt and uses that account:default-account.mov
Also verified:
eas initshows the same newest-first ordering in its account prompt (sharedgetAccountChoices)--non-interactivewith multiple accounts and noownerstill fails with the "runeas init" error