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 2024-06-13] User profile - App shows Hidden profile instead of not here page when profile link is invalid #42750

Closed
6 tasks done
izarutskaya opened this issue May 29, 2024 · 26 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering Weekly KSv2

Comments

@izarutskaya
Copy link

izarutskaya commented May 29, 2024

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


Version Number: 1.4.76-0
Reproducible in staging?: Y
Reproducible in production?: N
Found when executing PR : #42464
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to any chat.
  3. Send a link of an invalid profile (https://staging.new.expensify.com/a/hellodsdsdsdsdsd
    ).
  4. Click on the link.

Expected Result:

App will show not here page.

Actual Result:

App shows profile of a Hidden user.
When clicking on Message Hidden, the report shows error.

Workaround:

Unknown

Platforms:

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

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

Screenshots/Videos

Bug6494994_1716979769510.invalid_user.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @joekaufmanexpensify
@izarutskaya izarutskaya added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. DeployBlocker Indicates it should block deploying the API labels May 29, 2024
Copy link

melvin-bot bot commented May 29, 2024

Triggered auto assignment to @carlosmiceli (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link

melvin-bot bot commented May 29, 2024

Triggered auto assignment to @joekaufmanexpensify (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.

@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels May 29, 2024
Copy link
Contributor

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

@izarutskaya
Copy link
Author

@joekaufmanexpensify I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors.

@izarutskaya
Copy link
Author

We think this issue might be related to the #vip-vsb.

@izarutskaya
Copy link
Author

Production

bandicam.2024-05-29.14-29-34-189.mp4

@Tony-MK
Copy link
Contributor

Tony-MK commented May 29, 2024

Proposal

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

User profile - App shows Hidden profile instead of not here page when profile link is invalid

What is the root cause of that problem?

The problem is that #41846 changed to a condition to check if the accountID is present or if the user details are not found.

<ScreenWrapper testID={ProfilePage.displayName}>
<FullPageNotFoundView shouldShow={CONST.RESTRICTED_ACCOUNT_IDS.includes(accountID)}>

Therefore, the ValidationUtils.isValidAccountRoute function marks the accountID as invalid even if the accountID is NaN because the route.params?.accountID is hellodsdsdsdsdsd which becomes NaN.

https://github.com/Tony-MK/Expensify-App/blob/79ae8a17ec5d6b104f4b46c5f10992797e41c121/src/pages/ProfilePage.tsx#L93

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

We need to check if the user is not found by checking if the user account is not Nan for the route.params?.accountID and for the ValidationUtils.isValidAccountRoute function.

@Kicu
Copy link
Member

Kicu commented May 29, 2024

hey I did the PR that broke this, but I was originally tried to fix this problem: #40989 which was exactly the reverse - that in offline mode we showed not found page.

However I see the underlying problem - in offline mode, when api is not available how can the App tell whether an email is valid or not?
This simple solution suggested above by @Tony-MK, that is adding !isEmptyObject(details.avatar) to the check will bring back this bug: #40989

I'm happy to provide a fix but Im not sure what behavior we want re: invalid profile/profile in offline mode?

@Tony-MK
Copy link
Contributor

Tony-MK commented May 29, 2024

@Kicu, After rechecking the problem, it has to do with the accountID becoming Nan because route.params?.accountID is not a number but string.

@Kicu
Copy link
Member

Kicu commented May 29, 2024

oh thanks for extra info 👍
But that seems weird that accountID is a string. Usually ids of workspaces/policies are strings, whereas if it's a user the id was always a number. The line responsible for parsing (in ProfilePage):

    const accountID = Number(route.params?.accountID ?? 0);

is not something I added - that was already there.

I will be monitoring this task if any further changes are needed but at this moment I'm unsure what I could fix/change.

@mountiny mountiny assigned mountiny and unassigned carlosmiceli May 29, 2024
@mountiny
Copy link
Contributor

I will take this over as i am reviewer on that pr

@mountiny mountiny removed the DeployBlocker Indicates it should block deploying the API label May 29, 2024
@joekaufmanexpensify
Copy link
Contributor

Thanks Vit!

@Tony-MK
Copy link
Contributor

Tony-MK commented May 29, 2024

Hey @Kicu, the line below makes details = {accountID: 0},

const details: PersonalDetails | EmptyObject = personalDetails?.[accountID] ?? (ValidationUtils.isValidAccountRoute(accountID) ? {} : {accountID: 0});

So, this new condition should work.

<FullPageNotFoundView 
  shouldShow={details.accountID === 0 || CONST.RESTRICTED_ACCOUNT_IDS.includes(accountID)}
>

@Kicu
Copy link
Member

Kicu commented May 29, 2024

Okey great suggestion, thanks.
I will test this locally, do you want me to provide the PR @mountiny ?

@joekaufmanexpensify
Copy link
Contributor

@Kicu yeah if you could raise a PR that would be great. Is there an ETA for when you could have one up?

@Tony-MK
Copy link
Contributor

Tony-MK commented May 29, 2024

Since I am pretty free, could I raise the PR?

Thanks

@joekaufmanexpensify
Copy link
Contributor

@Tony-MK generally we try have the same person who introduced a deploy blocker fix it, if they're available. We appreciate your enthusiasm though!

@Kicu
Copy link
Member

Kicu commented May 29, 2024

I will do it

@mountiny
Copy link
Contributor

Thanks for the discussion, I think that this is very specific flow that user will not really get into.

And if they will, the App works fine, and does not crash or anything so I think @Kicu @s77rt should fix this as the authors of the original PR with urgency, but I will remove the deploy blocker label

@mountiny mountiny added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels May 29, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels May 29, 2024
@Kicu
Copy link
Member

Kicu commented May 29, 2024

PR with fix is here: #42769

I hope there is no more edge cases for this view that I missed, but what I did should be equivalent to the code that was handling this previously

@joekaufmanexpensify
Copy link
Contributor

PR awaiting deploy

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jun 6, 2024
@melvin-bot melvin-bot bot changed the title User profile - App shows Hidden profile instead of not here page when profile link is invalid [HOLD for payment 2024-06-13] User profile - App shows Hidden profile instead of not here page when profile link is invalid Jun 6, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 6, 2024
Copy link

melvin-bot bot commented Jun 6, 2024

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

Copy link

melvin-bot bot commented Jun 6, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.79-11 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 2024-06-13. 🎊

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

  • @Kicu does not require payment (Contractor)
  • @s77rt requires payment (Needs manual offer from BZ)

Copy link

melvin-bot bot commented Jun 6, 2024

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:

  • [@s77rt] The PR that introduced the bug has been identified. Link to the PR:
  • [@s77rt] 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:
  • [@s77rt] 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:
  • [@s77rt] Determine if we should create a regression test for this bug.
  • [@s77rt] 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.
  • [@joekaufmanexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@joekaufmanexpensify
Copy link
Contributor

This was fixing a deploy blocker introduced from another PR that @Kicu and @s77rt worked on, so no payment is due here.

@joekaufmanexpensify
Copy link
Contributor

Closing as this is on production, thanks everyone!

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. Engineering Weekly KSv2
Projects
None yet
Development

No branches or pull requests

7 participants