Skip to content

[Due for payment 2025-08-07] [$250] Wrong validation for empty case of first name and last name in I know a teacher section #66018

Closed

Description

@m-natarajan

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.1.80-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @dukenv0307
Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

  1. Login to ND
  2. Go to Account —> Save the world —> I know a teacher
  3. Leave all the input empty and press Let’s do this!
  4. Observe the error message

Expected Result:

Error message similar to First name cannot be empty, last name cannot be empty

Actual Result:

Error message displayed as Name cannot contain a comma or semicolon for both fields

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop
Platforms Tested: On which of our officially supported platforms was this issue tested:
  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Screen_Recording_2025-07-12_at_00.46.02.mov
Image

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021944618731916781265
  • Upwork Job ID: 1944618731916781265
  • Last Price Increase: 2025-07-21
  • Automatic offers:
    • QichenZhu | Reviewer | 108170537
    • Krishna2323 | Contributor | 108170538
Issue OwnerCurrent Issue Owner: @kadiealexander

Activity

  1. added
    Daily
    Bug
    on Jul 14, 2025
  2. melvin-bot commented on Jul 14, 2025

    @melvin-bot

    Triggered auto assignment to @kadiealexander (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. m-natarajan commented on Jul 14, 2025

    @m-natarajan
    Author

    Proposal by @dukenv0307

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Wrong validation for empty case of first name and last name in I know a teacher section

    What is the root cause of that problem?

    We don't separate the empty case check

    if (!values.firstName || !isValidDisplayName(values.firstName)) {

    if (!values.lastName || !isValidDisplayName(values.lastName)) {

    What changes do you think we should make in order to solve the problem?

    We should seperate the empty case check like in personal display name

    } else if (values.firstName.length === 0) {

                if (!isValidDisplayName(values.firstName)) {
                    addErrorMessage(errors, 'firstName', translate('personalDetails.error.hasInvalidCharacter'));
                } else if (values.firstName.length > CONST.DISPLAY_NAME.MAX_LENGTH) {
                    addErrorMessage(
                        errors,
                        'firstName',
                        translate('common.error.characterLimitExceedCounter', {
                            length: values.firstName.length,
                            limit: CONST.DISPLAY_NAME.MAX_LENGTH,
                        }),
                    );
                } else if (values.firstName.length === 0) {
                    addErrorMessage(errors, 'firstName', translate('personalDetails.error.requiredFirstName'));
                }
                if (!isValidDisplayName(values.lastName)) {
                    addErrorMessage(errors, 'lastName', translate('personalDetails.error.hasInvalidCharacter'));
                } else if (values.lastName.length > CONST.DISPLAY_NAME.MAX_LENGTH) {
                    addErrorMessage(
                        errors,
                        'lastName',
                        translate('common.error.characterLimitExceedCounter', {
                            length: values.lastName.length,
                            limit: CONST.DISPLAY_NAME.MAX_LENGTH,
                        }),
                    );
                } else if (values.lastName.length === 0) {
                    addErrorMessage(errors, 'lastName', translate('personalDetails.error.requiredLastName'));
                }

    And add appropriate translation to all translation files, example EN file

    requiredLastName: 'Last name cannot be empty',

    requiredFirstName: 'First name cannot be empty',

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    NA

    What alternative solutions did you explore? (Optional)

  4. added
    External
    on Jul 14, 2025
  5. changed the title [-]Wrong validation for empty case of first name and last name in I know a teacher section[/-] [+][$250] Wrong validation for empty case of first name and last name in I know a teacher section[/+] on Jul 14, 2025
  6. moved this to Bugs and Follow Up Issues in #expensify-bugson Jul 14, 2025
  7. melvin-bot commented on Jul 14, 2025

    @melvin-bot
  8. added
    Help Wanted
    on Jul 14, 2025
  9. melvin-bot commented on Jul 14, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @QichenZhu (External)

  10. Krishna2323 commented on Jul 14, 2025

    @Krishna2323
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-07-22 18:46:59 UTC.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Wrong validation for empty case of first name and last name in I know a teacher section

    What is the root cause of that problem?

    What changes do you think we should make in order to solve the problem?

    • Remove !values.firstName || from the conditions below:
      if (!values.firstName || !isValidDisplayName(values.firstName)) {
      addErrorMessage(errors, 'firstName', translate('personalDetails.error.hasInvalidCharacter'));

      if (!values.lastName || !isValidDisplayName(values.lastName)) {
      addErrorMessage(errors, 'lastName', translate('personalDetails.error.hasInvalidCharacter'));
    • Update the error object initialization to:
    const errors = getFieldRequiredErrors(values, [INPUT_IDS.FIRST_NAME, INPUT_IDS.LAST_NAME]);

    • The same function is used in many places in the app and it uses isEmptyString which is important to validate after removing invisible characters.
      /**
      * Check if the string would be empty if all invisible characters were removed.
      */
      function isEmptyString(value: string): boolean {
      // We implemented a custom emoji on this Unicode Private Use Area (PUA) code point
      // so we should not remove it.
      // Temporarily replace \uE100 with a placeholder
      const PLACEHOLDER = '<<KEEP_E100>>';
      let transformed = value.replace(/\uE100/g, PLACEHOLDER);
      // \p{C} matches all 'Other' characters
      // \p{Z} matches all separators (spaces etc.)
      // Source: http://www.unicode.org/reports/tr18/#General_Category_Property
      transformed = transformed.replace(CONST.REGEX.INVISIBLE_CHARACTERS_GROUPS, '');
      // Remove other invisible characters that are not in the above unicode categories
      transformed = transformed.replace(CONST.REGEX.OTHER_INVISIBLE_CHARACTERS, '');
      transformed = transformed.replace(new RegExp(PLACEHOLDER, 'g'), '\uE100');
      // Check if after removing invisible characters the string is empty
      return transformed === '';
      }
    Image
    • We might want to use isRequiredFulfilled, isEmptyString or getFieldRequiredErrors in BaseOnboardingPersonalDetails and DisplayNamePage for consistency.
    • We can also update all the instances where we have used personalDetails.error.requiredFirstName and onboarding.error.requiredFirstName. We can check with the marketing team if we need to fix them or not.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

    Result

  11. PiyushChandra17 commented on Jul 14, 2025

    @PiyushChandra17
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Wrong validation for empty case of first name and last name in I know a teacher section

    What is the root cause of that problem?

    Currently, we are using the incorrect validation message here

    hasInvalidCharacter: 'Name cannot contain a comma or semicolon',

    if (!values.firstName || !isValidDisplayName(values.firstName)) {
    addErrorMessage(errors, 'firstName', translate('personalDetails.error.hasInvalidCharacter'));

    if (!values.lastName || !isValidDisplayName(values.lastName)) {
    addErrorMessage(errors, 'lastName', translate('personalDetails.error.hasInvalidCharacter'));

    What changes do you think we should make in order to solve the problem?

    Update the abhove with,

    if (!values.firstName) {
        addErrorMessage(errors, 'firstName', translate('personalDetails.error.requiredFirstName'));
    }
    
    if (!isValidDisplayName(values.firstName)) {
         addErrorMessage(errors, 'firstName', translate('personalDetails.error.hasInvalidCharacter'));
    }
    if (!values.lastName) {
        addErrorMessage(errors, 'lastName', translate('personalDetails.error.requiredLastName'));
    }
    
    if (!isValidDisplayName(values.lastName)) {
        addErrorMessage(errors, 'lastName', translate('personalDetails.error.hasInvalidCharacter'));
    }

    Add this translation

    • requiredLastName: 'Last name cannot be empty',

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    What alternative solutions did you explore? (Optional)

    Result

    Image Image

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  12. 21 remaining items

  13. changed the title [-][$250] Wrong validation for empty case of first name and last name in I know a teacher section[/-] [+][Due for payment 2025-08-07] [$250] Wrong validation for empty case of first name and last name in I know a teacher section[/+] on Jul 31, 2025
  14. melvin-bot commented on Jul 31, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  15. removed
    Reviewing
    on Jul 31, 2025
  16. melvin-bot commented on Jul 31, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.87-14 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2025-08-07. 🎊

    For reference, here are some details about the assignees on this issue:

  17. melvin-bot commented on Jul 31, 2025

    @melvin-bot

    @QichenZhu @kadiealexander The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  18. added
    Daily
    and removed
    Weekly
    on Aug 6, 2025
  19. kadiealexander commented on Aug 7, 2025

    @kadiealexander
    Contributor

    Payment Summary

    @QichenZhu could you please complete the checklist?

  20. QichenZhu commented on Aug 7, 2025

    @QichenZhu
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: https://github.com/Expensify/App/pull/47027/files#r2259035507

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: N/A.

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

      This issue only involves text copy, so I don't think it's worth a regression test. Let me know if you disagree, and I can propose test steps.

  21. Krishna2323 commented on Aug 7, 2025

    @Krishna2323
    Contributor

    @kadiealexander I'm now eligible for payments through NewDot. I have ended the Upwork contract. I'm not able to decline the Upwork offer, please withdraw if possible.

    Ref: #64948 (comment)
    


  22. kadiealexander commented on Aug 8, 2025

    @kadiealexander
    Contributor

    Revoked Upwork offer and updated payment summary. Please request payment in ND.

  23. moved this from Bugs and Follow Up Issues to Done in #expensify-bugson Aug 8, 2025
  24. Krishna2323 commented on Aug 8, 2025

    @Krishna2323
    Contributor

    $250 requested in NewDot.

  25. flaviadefaria commented on Aug 13, 2025

    @flaviadefaria
    Contributor

    $250 approved for @Krishna2323

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions