Skip to content

[eas-cli] Prompt for account when linking unconfigured project - #4054

Merged
williamgrosset merged 5 commits into
mainfrom
@williamgrosset/prompt-for-account-on-unlinked-project
Jul 24, 2026
Merged

[eas-cli] Prompt for account when linking unconfigured project#4054
williamgrosset merged 5 commits into
mainfrom
@williamgrosset/prompt-for-account-on-unlinked-project

Conversation

@williamgrosset

@williamgrosset williamgrosset commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Why

When a project has no extra.eas.projectId and no owner in 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

  • Replaced the silent personal-account fallback with the same account selection eas init uses:
    • owner set or single account: no prompt, behavior unchanged
    • multiple accounts (interactive): prompt "Which account should own this project?"
    • non-interactive or robot user: same errors as before
  • Extracted getAccountChoices and the ViewOnly-permission filter into a shared src/project/accountSelection.ts module, and sorted account choices by creation date, newest first (added createdAt to the CurrentUser query). This also applies to the eas init prompt.

Test Plan

Unit tests added: accountSelection-test.ts (choice ordering and personal/team/organization annotations) and getProjectIdAsync-test.ts (prompt, owner field, single-account, non-interactive, and robot paths).

In a fresh app with no extra.eas.projectId and no owner in app.json, prompts for account selection:

prompt-for-account.mov

With owner set in app.json, no prompt and uses that account:

default-account.mov

Also verified:

  • eas init shows the same newest-first ordering in its account prompt (shared getAccountChoices)
  • --non-interactive with multiple accounts and no owner still fails with the "run eas init" error

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.36364% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.13%. Comparing base (7d611b1) to head (b4f0dd7).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
packages/eas-cli/src/project/accountSelection.ts 94.60% 1 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…t-for-account-on-unlinked-project

# Conflicts:
#	CHANGELOG.md
@williamgrosset
williamgrosset marked this pull request as ready for review July 22, 2026 18:25

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@github-actions

Copy link
Copy Markdown

Subscribed to pull request

File Patterns Mentions
packages/eas-cli/** @douglowder

Generated by CodeMention

Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead.

@brentvatne brentvatne added the ai-review Commits pushed to PRs with this label be automatically reviewed. label Jul 23, 2026
@brentvatne

brentvatne commented Jul 23, 2026

Copy link
Copy Markdown
Member

🤖 AI code review

Decision: 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.

Comment on lines +19 to +22
// 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()
);

@brentvatne brentvatne Jul 23, 2026

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.

  • 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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@github-actions

Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

@williamgrosset

Copy link
Copy Markdown
Contributor Author

@brentvatne Account selector now uses the original sorting behavior:

prompt-with-previous-sort.mov

@williamgrosset
williamgrosset merged commit 246d0c0 into main Jul 24, 2026
11 checks passed
@williamgrosset
williamgrosset deleted the @williamgrosset/prompt-for-account-on-unlinked-project branch July 24, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Commits pushed to PRs with this label be automatically reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants