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

Search - Some users are not prioritized over chats or rooms #6627

Closed
kavimuru opened this issue Dec 7, 2021 · 44 comments
Closed

Search - Some users are not prioritized over chats or rooms #6627

kavimuru opened this issue Dec 7, 2021 · 44 comments
Assignees
Labels
Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@kavimuru
Copy link

kavimuru commented Dec 7, 2021

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


Issue was found when executing #6544

Action Performed:

  1. Open app and login
  2. Open the Search page.
  3. Search for something.
  4. verify search results

Expected Result:

Users appear first in the result list over group chats or rooms

Actual Result:

Some users appear after group chats or rooms

Workaround:

Unknown

Platform:

Where is this issue occurring?

  • Web
  • iOS
  • Android
  • Desktop App
  • Mobile Web

Version Number: 1.1.18.0

Reproducible in staging?: Yes

Reproducible in production?: Yes

Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:
Bug5362931_mesagge1

Bug5362931_Pr_6544.mp4

Expensify/Expensify Issue URL:
Issue reported by: Applause
Slack conversation:

View all open jobs on GitHub
Issue was found when executing #6544

@kavimuru kavimuru added the DeployBlockerCash This issue or pull request should block deployment label Dec 7, 2021
@OSBotify
Copy link
Contributor

OSBotify commented Dec 7, 2021

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open StagingDeployCash deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@MelvinBot
Copy link

Triggered auto assignment to @marcochavezf (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@Jag96
Copy link
Contributor

Jag96 commented Dec 7, 2021

cc @parasharrajat

@parasharrajat
Copy link
Member

I am not able to reproduce this on staging. From the vid, it seems the search is not even working.

@marcochavezf
Copy link
Contributor

I think I was able to reproduce the issue, the users marco+test2@expensifail.com and marco+test3@expensifail.com are appearing below the group chats:

Screen Shot 2021-12-07 at 14 35 05

There's no error in the console log of staging, but when I test locally I see these errors (not sure if it's related):

Screen Shot 2021-12-07 at 14 36 38

I will continue investigating.

@parasharrajat
Copy link
Member

It may be only causing issues for only email entries.

@marcochavezf
Copy link
Contributor

marcochavezf commented Dec 7, 2021

It may be only causing issues for only email entries.

ah are you referring to the console errors or the users that are appearing below the group chats?
Oh I see, the users that appear below are the email entries (no report chat created for those users). So seems the users that are not prioritized in the video are email entries, thus this is not an issue introduced by a recent change.

👋🏽 @Jag96 what could be the next action for this issue? do we remove the deploy blocker label?

@isagoico
Copy link

isagoico commented Dec 7, 2021

I think that the users that appear below the group chats are user that don't have a existing conversation with the logged in user.

@Jag96
Copy link
Contributor

Jag96 commented Dec 7, 2021

👋🏽 @Jag96 what could be the next action for this issue? do we remove the deploy blocker label?

@marcochavezf I think we can remove the deploy blocker label here since this seems like a case we missed in #6544 instead of a regression. I've posted in slack to double-check how we want to handle this case, but I think we can just make this a follow up to fix the missed case.

Removing the deploy blocker label and updating to daily and leaving assigned to me for now, but @isagoico I think we can check off #6544 if there aren't any regressions with search.

@Jag96 Jag96 added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Dec 7, 2021
@Jag96 Jag96 self-assigned this Dec 7, 2021
@Jag96
Copy link
Contributor

Jag96 commented Dec 7, 2021

@parasharrajat could you please update the logic from #6544 to include a fix for this?

@MelvinBot
Copy link

📣 @parasharrajat You have been assigned to this job by @Jag96!
Please apply to this job in Upwork and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@marcochavezf marcochavezf removed their assignment Dec 7, 2021
@parasharrajat
Copy link
Member

@isagoico Could you please share test account credentials with me to test this issue? I can't reproduce reliably on my testing account. You can slack me if that is the way. Thanks

@parasharrajat
Copy link
Member

parasharrajat commented Dec 9, 2021

@Jag96
Ok, so I have found the cause of this. First I would like to confirm the implementation.

  1. We need to put the personalDetails array in the correct position in the search item list. Currently we append this which is why this issue is happening.
    I think it should begetOptionsresponsibility to give the correct sorted list instead of merging thepersonalDetailsin therecentReports` ourself in the component. But this requires a minor refactor of the getOptions component.

I will merge the personalDetails array in the recentReports before sorting. Now personalDetails would always me [] and they would be merged in recentReports in the correct sorted Order. This require dev attention every time someone turn sortByReportTypeInSearch on.

    return {
        personalDetails: personalDetailsOptions,
        recentReports: recentReportOptions,
        userToInvite,
    };

Second, we can divide the recentreports into two sections (first for 1:1 chat and second for other) and place the third section of personalDetails after the first section. So that order will be maintained in SearchPage.

let me know. Which one do you like?

Both of these approaches will fix the issue of the duplicate rooms as I said here #5699 (comment) Due to the reason that keys are duplicated in the section list and thus old items with the same keys are never removed.

At last, I think this should be added as a milestone of the existing contract as this case was missed in the main issue and it is an extension to the old code or not caused by the old PR's code.

@parasharrajat
Copy link
Member

@Jag96 What do you think? I am ready to send the PR.

@roryabraham
Copy link
Contributor

@parasharrajat @Jag96's going to be ooo for a few days, I'm going to temporarily take over as CME here. Just catching up now...

@roryabraham roryabraham assigned roryabraham and unassigned Jag96 Dec 9, 2021
@roryabraham
Copy link
Contributor

We need to put the personalDetails array in the correct position in the search item list. Currently we append this which is why this issue is happening.

So just to clarify, this code is what you're referring to, right?

I think it should be getOptions responsibility to give the correct sorted list instead of merging the personalDetails in the recentReports ourself in the component.

I agree

I will merge the personalDetails array in the recentReports before sorting.

Makes sense

Now personalDetails would always me [] and they would be merged in recentReports in the correct sorted Order. This require dev attention every time someone turn sortByReportTypeInSearch on.

Unfortunately I got a bit confused at this point. Can you explain what you meant by this?

@parasharrajat
Copy link
Member

I'm going to temporarily take over as CME here. Just catching up now.

Thanks.

So just to clarify, this code is what you're referring to, right?

Exactly.

Now personalDetails would always me [] and they would be merged in recentReports in the correct sorted Order. This require dev attention every time someone turn sortByReportTypeInSearch on.

When we will merge the personalDetails in the main recentChats while sortByReportTypeInSearch is true. There is no use of returning the duplicate personalDetails array. It will become confusing and error prone. So I suggest returning []. Now Someone using this flag should be cautious that personalDetails would be merged in the recentReports and personalDetails would be empty. It could be confusing why personalDetails is empty.

@parasharrajat
Copy link
Member

PR Up... Testing it.

@MelvinBot MelvinBot added Overdue and removed Overdue labels Dec 31, 2021
@roryabraham
Copy link
Contributor

Sorry for the delay here @parasharrajat, reviewed the PR earlier today

@MelvinBot MelvinBot removed the Overdue label Jan 12, 2022
@parasharrajat
Copy link
Member

From #6627 (comment)

At last, I think this should be added as a milestone of the existing contract as this case was missed in the main issue and it is an extension to the old code or not caused by the old PR's code.

Still waiting for the Upwork job to be created.

@roryabraham roryabraham added the External Added to denote the issue can be worked on by a contributor label Jan 18, 2022
@MelvinBot
Copy link

Triggered auto assignment to @adelekennedy (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@roryabraham
Copy link
Contributor

Sorry your payment got lost in the shuffle here, @parasharrajat! @adelekennedy Can we create an Upwork job for this, then hire @parasharrajat? The PR is currently on staging.

@MelvinBot MelvinBot removed the Overdue label Jan 18, 2022
@mvtglobally
Copy link

Issue not reproducible during KI retests. (First week)

@adelekennedy
Copy link

Hired!

@parasharrajat
Copy link
Member

Thanks, @adelekennedy

@roryabraham
Copy link
Contributor

The fix for this was deployed to production 6 days ago. There were some comments on the PR but it sounds like an unrelated bug. So @adelekennedy I think we should be good to pay this out tomorrow.

@MelvinBot MelvinBot removed the Overdue label Jan 24, 2022
@adelekennedy
Copy link

Noted! Have it on my calendar to pay out on 1/25 - then I will close the job

@mvtglobally
Copy link

@adelekennedy @roryabraham Can you check below video. We seem to be able to repro the issue.

6627.mp4

Also, we noticed that exact search match is not always displayed on Top. Not sure if its related to this PR
Web_6627-2201

@adelekennedy
Copy link

Double checking here @roryabraham the job is closed and paid out - but do we need to reopen the job?

@MelvinBot MelvinBot removed the Overdue label Jan 30, 2022
@roryabraham
Copy link
Contributor

Honestly, I can't keep track of all the expected behavior in the labyrinth that is OptionsListUtils. I think that we should close this and add a new issue to:

  1. First, clearly and thoroughly define the results ordering, accounting for:
    1. DM's, group chats, policy default rooms, workspace chats, user-created rooms
    2. How the order might change for the New Chat or New Group pages, and for users that don't yet have Expensify accounts.
  2. Create unit tests to cover all those expected results.
  3. Attempt to DRY up and generalize all the logic we have now.
  4. Patch logic as necessary to make tests pass.

Thoughts? cc @parasharrajat

@parasharrajat
Copy link
Member

parasharrajat commented Feb 1, 2022

Ok, nice thoughts @roryabraham. We should certainly do that. But #6627 (comment) is a different issue.

it is not the order of options. I think QA is saying that the search is not working properly. The exact match should come first.

So the search should also look into the personalDetails (contacts) with respect to Recent reports(chats). This should be a separate issue and thus we can close this and create a new one. Also, plan the order properly (based on your thoughts) and then fix it.

@adelekennedy adelekennedy removed their assignment Feb 2, 2022
@roryabraham
Copy link
Contributor

Created a follow-up: #7582

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

10 participants