Skip to content

Explain how to merge an existing work account during onboarding - #108176

Draft
MelvinBot wants to merge 4 commits into
mainfrom
claude-onboardingMergeGuidance
Draft

MelvinBot wants to merge 4 commits into
mainfrom
claude-onboardingMergeGuidance

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Show actionable sign-in-and-merge guidance when an existing work account blocks onboarding, including the jsonCode: 501 response delivered through onyxData and 666 failures other than invalid codes. Preserve specific 2FA/SSO/invalid-code errors and the generic fallback for unknown AddWorkEmail failures. Update the guidance in all 11 supported locales.

Regression testing also exposed a completion effect that cleared the guidance and navigated away when the backend marked a blocked merge step completed. Guard that effect while the merge is blocked so confirmation remains under user control.

AI Tests

  • Onboarding-data guard update (2026-12-02): automatic error cleanup and navigation now wait for onboarding data and preserve blocked merge explanations. Added regression coverage for an undefined/loading subscription resolving blocked (including completed merge state), plus normal cleanup after resolving unblocked. The retention regression fails without the guard and passes with it. This simulates the reported subscription ordering; it does not demonstrate that ordinary browser reload currently reaches that ordering through app initialization.
  • Latest guard verification: 63 targeted tests passed, along with changed-file lint/spelling, repository typecheck on retry, Storybook smoke test, direct React Compiler check, Oxfmt commit hook, and code review with no violations. The full Jest run exceeded the 20-minute limit before completion; it is not recorded as passed. No new interactive browser verification was performed.

Earlier translation and implementation verification:

  • Translation patch update (2026-12-02): applied all seven replacements from the requested Polyglot Parrot suggestion, verified byte-for-byte and reviewed with no violations.
  • Latest verification: full Jest suite passed (2,757 suites, 46,143 tests, 161 snapshots; one suite and 146 tests skipped), repository typecheck passed on retry, Storybook smoke test passed, and Oxfmt commit hook passed for all seven changed files.
  • Non-English locale files are excluded by the lint/spelling configuration (lint reported no matching files; spelling checked zero files). Translation dry-run remains blocked by ts-node startup error Cannot read properties of undefined (reading 'fileExists'); the legacy Prettier script is absent, with formatting covered by Oxfmt instead. No new browser verification was performed for these translation-only replacements.

Earlier implementation verification:

  • Passed: full Jest suite — 2,633 suites, 43,907 tests, 161 snapshots (146 tests and one suite skipped).
  • Passed: changed-file lint and spelling, repository typecheck, Storybook smoke test, direct React Compiler check for the changed component, and the Oxfmt commit hook.
  • Code review: no violations found by the local review agent.
  • Browser verification blocked: the browser exposed no page elements and its session remained suspended after a retry. Onboarding could not be exercised; this is not a product-behavior failure verdict.
  • Translation dry-run could not complete: the documented ts-node invocation fails during startup; running the Bun entry point was denied by the execution environment. The obsolete Prettier script is absent; Oxfmt succeeded instead. Changed-file React Compiler discovery failed on an empty base ref; the explicit-file check passed.

This draft uses an upstream branch because no accessible contributor fork was found. To copy the branch to your fork:

git remote add upstream https://github.com/Expensify/App.git
git fetch --depth=1 upstream claude-onboardingMergeGuidance
git checkout -b claude-onboardingMergeGuidance FETCH_HEAD
git push -u origin claude-onboardingMergeGuidance

Fixed Issues

$ #105015
PROPOSAL: #105015 (comment)

Tests

Same as QA Steps

Offline tests

Same as QA Steps

QA Steps

  1. Open the app.
  2. Sign in with an email address that is not associated with an existing Expensify account.
  3. Proceed to the "What’s your work email?" onboarding screen.
  4. Enter a work email address that is already associated with an existing Expensify account.
  5. Verify that the following message is displayed: "Sign in with [work email] and merge this account from Account > Security > Merge accounts".

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Browser verification blocker (not evidence of the corrected onboarding screen):
Browser state when onboarding verification was blocked

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

Co-authored-by: dmkt9 <dmkt9@users.noreply.github.com>
@OSBotify

Copy link
Copy Markdown
Contributor

🦜 Polyglot Parrot! 🦜

Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues:

View the translation diff
diff --git a/src/languages/de.ts b/src/languages/de.ts
index ae52154a..3c848f11 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -4131,7 +4131,7 @@ ${amount} für ${merchant} – ${date}`,
             subtitle: (workEmail: string | undefined) =>
                 `Wir konnten ${workEmail} nicht hinzufügen. Bitte versuche es später in den Einstellungen erneut oder chatte mit Concierge, um Unterstützung zu erhalten.`,
             validatedPublicDomainSubtitle: (workEmail: string | undefined) =>
-                `Melden Sie sich mit ${workEmail} an und führen Sie dieses Konto unter Konto > Sicherheit > Konten zusammenführen zusammen.`,
+                `Melden Sie sich mit ${workEmail} an und führen Sie dieses Konto über Konto > Sicherheit > Konten zusammenführen zusammen.`,
             workAccountClosedSubtitle:
                 'Das Arbeitskonto, das mit dieser E-Mail-Adresse verknüpft ist, wurde geschlossen. Bitte wenden Sie sich an Ihre Unternehmensadministratorin bzw. Ihren Unternehmensadministrator, um es zu reaktivieren, oder registrieren Sie sich mit einer anderen E-Mail-Adresse.',
             domainControlledSubtitle: (workEmail: string | undefined) => `${workEmail} ist ein domänengesteuerter Login für ein bestehendes Expensify-Konto.`,
diff --git a/src/languages/el.ts b/src/languages/el.ts
index 7ee58852..53b3d132 100644
--- a/src/languages/el.ts
+++ b/src/languages/el.ts
@@ -4185,7 +4185,7 @@ ${amount} για ${merchant} - ${date}`,
             title: 'Δεν ήταν δυνατή η προσθήκη της εργασιακής διεύθυνσης email',
             subtitle: (workEmail: string | undefined) => `Δεν ήταν δυνατή η προσθήκη του ${workEmail}. Δοκιμάστε ξανά αργότερα στις ρυθμίσεις ή συνομιλήστε με το Concierge για καθοδήγηση.`,
             validatedPublicDomainSubtitle: (workEmail: string | undefined) =>
-                `Συνδεθείτε με το ${workEmail} και συγχωνεύστε αυτόν τον λογαριασμό από Λογαρια​σμός > Ασφάλεια > Συγχώνευση λογαριασμών.`,
+                `Συνδεθείτε με το ${workEmail} και συγχωνεύστε αυτόν τον λογαρια​σμό από Λογαρια​σμός > Ασφάλεια > Συγχώνευση λογαριασμών.`,
             workAccountClosedSubtitle:
                 'Ο επαγγελματικός λογαριασμός που σχετίζεται με αυτό το email είναι κλειστός. Παρακαλούμε επικοινωνήστε με τον διαχειριστή της εταιρείας σας για να τον επανενεργοποιήσει ή εγγραφείτε με διαφορετικό email.',
             domainControlledSubtitle: (workEmail: string | undefined) => `${workEmail} είναι ένα στοιχείο σύνδεσης ελεγχόμενο από τομέα για έναν υπάρχοντα λογαριασμό Expensify.`,
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index 6ef9f1b8..c8dd65e9 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -4137,7 +4137,7 @@ ${amount} pour ${merchant} - ${date}`,
             title: 'Impossible d’ajouter l’adresse e-mail professionnelle',
             subtitle: (workEmail: string | undefined) =>
                 `Nous n’avons pas pu ajouter ${workEmail}. Veuillez réessayer plus tard dans les Paramètres ou discuter avec Concierge pour obtenir de l’aide.`,
-            validatedPublicDomainSubtitle: (workEmail: string | undefined) => `Connectez-vous avec ${workEmail} et fusionnez ce compte depuis Compte > Sécurité > Fusionner les comptes.`,
+            validatedPublicDomainSubtitle: (workEmail: string | undefined) => `Connectez-vous avec ${workEmail} et fusionnez ce compte via Compte > Sécurité > Fusionner les comptes.`,
             workAccountClosedSubtitle:
                 'Le compte professionnel associé à cet e-mail est fermé. Veuillez contacter l’administrateur de votre entreprise pour le réactiver, ou inscrivez-vous avec un autre e-mail.',
             domainControlledSubtitle: (workEmail: string | undefined) => `${workEmail} est un identifiant contrôlé par domaine pour un compte Expensify existant.`,
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index d193c88c..36617559 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -4111,7 +4111,7 @@ ${amount} voor ${merchant} - ${date}`,
         mergeBlockScreen: {
             title: 'Werkmail kon niet worden toegevoegd',
             subtitle: (workEmail: string | undefined) => `We konden ${workEmail} niet toevoegen. Probeer het later opnieuw in Instellingen of chat met Concierge voor hulp.`,
-            validatedPublicDomainSubtitle: (workEmail: string | undefined) => `Log in met ${workEmail} en voeg dit account samen via Account > Beveiliging > Accounts samenvoegen.`,
+            validatedPublicDomainSubtitle: (workEmail: string | undefined) => `Log in met ${workEmail} en voeg deze account samen via Account > Beveiliging > Accounts samenvoegen.`,
             workAccountClosedSubtitle:
                 'De zakelijke account die aan dit e-mailadres is gekoppeld, is gesloten. Neem contact op met de beheerder van je bedrijf om het opnieuw te activeren, of meld je aan met een ander e-mailadres.',
             domainControlledSubtitle: (workEmail: string | undefined) => `${workEmail} is een door het domein beheerde login voor een bestaand Expensify-account.`,
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index 6c9c4d35..0a0b3e20 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -4156,7 +4156,7 @@ ${amount} dla ${merchant} - ${date}`,
         mergeBlockScreen: {
             title: 'Nie udało się dodać służbowego adresu e-mail',
             subtitle: (workEmail: string | undefined) => `Nie udało się dodać ${workEmail}. Spróbuj ponownie później w Ustawieniach lub porozmawiaj z Concierge, aby uzyskać pomoc.`,
-            validatedPublicDomainSubtitle: (workEmail: string | undefined) => `Zaloguj się za pomocą ${workEmail} i scal to konto w Konto > Zabezpieczenia > Scal konta.`,
+            validatedPublicDomainSubtitle: (workEmail: string | undefined) => `Zaloguj się przy użyciu ${workEmail} i połącz to konto w Ustawienia konta > Zabezpieczenia > Scal konta.`,
             workAccountClosedSubtitle:
                 'Konto służbowe powiązane z tym adresem e‑mail jest zamknięte. Skontaktuj się z administratorem w swojej firmie, żeby je ponownie aktywować, albo zarejestruj się przy użyciu innego adresu e‑mail.',
             domainControlledSubtitle: (workEmail: string | undefined) => `${workEmail} to login kontrolowany przez domenę dla istniejącego konta Expensify.`,
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index 7ad5444d..68b49202 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -4113,7 +4113,7 @@ ${amount} para ${merchant} - ${date}`,
             title: 'Não foi possível adicionar o e-mail de trabalho',
             subtitle: (workEmail: string | undefined) =>
                 `Não foi possível adicionar ${workEmail}. Tente novamente mais tarde em Configurações ou converse com o Concierge para obter orientação.`,
-            validatedPublicDomainSubtitle: (workEmail: string | undefined) => `Entre com ${workEmail} e mescle esta conta em Conta > Segurança > Mesclar contas.`,
+            validatedPublicDomainSubtitle: (workEmail: string | undefined) => `Acesse com ${workEmail} e mescle esta conta em Conta > Segurança > Mesclar contas.`,
             workAccountClosedSubtitle:
                 'A conta de trabalho associada a este e-mail foi encerrada. Entre em contato com o administrador da sua empresa para reativá-la ou inscreva-se com um e-mail diferente.',
             domainControlledSubtitle: (workEmail: string | undefined) => `${workEmail} é um login controlado por domínio de uma conta existente do Expensify.`,
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index 5e24a736..5ca43c3b 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -3969,7 +3969,7 @@ ${amount},商户:${merchant} - 日期:${date}`,
         mergeBlockScreen: {
             title: '无法添加工作邮箱',
             subtitle: (workEmail: string | undefined) => `我们无法添加 ${workEmail}。请稍后在设置中重试,或与 Concierge 聊天以获取指导。`,
-            validatedPublicDomainSubtitle: (workEmail: string | undefined) => `请使用 ${workEmail} 登录,并从“账户 > 安全 > 合并账户”合并此账户。`,
+            validatedPublicDomainSubtitle: (workEmail: string | undefined) => `使用 ${workEmail} 登录,然后前往“账户 > 安全 > 合并账户”来合并此账户。`,
             workAccountClosedSubtitle: '与此邮箱关联的工作账户已被关闭。请联系您公司的管理员以重新激活该账户,或使用其他邮箱注册。',
             domainControlledSubtitle: (workEmail: string | undefined) => `${workEmail} 是现有 Expensify 账户的域控制登录。`,
         },

Note

You can apply these changes to your branch by copying the patch to your clipboard, then running pbpaste | git apply 😉

View workflow run

@MelvinBot

MelvinBot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Android test steps verification results: ❌ fail

Blocked on standalone Android NewDot, not a demonstrated PR defect. The supplied account already completed onboarding, and available tools cannot restore the required onboarding state.

Android Home screen after onboarding was already completed

Step Status
1. Sign up using personal email or phoneNot independently verified: supplied account was already signed in.
❌
2. Reach onboarding’s add-work-email stepBlocked: account state reports onboarding completed; screenshot confirms Home.
Android Home screen after onboarding was already completed
❌
3. Enter an existing account’s work emailNot verified: required onboarding step unavailable.
❌
4. Verify blocked merge guidanceNot verified: blocked screen not reached.
❌
5. Verify email interpolationNot verified: blocked screen not reached.
❌
6. Verify Spanish guidanceNot verified: blocked screen not reached.
❌
7. Verify no JavaScript console errors during the flowNot assessed: requested flow could not be executed.
❌
Optional error branches and persistence until Got itNot verified: no reachable fixture for 403, 501, 666, 2FA, SSO, invalid-code, unknown-error, or dismissal behavior.
❌

view run · view recording

@MelvinBot

MelvinBot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ❌ fail

Blocked on dev NewDot web: the supplied account already completed onboarding. Available tools cannot restore add-work-email onboarding or provision the required existing-account fixture, so this is not a demonstrated PR defect.

Home screen in the supplied session after onboarding was already completed

Step Status
1. Sign up using phone or personal emailNot verified interactively: supplied session was already signed in.
❌
2. Proceed to onboarding add-work-emailBlocked: account state reported onboarding completed; screen read-back confirmed Home.
Home screen in the supplied session after onboarding was already completed
❌
3. Enter an existing Expensify account emailNot executed: required onboarding screen and existing-account fixture unavailable.
❌
4. Verify specified sign-in and merge guidanceNot verified: blocked screen was not reached.
❌
5. Verify email interpolation instead of {0}Not verified: guidance was not reached.
❌
6. Verify Spanish localized subtitleNot verified: guidance was not reached.
❌
7. Verify no JavaScript console errors during the flowNot verified: requested flow was not executed, and supported web tooling does not expose console inspection.
❌
Optional error branches and guidance persistence until Got itNot verified: required fixtures and supported error-injection tools unavailable.
❌

view run · view recording

@dmkt9

dmkt9 commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot merge the latest main branch

Co-authored-by: dmkt9 <dmkt9@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Merged the latest main into this PR without conflicts and pushed f0ecab0.

All 61 targeted tests, lint, and Storybook smoke tests passed. Full-suite testing found 16 unrelated native-tab failures; typecheck and translation checks hit dependency/tooling issues.


view run

@dmkt9

dmkt9 commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot apply this #108176 (comment)

@MelvinBot

Copy link
Copy Markdown
Contributor Author

⚠️ Something went wrong. This may be a transient issue. Try again. If it persists, check status.openai.com.

Run details

if (response?.message === CONST.MERGE_ACCOUNT_INVALID_CODE_ERROR || response?.title === CONST.MERGE_ACCOUNT_INVALID_CODE_ERROR) {
Onyx.merge(ONYXKEYS.ONBOARDING_ERROR_MESSAGE_TRANSLATION_KEY, 'contacts.genericFailureMessages.validateSecondaryLogin');
} else {
Onyx.merge(ONYXKEYS.ONBOARDING_ERROR_MESSAGE_TRANSLATION_KEY, getBlockedMergeErrorTranslationKey(response?.message));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@MelvinBot src/pages/OnboardingWorkEmail/BaseOnboardingWorkEmail.tsx:131 — Reloading the page causes the specific merge guidance to be lost.

useOnyx(ONYXKEYS.NVP_ONBOARDING) returns undefined with status: 'loading' while Onyx.init() has not yet completed hydration.

The current effect only checks onboardingValues?.isMergingAccountBlocked. On the first render after reloading, this value is undefined, causing setOnboardingErrorMessage(null) to be called.

Once NVP_ONBOARDING is hydrated with isMergingAccountBlocked: true, the blocked screen is still displayed, but ONBOARDING_ERROR_MESSAGE_TRANSLATION_KEY has already been cleared.

As a result, OnboardingMergingAccountBlockedView.tsx falls back to onboarding.mergeBlockScreen.subtitle instead of displaying validatedPublicDomainSubtitle.

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.

Pushed 28f8145: cleanup now waits for onboarding data and preserves guidance while merging is blocked.

Added regression coverage for the reported loading sequence and normal unblocked cleanup. All 63 targeted tests and static checks passed; the full suite timed out. Browser reload behavior wasn’t independently reproduced.


view run

Co-authored-by: dmkt9 <dmkt9@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Applied all seven translation changes exactly as suggested and pushed 53a15a3.

All 46,143 tests, typecheck, formatting, and Storybook smoke tests passed. Translation dry-run remains blocked by a tooling error.


view run

@dmkt9

dmkt9 commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot update your checklist:

  1. Check all checkboxes
  2. Update the Tests section and Offline tests section to Same as QA Steps
  3. Update the QA Steps to:
1. Open the app.
2. Sign in with an email address that is not associated with an existing Expensify account.
3. Proceed to the "What’s your work email?" onboarding screen.
4. Enter a work email address that is already associated with an existing Expensify account.
5. Verify that the following message is displayed: "Sign in with [work email] and merge this account from Account > Security > Merge accounts".

Co-authored-by: dmkt9 <dmkt9@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Updated the PR description: checked all checkboxes on your behalf, set Tests and Offline tests to “Same as QA Steps,” and replaced QA Steps with your exact five steps.


view run

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

Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants