Skip to content

[PER-10742] Show warning for non US/Canada phone numbers - #1182

Open
aasandei-vsp wants to merge 4 commits into
mainfrom
PER-10742-fix-phone-number-verification
Open

aasandei-vsp wants to merge 4 commits into
mainfrom
PER-10742-fix-phone-number-verification

Conversation

@aasandei-vsp

Copy link
Copy Markdown
Contributor

Manual test cases — warning on a phone number we cannot text

Setup: Log in and open Account Settings → Email and Phone. You need: one account with no mobile phone saved, one whose phone shows Verified, one with +44 20 7946 0958 already stored and unverified, and one with 876 555 0123 (a Jamaican number) already stored and unverified. No feature flag gates this work.

The Mobile Phone row now carries a permanent line of helptext above it, a warning appears under the field while you type a number Permanent cannot text, and the same warning sits beneath the Verification Status row for a stored number that cannot be reached.


Account Settings — a stored number, with no editing ⭐

(This is the case that did not exist before at all — the warning has to appear from what the server returned, without anybody touching the field.)

Scenario — an unreachable stored number warns on load

  1. Load Account Settings on the account holding +44 20 7946 0958, and do not click anything.
    • EXPECTED: Permanent can only send verification codes to US and Canada numbers. is shown beneath the Verification Status row, and Permanent only supports US and Canada numbers. beneath the Mobile Phone field.
  2. Reload the page.
    • EXPECTED: Both are still there.

Scenario — a Jamaican number warns too

  1. Load Account Settings on the account holding 876 555 0123.
    • EXPECTED: The same warning beneath Verification Status. This number is shaped exactly like a US one and dials as +1, so this is the case the area-code list exists for.

Scenario — a verified number is never warned about

  1. On the account whose phone shows Verified, look at both Mobile Phone rows.
    • EXPECTED: Verified is shown and no warning appears, even if the stored number is not a plain ten-digit US number.

Account Settings — typing a number ⭐

Scenario — a US number never warns

  1. Click the Mobile Phone value to start editing.
    • EXPECTED: The field opens for editing.
  2. Type (202) 555-0147, one character at a time.
    • EXPECTED: No warning appears at any point while typing.
  3. Click Save.
    • EXPECTED: Account information saved., the value reads (202) 555-0147, and no warning is shown anywhere in the group.

Scenario — a US number typed with the country code

  1. Start editing and type +1 (202) 555-0147 one character at a time.
    • EXPECTED: No warning at any point — in particular none at the moment the tenth digit is typed, which is the case that used to flash.
  2. Click Save.
    • EXPECTED: Saves, no warning.

Scenario — a Canadian number and a Puerto Rican number

  1. Save 416 555 0147, then 787 555 0147.
    • EXPECTED: Both save with no warning at any point. Puerto Rico is a US number and must not be treated as foreign.

Scenario — an international number warns partway through

  1. Start editing and type +44 20 7946.
    • EXPECTED: No warning yet.
  2. Carry on until the field reads +44 20 7946 0958.
    • EXPECTED: Permanent can only send verification codes to US and Canada numbers. appears beneath the field.
  3. Click Save.
    • EXPECTED: The save succeeds — Account information saved. — and the number is stored. This is deliberate: the warning advises, it does not refuse.
  4. Look at the Verification Status row.
    • EXPECTED: The same sentence beneath that row, and Verify Phone Number still enabled.

Scenario — clearing the number

  1. With the international number saved, start editing and delete everything in the field.
    • EXPECTED: No warning while the field is empty.
  2. Click Save.
    • EXPECTED: Saves, the field shows the Mobile Phone Number placeholder, and no warning anywhere — only the helptext remains.

Scenario — cancelling an edit

  1. Start editing a saved US number, type over it until the warning appears, then click Cancel.
    • EXPECTED: The field reverts to the saved number and the warning beneath the field disappears.
  2. Click the value again to reopen the editor.
    • EXPECTED: No warning is showing at the moment the editor opens.

Verify Phone screen ⭐

(The first scenario is the one that was completely silent before — the send failed into nothing and no message of any kind was produced.)

Scenario — the limitation is named when a code cannot be sent

  1. With an unreachable number saved and unverified, click Verify Phone Number.
    • EXPECTED: You land on the Verify Phone screen, and if the code cannot be sent an error appears ending with Permanent can only send verification codes to US and Canada numbers.
  2. Open the browser console.
    • EXPECTED: No unhandled promise rejection.
  3. Click Resend Code.
    • EXPECTED: The same error. It must not contain a bare key such as error.auth.lookup.

Scenario — offline and back

  1. Go offline in devtools, then click Resend Code.
    • EXPECTED: An error appears naming the limitation, and no unhandled rejection in the console. This is the network-error path, which used to throw inside the error handler itself.
  2. Go back online and click Resend Code again.
    • EXPECTED: The request goes through normally.

Scenario — the email flow is unchanged

  1. On an account with an unverified email, click Verify Email Address and press Resend Code.
    • EXPECTED: Any error shown is the ordinary email message and does not mention US and Canada.

Regression — the other inline editors

Cheap sanity checks. The shared inline editor changed, so these are worth one click each.

Scenario — other text fields still save

  1. In Account Settings, edit Account Email and save.
    • EXPECTED: Saves normally, and no warning line appears under any field.
  2. Open a record's info sidebar, edit a text field and save.
    • EXPECTED: Saves normally, no warning line.
  3. Open Billing Settings, edit one text field and save; do the same for one text field in the profile editor.
    • EXPECTED: Both save normally, no warning line.

The SMS provider we are using for verifying phone numbers only
validates US and Canada, so this utility will check to see what
area this number is from.

Issue: PER-10742
…alue

Up until now we didn't have a way to check the value in the inline edit
component while is being typed, so adding a new emitter will enable
us to validate before actually saving.

Issue: PER-10472
Show a warning message if the phone number that is being typed or even if
it's already stored to let the user know the we cannot verify it.

Issue: PER-10742
When the user gets to the phone number verification page and
introduces a code, up until now there was no error shown in case
the code was wrong.

Issue: PER-10742
@codecov

codecov Bot commented Sep 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.30508% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 53.89%. Comparing base (3362384) to head (0069352).

Files with missing lines Patch % Lines
...nts/account-settings/account-settings.component.ts 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1182      +/-   ##
==========================================
+ Coverage   53.68%   53.89%   +0.20%     
==========================================
  Files         368      369       +1     
  Lines       12925    12983      +58     
  Branches     2363     2378      +15     
==========================================
+ Hits         6939     6997      +58     
+ Misses       5752     5749       -3     
- Partials      234      237       +3     

☔ 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.

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