Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOLD for payment 2023-07-17] [$1000] Capitalization in email search causing duplicate email in member invite preview #21599

Closed
1 of 6 tasks
kavimuru opened this issue Jun 26, 2023 · 39 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@kavimuru
Copy link

kavimuru commented Jun 26, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Create a new workspace in settings and navigate to the member section to invite new members.
  2. Search for a member by capitalizing the first letter of their email and marking it.
  3. Search for the same email with all lowercase letters and notice that it appears as a duplicate. Mark it as well.
  4. Add the marked emails to the members and notice that only the email with all lowercase letters is invited, while the capitalized email is not invited, causing confusion for users

Expected Result:

When searching for an email, capitalization should not affect the search results, and duplicate emails should not appear in the member invite preview.

Actual Result:

When searching for an email by capitalizing the first letter and marking it, and then searching for the same email with all lowercase letters, the email appears as a duplicate in the member invite preview. Only the email with all lowercase letters is invited, causing confusion for users

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.32-5
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
Notes/Photos/Videos: Any additional supporting documentation
screen-capture (37).webm

Recording.5165.mp4

Expensify/Expensify Issue URL:
Issue reported by: @tewodrosGirmaA
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1687338486243019

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~017ccc4dfa896d2e90
  • Upwork Job ID: 1673472018851819520
  • Last Price Increase: 2023-06-26
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 26, 2023
@eh2077
Copy link
Contributor

eh2077 commented Jun 26, 2023

Proposal

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

Capitalization in email search causing duplicate email in member invite preview.

What is the root cause of that problem?

The root cause of this issue is that when the search value is a legal email to invite

  1. We don't convert it to lowercase for userToInvite.login, see the snippet to construct userToInvite, and
  2. We do case sensitive comparing when determining hasUnselectedUserToInvite, see snippet

So, we're able to search and select multiple emails, like, [email protected], [email protected] and [email protected] , which are same because email is case insensitive.

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

According to the RCA above and the fact that email is case insensitive, I think we can fix this issue from the snippet to construct userToInvite.

To achieve it, we can add a variable userLoginToInvite which is lowercase of searchValue

const userLoginToInvite = searchValue.toLowerCase();

after this line

const optimisticAccountID = UserUtils.generateAccountID();

and replace all usages of searchValue to userLoginToInvite within the snippet to construct userToInvite. The key replacement is this line

userToInvite.login = searchValue;

to avoid searching and selecting duplicates. While replacing all usages within the snippet will be helpful to avoid confusion from UX. For example, if we start searching [email protected], then there'll be an optional email [email protected] with capital letter to invite. But after invited, the backend will convert the email to lowercase [email protected] from the Workspace members list page.

Click to see demo video
Screen.Recording.2023-06-25.at.7.41.12.PM.mov

What alternative solutions did you explore? (Optional)

As discussed, we can change searchInputValue to lower at [beginning](

const searchValue = parsedPhoneNumber.possible ? parsedPhoneNumber.number.e164 : searchInputValue;

@melvin-bot
Copy link

melvin-bot bot commented Jun 26, 2023

Triggered auto assignment to @kevinksullivan (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jun 26, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@kevinksullivan
Copy link
Contributor

reproduced
image

@kevinksullivan kevinksullivan added the External Added to denote the issue can be worked on by a contributor label Jun 26, 2023
@melvin-bot melvin-bot bot changed the title Capitalization in email search causing duplicate email in member invite preview [$1000] Capitalization in email search causing duplicate email in member invite preview Jun 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 26, 2023

Job added to Upwork: https://www.upwork.com/jobs/~017ccc4dfa896d2e90

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 26, 2023

Current assignee @kevinksullivan is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jun 26, 2023

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

@melvin-bot melvin-bot bot added the Overdue label Jun 29, 2023
@sobitneupane
Copy link
Contributor

@eh2077 Thanks for your proposal.

How about converting searchInputValue to lower case at the beginning of getOptions() function (if we decide to make all searches case insensitive)? Why did you propose to convert in down the function? Is there any unwanted behavior if we do it in the beginning?

@melvin-bot melvin-bot bot removed the Overdue label Jun 30, 2023
@eh2077
Copy link
Contributor

eh2077 commented Jun 30, 2023

@sobitneupane Thanks for reviewing proposal!

How about converting searchInputValue to lower case at the beginning of getOptions() function (if we decide to make all searches case insensitive)?

That's a great point. I think we can convert searchInputValue to lower case at the beginning of getOptions() function.
I checked the usages of searchValue in the getOptions() function and confirmed that lower case of searchValue won’t break following usages in the function

if (searchValue && !isSearchStringMatch(searchValue, searchText, participantNames, isChatRoom)) {

if (searchValue && !isSearchStringMatch(searchValue, searchText, participantNames, isChatRoom)) {

if (searchValue && !isSearchStringMatch(searchValue, currentUserOption.searchText)) {

if (option.login.toLowerCase() !== searchValue.toLowerCase()) {

In method isSearchStringMatch, we also do case insensitive matching.

Why did you propose to convert in down the function? Is there any unwanted behavior if we do it in the beginning?

I think I overlooked these lines

if (option.login.toLowerCase() !== searchValue.toLowerCase()) {
return 1;
}
// When option.login is an exact match with the search value, returning 0 puts it at the top of the option list
return 0;

I thought that case matters when ordering at the first glance of the condition and the comments. But, actually, it'll be safe to convert searchInputValue to lower case at the beginning of getOptions() function.

@eh2077
Copy link
Contributor

eh2077 commented Jun 30, 2023

Proposal

Updated to convert searchInputValue to lower case at the beginning of getOptions() function.

cc @sobitneupane

@melvin-bot melvin-bot bot added the Overdue label Jul 3, 2023
@sobitneupane
Copy link
Contributor

Proposal from @eh2077 looks good to me. Since we are doing case insensitive matching, I don't think converting the searchInputValue to lowercase will have any unwanted impact.

🎀 👀 🎀 C+ reviewed

@melvin-bot melvin-bot bot removed the Overdue label Jul 3, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 3, 2023

Triggered auto assignment to @thienlnam, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 3, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 3, 2023

📣 @sobitneupane 🎉 An offer has been automatically sent to your Upwork account 🎉

Reviewer - [$1000] Capitalization in email search causing duplicate email in member invite preview

@melvin-bot
Copy link

melvin-bot bot commented Jul 3, 2023

📣 @eh2077 You have been assigned to this job!
Please apply to this job in Upwork here and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs!
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot
Copy link

melvin-bot bot commented Jul 3, 2023

📣 @tewodrosGirmaA You have been assigned to this job!
Please apply to this job in Upwork here and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs!
Keep in mind: Code of Conduct | Contributing 📖

@eh2077
Copy link
Contributor

eh2077 commented Jul 4, 2023

There's a deploy blocker #22123 blocks the testing of this PR. I'm going to revert that issue PR or apply the on-going fix to continue test PR for this issue.

cc @sobitneupane

@kevinksullivan
Copy link
Contributor

This is awaiting payment after regression period ends, right? It's no longer in review?

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Jul 10, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Capitalization in email search causing duplicate email in member invite preview [HOLD for payment 2023-07-17] [$1000] Capitalization in email search causing duplicate email in member invite preview Jul 10, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 10, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 10, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 10, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.38-7 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 2023-07-17. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Jul 10, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:
  • [@sobitneupane] 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:
  • [@sobitneupane] A discussion in #expensify-bugs 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:
  • [@sobitneupane] Determine if we should create a regression test for this bug.
  • [@sobitneupane] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@kevinksullivan] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@kevinksullivan
Copy link
Contributor

Hi @sobitneupane please complete the steps above so I can pay this out on time!

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Jul 17, 2023
@eh2077
Copy link
Contributor

eh2077 commented Jul 20, 2023

Friendly bump @kevinksullivan This is ready for payment

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jul 20, 2023
@sobitneupane
Copy link
Contributor

sobitneupane commented Jul 24, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:

I could not locate the exact PR. This could have been created by the change in backend as well.

  • [@sobitneupane] A discussion in #expensify-bugs 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:

https://expensify.slack.com/archives/C049HHMV9SM/p1690209472452549

  • [@sobitneupane] Determine if we should create a regression test for this bug.

Yes.

  • [@sobitneupane] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

#21599 (comment)

@melvin-bot melvin-bot bot removed the Overdue label Jul 24, 2023
@sobitneupane
Copy link
Contributor

Regression Test Proposal

  1. Go to Settings => Workspaces => Select a Workspace => Members => Invite new members
  2. Search email [email protected] and select it
  3. Search email [email protected]
  4. Verify that email [email protected] remain selected and there's not new email option like [email protected]

Do we agree 👍 or 👎

@kevinksullivan
Copy link
Contributor

@eh2077 @sobitneupane @tewodrosGirmaA offers sent. Can you let me know here when you've accepted?

@eh2077
Copy link
Contributor

eh2077 commented Jul 24, 2023

@kevinksullivan Accepted offer, thanks!

@sobitneupane
Copy link
Contributor

Payment Requested on newDot.

@kevinksullivan
Copy link
Contributor

Ah sorry @sobitneupane . I'll withdraw the offer on upwork.

@melvin-bot melvin-bot bot added the Overdue label Jul 26, 2023
@eh2077
Copy link
Contributor

eh2077 commented Jul 27, 2023

Bump @kevinksullivan

@melvin-bot melvin-bot bot removed the Overdue label Jul 27, 2023
@JmillsExpensify
Copy link

@kevinksullivan Can you please summarize the appropriate individual payments for all parties involved in this issue? This is holding up @sobitneupane's NewDot payments. More information on this compliance process in Slack.

@kevinksullivan
Copy link
Contributor

Payout summary:

@JmillsExpensify
Copy link

Reviewed details for @sobitneupane. This is accurate based on summary from Business Reviewer and approved for payment in NewDot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

7 participants