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-08-10] [HOLD for payment 2023-08-08] Chat - Crash when deleting attachment from user B when user A has open attachment modal #23964

Closed
1 of 6 tasks
lanitochka17 opened this issue Jul 31, 2023 · 29 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 Engineering

Comments

@lanitochka17
Copy link

lanitochka17 commented Jul 31, 2023

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 found when executing PR #22543

Action Performed:

  1. Go to URL https://staging.new.expensify.com/
  2. Login with user A
  3. On another device/incognito, login with user B
  4. From user B send an attachment
  5. From user A, click on the attachment to open attachment modal
  6. From user B, delete this attachment

Expected Result:

An attachment modal closed

Actual Result:

App crashed for user A

Workaround:

Unknown

Platforms:

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

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

Version Number: 1.3.48.0

Reproducible in staging?: Yes

Reproducible in production?: No

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

Bug6148620_Recording__5677.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

@lanitochka17 lanitochka17 added the DeployBlockerCash This issue or pull request should block deployment label Jul 31, 2023
@OSBotify
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.

@melvin-bot
Copy link

melvin-bot bot commented Jul 31, 2023

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

@railway17
Copy link
Contributor

Proposal

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

Chat - Crash when deleting attachment from user B when user A has open attachment modal

What is the root cause of that problem?

While reportActions props variable is changed by onyx, it calls createInitialState to initiate the AttachmentCarousel state in the AttachmentCarousel component.
When deleting the image, it also calls the createInitialState because it was defined in useEffect.
Inside of createInitialState, it calls onNavigate with undefined parameter which is defined in the parent component
The app crashs here.

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

To close the AttachmentModal at this moment, we need to update the onNavigate handler in AttachmentModal.js file
So, it can be updated like below

const onNavigate = useCallback(
        (attachment) => {
            if (!attachment) {
                closeModal()
            } else {
                setSource(attachment.source);
                setFile(attachment.file);
                setIsAuthTokenRequired(attachment.isAuthTokenRequired);
                onCarouselAttachmentChange(attachment);
            }
        },
        [onCarouselAttachmentChange, closeModal],
    );

What alternative solutions did you explore? (Optional)

N/A

@melvin-bot melvin-bot bot added Daily KSv2 and removed Hourly KSv2 labels Aug 1, 2023
@Beamanator
Copy link
Contributor

Beamanator commented Aug 1, 2023

Thanks for your investigation so far @railway17 - it looks like you're thinking the problem comes from props.onNavigate(attachments[page]); in createInitialState, right? Here?

// Update the parent modal's state with the source and name from the mapped attachments
props.onNavigate(attachments[page]);

Let's try reproducing in production, since that PR that introduced that is on production as of yesterday

@Beamanator
Copy link
Contributor

Couldn't reproduce on prod, could reproduce on staging only

@Beamanator
Copy link
Contributor

@railway17 I like your solution, how quickly can you get a PR up?

@railway17
Copy link
Contributor

@railway17 I like your solution, how quickly can you get a PR up?

I can do it shortly

@Beamanator
Copy link
Contributor

OK thanks I'm exploring one other option at the moment

@railway17
Copy link
Contributor

OK thanks I'm exploring one other option at the moment

In the meantime, do you want me to create a PR with my solution?

@Beamanator
Copy link
Contributor

@railway17 it looks like this PR actually caused the issue: #22543

The reason is we started doing Navigation.dismissModal instead of throwing, so after dismissing the modal we continued on to props.onNavigate even though the page didn't exist anymore

I'm going to put up a PR with a solution that returns early instead of handling nonexistent attachments

@Beamanator
Copy link
Contributor

PR is up: #23988

@Beamanator Beamanator added the Bug Something is broken. Auto assigns a BugZero manager. label Aug 1, 2023
@rushatgabhane
Copy link
Member

rushatgabhane commented Aug 1, 2023

PR merged. @twisterdotcom could you please assign this to me for C+

#23988 (comment)

@Beamanator Beamanator removed the DeployBlockerCash This issue or pull request should block deployment label Aug 1, 2023
@Beamanator
Copy link
Contributor

Beamanator commented Aug 1, 2023

Removing deploy blocker, this is fixed in staging now due to #23988 👍

@Beamanator Beamanator added Daily KSv2 and removed Hourly KSv2 labels Aug 1, 2023
@Natnael-Guchima
Copy link

Natnael-Guchima commented Aug 1, 2023

@twisterdotcom Sorry, for asking a lot of questions 😁. If this issue was known and documented on this pr #22261 shouldn't this issue be reproducible on production too, since the PR is 2 weeks old? This issue was reproducible only on staging.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Aug 1, 2023
@melvin-bot melvin-bot bot changed the title Chat - Crash when deleting attachment from user B when user A has open attachment modal [HOLD for payment 2023-08-08] Chat - Crash when deleting attachment from user B when user A has open attachment modal Aug 1, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 1, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 1, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 1, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.48-5 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-08-08. 🎊

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

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

  • @rushatgabhane does not require payment (Eligable for Manual Requests)

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 Aug 1, 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:

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

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Aug 3, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-08-08] Chat - Crash when deleting attachment from user B when user A has open attachment modal [HOLD for payment 2023-08-10] [HOLD for payment 2023-08-08] Chat - Crash when deleting attachment from user B when user A has open attachment modal Aug 3, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 3, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.49-3 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-08-10. 🎊

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

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

  • @rushatgabhane does not require payment (Eligable for Manual Requests)

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 Aug 3, 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:

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

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Aug 8, 2023
@twisterdotcom
Copy link
Contributor

@Natnael-Guchima sorry I missed your Q here. I don't quite follow it. I still think this was reported earlier than your report. If not, we are obviously happy to rectify but could you make it as easy as possible to follow that for me?

@twisterdotcom
Copy link
Contributor

Payment Summary for this issue:
No Bug reporter or Contributor*
@rushatgabhane will be paid via newDot $1000

@Natnael-Guchima
Copy link

Natnael-Guchima commented Aug 9, 2023

@twisterdotcom okay, I am going to try to make my argument clear. But no worries if you think the issue was known.

Let's call the issue I reported 'report A' and the issue that claim to have a similar root cause with my report as 'report B'.

  • Report A was a depoly blocker when it was first reported. It was only reproducible only on staging and not reproducible on production.

  • At the time report A was reported, report B was two weeks old issue. And it was reproducible on staging and production too.

My question was if report A and report B have similar root causes, shouldn't 'report A' as 'report B' be reproducible on staging and production by the time it was reported?

Thanks.

@JmillsExpensify
Copy link

Reviewed the details for @rushatgabhane. $1k is approved for payment in NewDot.

@twisterdotcom
Copy link
Contributor

@Natnael-Guchima I don't think those things are mutually exclusive personally. Just because something fixed a deploy blocker, doesn't mean the underlying issue wasn't a problem on both environments. Tonnes of bugs exist on Production, that may be fixed by a PR that is pushed to fix another deploy blocker later.

It sucks we deployed a bug weeks earlier, and that we didn't catch a fix until something worse occurred because of it, but I still don't think it counts here I'm afraid.

Please don't be put off though - as you'll see, there are tonnes of bugs to find and fix and we do try to be as fair as possible when considering payments across the board - I am sure the vast majority of our contributors will attest to that.

@Natnael-Guchima
Copy link

@twisterdotcom that makes sense. I won't be put off. It is really nice and rewarding to work here. Thanks for bearing up with me 🙂

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

No branches or pull requests

10 participants