Skip to content

[HOLD Auth#21849] Re-apply secure private personal details + fix 4 blockers from previous revert#91646

Open
jasperhuangg wants to merge 6 commits into
mainfrom
jasper-securePrivatePersonalDetails-redo-v2
Open

[HOLD Auth#21849] Re-apply secure private personal details + fix 4 blockers from previous revert#91646
jasperhuangg wants to merge 6 commits into
mainfrom
jasper-securePrivatePersonalDetails-redo-v2

Conversation

@jasperhuangg
Copy link
Copy Markdown
Contributor

@jasperhuangg jasperhuangg commented May 25, 2026

Explanation of Change

Re-applies #91000 (reverted in #91606) and fixes the 4 blockers that caused the revert.

Fixed Issues

$ #91602
$ #91604
$ #91608
$ #91611

Tests

  1. As a new unverified user: Settings > Profile > Legal name. Fill all fields + select a Google Places address. Save, enter magic code → details persist with no Auth error ([Due for payment 2026-06-02] Profile - "Auth UpdatePrivatePersonalDetails returned an error" after verifying account #91602).
  2. Profile > Address — verify URL has ?fieldToFocus=addressLine1 and the field is focused ([Due for payment 2026-06-02] Profile - Address line 1 is not auto focused when URL contains ?fieldToFocus=addressLine1 #91604).
  3. Profile > Address, pick a new address, Save, back-arrow from magic code — Country stays on the picked country, not geolocation ([Due for payment 2026-06-02] Account-Country return to geolocation when back from magic code page #91608).
  4. From step 3, back-arrow again — RHP closes back to Profile ([Due for payment 2026-06-02] Back button on Personal details RHP reopens the same page after returning from magic code page #91611).
  • Verify that no errors appear in the JS console

Offline tests

  1. Go offline.
  2. Open Settings > Profile > Address.
  3. Type manually — no Google Places suggestions appear, but the input accepts manual entry.
  4. Tap Save and verify the form transitions to the magic-code page.
  5. Go back online; the update completes.

QA Steps

  1. Go to staging.new.expensify.com.
  2. Repeat the Tests section steps 1–4 above (covering [Due for payment 2026-06-02] Profile - "Auth UpdatePrivatePersonalDetails returned an error" after verifying account #91602, [Due for payment 2026-06-02] Profile - Address line 1 is not auto focused when URL contains ?fieldToFocus=addressLine1 #91604, [Due for payment 2026-06-02] Account-Country return to geolocation when back from magic code page #91608, [Due for payment 2026-06-02] Back button on Personal details RHP reopens the same page after returning from magic code page #91611).
  • Verify that no errors appear in the JS console

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 followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • 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 a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • 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.
  • I verified that similar component doesn't exist in the codebase
  • I verified that all props are defined accurately and each prop has a /** comment above it */
  • I verified that each file is named correctly
  • I verified that each component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
  • I verified that the only data being stored in component state is data necessary for rendering and nothing else
  • In component if we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
  • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
  • I verified that component internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
  • I verified that all JSX used for rendering exists in the render method
  • I verified that each component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions

Screenshots/Videos

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

…omplete and country auto-fill"

This reverts commit 30d6f08.
- Preserve form draft across the navigation to the magic-code RHP. The
  prior cleanup cleared the draft on every unmount, so navigating to the
  magic-code screen wiped the payload before submission. For new users
  with no stored address that resulted in Auth returning an error on
  UpdatePrivatePersonalDetails (#91602). It also caused the country to
  fall back to the geolocation default when the user backed out of the
  magic-code page and remounted the form (#91608). Now the draft is
  cleared only when the form unmounts without navigating to the magic
  code screen, and the magic-code success effect clears the draft after
  the API write completes.

- Seed selectedCountry / selectedState from the form draft (with the
  stored address and geolocation as further fallbacks) so a back-from-
  magic-code remount restores the user's choices instead of reverting to
  geolocation (#91608).

- Pop the magic-code RHP with a plain Navigation.goBack() instead of
  goBack(ROUTES.SETTINGS_PRIVATE_PERSONAL_DETAILS). The route-based
  back path compares params, which never matched the existing
  PrivatePersonalDetails route (it carried a fieldToFocus param) and
  fell through to REPLACE, leaving a duplicate PrivatePersonalDetails on
  the RHP stack so the next back-press only popped the duplicate
  (#91611).

- AddressSearch now accepts an autoFocus prop and forwards it to the
  underlying TextInput, so opening PrivatePersonalDetailsPage with
  ?fieldToFocus=addressLine1 actually focuses Address line 1 (#91604).
@jasperhuangg jasperhuangg requested review from a team as code owners May 25, 2026 20:26
@melvin-bot melvin-bot Bot requested review from eh2077 and heyjennahay May 25, 2026 20:26
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 25, 2026

Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers!

@melvin-bot melvin-bot Bot removed request for a team May 25, 2026 20:26
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 25, 2026

@eh2077 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot Bot requested review from a team, mountiny and parasharrajat and removed request for a team May 25, 2026 20:26
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 25, 2026

@parasharrajat @mountiny One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 25, 2026

npm has a package.json file and a package-lock.json file. It seems you updated one without the other, which is usually a sign of a mistake. If you are updating a package make sure that you update the version in package.json then run npm install

@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 92f50bf135e..972f9624a4c 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -3334,7 +3334,7 @@ ${amount} für ${merchant} – ${date}`,
         enterPhoneNumber: 'Wie lautet deine Telefonnummer?',
         personalDetails: 'Persönliche Angaben',
         privateDataMessage: 'Diese Angaben werden für Reisen und Zahlungen verwendet. Sie werden niemals in deinem öffentlichen Profil angezeigt.',
-        basicDetails: 'Grundlegende Angaben',
+        basicDetails: 'Grundlegende Details',
         legalName: 'Rechtlicher Name',
         legalFirstName: 'Rechtlicher Vorname',
         legalLastName: 'Rechtlicher Nachname',
@@ -3529,7 +3529,7 @@ ${amount} für ${merchant} – ${date}`,
             noBankAccountSelected: 'Bitte wähle ein Konto aus',
             taxID: 'Bitte geben Sie eine gültige Steueridentifikationsnummer ein',
             website: 'Bitte eine gültige Website eingeben',
-            zipCode: `Bitte gib eine gültige Postleitzahl im folgenden Format ein: ${COMMON_CONST.COUNTRY_ZIP_REGEX_DATA.US.samples}`,
+            zipCode: `Bitte geben Sie eine gültige Postleitzahl im folgenden Format ein: ${COMMON_CONST.COUNTRY_ZIP_REGEX_DATA.US.samples}`,
             phoneNumber: 'Bitte gib eine gültige Telefonnummer ein',
             email: 'Bitte gib eine gültige E-Mail-Adresse ein',
             companyName: 'Bitte gib einen gültigen Unternehmensnamen ein',
diff --git a/src/languages/es.ts b/src/languages/es.ts
index 3a8d9ce406c..7549e479462 100644
--- a/src/languages/es.ts
+++ b/src/languages/es.ts
@@ -3214,7 +3214,7 @@ ${amount} para ${merchant} - ${date}`,
         enterPhoneNumber: '¿Cuál es tu número de teléfono?',
         personalDetails: 'Datos personales',
         privateDataMessage: 'Estos detalles se utilizan para viajes y pagos. Nunca se mostrarán en tu perfil público.',
-        basicDetails: 'Datos básicos',
+        basicDetails: 'Detalles básicos',
         legalName: 'Nombre completo',
         legalFirstName: 'Nombre legal',
         legalLastName: 'Apellidos legales',
@@ -3412,7 +3412,7 @@ ${amount} para ${merchant} - ${date}`,
             noBankAccountSelected: 'Por favor, elige una cuenta bancaria',
             taxID: 'Por favor, introduce un número de identificación fiscal válido',
             website: 'Por favor, introduce un sitio web válido',
-            zipCode: `Formato de código postal incorrecto. Formato aceptable: ${COMMON_CONST.COUNTRY_ZIP_REGEX_DATA.US.samples}.`,
+            zipCode: `Por favor, introduce un código ZIP válido usando el formato: ${COMMON_CONST.COUNTRY_ZIP_REGEX_DATA.US.samples}`,
             phoneNumber: 'Por favor, introduce un teléfono válido',
             email: 'Por favor, introduce una dirección de correo electrónico válida',
             companyName: 'Por favor, introduce un nombre comercial legal válido',
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index 8235e1a4c80..c95a2fa633b 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -3540,7 +3540,7 @@ ${amount} pour ${merchant} - ${date}`,
             noBankAccountSelected: 'Veuillez choisir un compte',
             taxID: 'Veuillez saisir un numéro d’identification fiscale valide',
             website: 'Veuillez saisir un site web valide',
-            zipCode: `Veuillez saisir un code postal valide au format : ${COMMON_CONST.COUNTRY_ZIP_REGEX_DATA.US.samples}`,
+            zipCode: `Veuillez saisir un code ZIP valide en utilisant le format : ${COMMON_CONST.COUNTRY_ZIP_REGEX_DATA.US.samples}`,
             phoneNumber: 'Veuillez saisir un numéro de téléphone valide',
             email: 'Veuillez saisir une adresse e-mail valide',
             companyName: 'Veuillez saisir un nom d’entreprise valide',
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index dd0e65638d8..4bd36a01cca 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -3492,7 +3492,7 @@ ${integrationName === CONST.ONBOARDING_ACCOUNTING_MAPPING.other ? 'あなたの'
             noBankAccountSelected: 'アカウントを選択してください',
             taxID: '有効な納税者番号を入力してください',
             website: '有効なウェブサイトを入力してください',
-            zipCode: `有効なZIPコードを、次の形式で入力してください: ${COMMON_CONST.COUNTRY_ZIP_REGEX_DATA.US.samples}`,
+            zipCode: `有効な ZIP コードを、次の形式で入力してください:${COMMON_CONST.COUNTRY_ZIP_REGEX_DATA.US.samples}`,
             phoneNumber: '有効な電話番号を入力してください',
             email: '有効なメールアドレスを入力してください',
             companyName: '有効な会社名を入力してください',
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index 72296059032..9f511ae2130 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -3508,7 +3508,7 @@ ${amount} dla ${merchant} - ${date}`,
             noBankAccountSelected: 'Wybierz konto',
             taxID: 'Wprowadź prawidłowy numer identyfikacji podatkowej',
             website: 'Wprowadź prawidłową stronę internetową',
-            zipCode: `Wprowadź prawidłowy kod ZIP w formacie: ${COMMON_CONST.COUNTRY_ZIP_REGEX_DATA.US.samples}`,
+            zipCode: `Wpisz prawidłowy kod ZIP w formacie: ${COMMON_CONST.COUNTRY_ZIP_REGEX_DATA.US.samples}`,
             phoneNumber: 'Wprowadź prawidłowy numer telefonu',
             email: 'Wpisz prawidłowy adres e‑mail',
             companyName: 'Wprowadź prawidłową nazwę firmy',
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index 0c9a4e0084e..dd4be17b0f6 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -3429,7 +3429,7 @@ ${amount},商户:${merchant} - 日期:${date}`,
             noBankAccountSelected: '请选择一个账户',
             taxID: '请输入有效的税号',
             website: '请输入有效的网站',
-            zipCode: `请输入有效的邮政编码,格式为:${COMMON_CONST.COUNTRY_ZIP_REGEX_DATA.US.samples}`,
+            zipCode: `请按照以下格式输入有效的邮政编码:${COMMON_CONST.COUNTRY_ZIP_REGEX_DATA.US.samples}`,
             phoneNumber: '请输入有效的电话号码',
             email: '请输入有效的邮箱地址',
             companyName: '请输入有效的公司名称',

Note

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

View workflow run

@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/CONST/index.ts 93.84% <ø> (ø)
src/SCREENS.ts 100.00% <ø> (ø)
src/components/AddressSearch/index.tsx 46.20% <100.00%> (+0.34%) ⬆️
src/libs/API/types.ts 100.00% <ø> (ø)
...igation/linkingConfig/RELATIONS/SETTINGS_TO_RHP.ts 100.00% <ø> (ø)
src/libs/Navigation/linkingConfig/config.ts 76.92% <ø> (ø)
src/ROUTES.ts 18.49% <0.00%> (-0.02%) ⬇️
src/components/AddressForm.tsx 98.36% <66.66%> (ø)
...c/pages/ReimbursementAccount/AddressFormFields.tsx 0.00% <0.00%> (ø)
...gation/AppNavigator/ModalStackNavigators/index.tsx 6.65% <0.00%> (-0.02%) ⬇️
... and 6 more
... and 6 files with indirect coverage changes

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7a57604f84

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/pages/settings/Profile/PersonalDetails/PrivatePersonalDetailsPage.tsx Outdated
@jasperhuangg jasperhuangg marked this pull request as draft May 25, 2026 20:55
@jasperhuangg jasperhuangg changed the title Re-apply secure private personal details + fix 4 blockers from previous revert [HOLD Auth#21849] Re-apply secure private personal details + fix 4 blockers from previous revert May 25, 2026
@jasperhuangg jasperhuangg requested a review from rafecolton May 26, 2026 16:45
@jasperhuangg jasperhuangg marked this pull request as ready for review May 26, 2026 16:45
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 33866eae94

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/libs/PersonalDetailsUtils.ts Outdated
@jasperhuangg jasperhuangg marked this pull request as draft May 26, 2026 17:37
jasperhuangg and others added 2 commits May 26, 2026 10:57
Drop the `|| selectedState` / `|| selectedCountry` fallbacks in the
PrivatePersonalDetailsPage validator. The form values already reflect
the selectors (FormProvider syncs controlled `value` into inputValues),
and on the non-US path the state TextInput has no handler to keep
selectedState in sync — so clearing a prefilled state let the required
check pass against the stale local value and submit an empty addressState.

Add `address?.street2` to the precedence chain in
getPrivatePersonalDetailsFormValues so a separately-stored line 2 is
preserved when the form is rebuilt without a draft, matching the
precedence the page itself uses.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jasperhuangg jasperhuangg marked this pull request as ready for review May 27, 2026 21:45
@rafecolton
Copy link
Copy Markdown
Member

Found an odd behavior: If I fill out the form, close it out without submitting, then reopen it, the values I provided are still there. If I close it and reopen it again without advancing to the magic code screen, the values all disappear.

Is that expected?

Screen.Recording.2026-05-27.at.2.49.36.PM.mov

Copy link
Copy Markdown
Member

@rafecolton rafecolton left a comment

Choose a reason for hiding this comment

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

Other than the odd behavior noted in my prior comment, this looks fine to me, and all of the tests you laid out pass. However, given how many times this has been reverted, maybe we could have QA do regression tests on an ad-hoc build once the Auth PR is deployed?

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b44ed7db9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// UI-prefilled values (geolocation country, normalized state) only live in component state until the user touches
// a field, so write the full form values to the draft before navigating so the confirm step submits them.
setDraftValues(ONYXKEYS.FORMS.PERSONAL_DETAILS_FORM, values);
skipClearDraftOnUnmountRef.current = true;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reset the draft-clear skip after canceling magic code

If a user edits details, presses Save, then closes the magic-code screen instead of submitting, this ref remains true when they return to the details page. Pressing Back from there unmounts the page but skips clearDraftValues, so abandoned edits stay in personalDetailsFormDraft and prefill the form the next time the user opens private personal details. Reset the flag when the confirm screen is dismissed or when the details page regains focus.

Useful? React with 👍 / 👎.

Comment on lines +153 to +155
if (!stateValue.trim()) {
errors[INPUT_IDS.STATE] = translate('common.error.fieldRequired');
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Validate US state values, not just presence

When the country is US, this only checks that stateValue is non-empty, so an existing non-US province such as Ontario can remain in the form after switching the country to United States and pass client validation. This page's own helper notes that StateSelector keys on 2-letter codes, so the US path should either clear invalid values on country change or reject values that are not keys in COMMON_CONST.STATES before submitting addressState.

Useful? React with 👍 / 👎.

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.

This is valid feedback actually. I was able to submit the form like this:

Screenshot 2026-05-27 at 3 48 17 PM

Then I get a mysterious error on the magic code screen:

Screenshot 2026-05-27 at 3 48 50 PM

We should stop the user from submitting an invalid form

@jasperhuangg
Copy link
Copy Markdown
Contributor Author

jasperhuangg commented May 27, 2026

maybe we could have QA do regression tests on an ad-hoc build once the Auth PR is deployed?

Good idea, I'll have them run through.. is there a list of pre-existing regression tests that you recommend I run through with them? Or would these just be ones I provide them myself?

@jasperhuangg
Copy link
Copy Markdown
Contributor Author

Found an odd behavior: If I fill out the form, close it out without submitting, then reopen it, the values I provided are still there. If I close it and reopen it again without advancing to the magic code screen, the values all disappear.

Is that expected?

Screen.Recording.2026-05-27.at.2.49.36.PM.mov

Hmm I see what you mean by it getting cleared out on the second time you close it, do you think this is something worth blocking on?

@rafecolton
Copy link
Copy Markdown
Member

rafecolton commented May 27, 2026

do you think this is something worth blocking on?

I just tested existing behavior, and fields aren't saved at all, so no, I don't think so. It would be nice to fix though if it's easy

Edit: Codex is suggesting we should clear these actually, so I'm not sure what the right behavior is. Maybe ask in Slack?

Is there a list of pre-existing regression tests that you recommend I run through with them? Or would these just be ones I provide them myself?

I'm not sure specifically. However the previous bugs were found I guess 😄

@jasperhuangg
Copy link
Copy Markdown
Contributor Author

Ah I see, I think unless a PR hits staging, then there's no way for us to run the full regression suite on it. For AdHoc builds I think we need to specify a specific set of tests we want them to run. So it's fine if we ship it to staging, it would suck if it gets reverted again but that's kinda the whole point of having a staging environment right?

@rafecolton
Copy link
Copy Markdown
Member

Ad-hoc builds will run against the the staging or production backend depending on what's configured in the troubleshooting settings. I don't think we should have them run a full regression suite on that, just the ones relevant to this flow

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.

3 participants