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-28] [$1000] Offline mode: Crash after deleting Split Bill request #25481

Closed
2 of 6 tasks
izarutskaya opened this issue Aug 18, 2023 · 55 comments
Closed
2 of 6 tasks
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 External Added to denote the issue can be worked on by a contributor

Comments

@izarutskaya
Copy link

izarutskaya commented Aug 18, 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. Log in to any account.
  2. Turn OFF the network connection to switch to OFFLINE mode.
  3. Create a Split Bill request with two other users.
  4. This will generate two sub-reports: report A and report B >> Click on report A to view its details.
  5. Hover over the report and select the Delete option >> report A will be deleted.
  6. Click on report B >> Observation: The app CRASHES.

Expected Result:

App should not crash

Actual Result:

App Crashes

Workaround:

Unknown

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: v1.3.55-1

Reproducible in staging?: Y

Reproducible in production?: N

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

split-request-crash.mp4
Screen.Recording.20230817.183513.New.Expensify.mp4

Expensify/Expensify Issue URL:

Issue reported by: @tranvantoan-qn

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1692279822439699

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e588feb8af6feae9
  • Upwork Job ID: 1692566105949474816
  • Last Price Increase: 2023-08-18
  • Automatic offers:
    • pradeepmdk | Contributor | 26243141
    • tranvantoan-qn | Reporter | 26243145
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 18, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 18, 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

@izarutskaya izarutskaya added the DeployBlockerCash This issue or pull request should block deployment label Aug 18, 2023
@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Aug 18, 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 Aug 18, 2023

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

@tranvantoan-qn
Copy link

tranvantoan-qn commented Aug 18, 2023

FYI: This crash happens on ALL platforms, not only Android as specified in the issue Title

@pradeepmdk
Copy link
Contributor

pradeepmdk commented Aug 18, 2023

Proposal

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

Offline mode: Crash after deleting Split Bill request

What is the root cause of that problem?

Screenshot 2023-08-18 at 9 28 05 PM

in offline after deleting transaction its updated to null because its completed removed from onyx
Screenshot 2023-08-18 at 8 13 52 PM
Screenshot 2023-08-18 at 8 18 19 PM

return _.filter(allTransactions, (transaction) => transaction.reportID === reportID);

App/src/libs/actions/IOU.js

Lines 1109 to 1113 in a068ca5

const optimisticData = [
{
onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
value: null,

here when offline mode optimisticData will execute so it's set as a null. when onyx null it will remove from local database

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

  1. we need to check its null or not
function getAllReportTransactions(reportID) {
    return _.filter(allTransactions, (transaction) => transaction && transaction.reportID === reportID);
}

And here we need update

props.network.isOffline
) {
shouldShowPendingConversionMessage = IOUUtils.isIOUReportPendingCurrencyConversion(props.reportActions, props.iouReport);
}

to

IOUUtils.isIOUReportPendingCurrencyConversion(props.iouReport);

because this isIOUReportPendingCurrencyConversion is expecting the iouReport param only

App/src/libs/IOUUtils.js

Lines 77 to 79 in a068ca5

function isIOUReportPendingCurrencyConversion(iouReport) {
const reportTransactions = TransactionUtils.getAllReportTransactions(iouReport.reportID);
const pendingRequestsInDifferentCurrency = _.filter(reportTransactions, (transaction) => transaction.pendingAction && TransactionUtils.getCurrency(transaction) !== iouReport.currency);

This Pr is modified the function
https://github.com/Expensify/App/pull/24345/files

result

Screen.Recording.2023-08-18.at.8.41.45.PM.mov

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

Having trouble reproducing this on a virtual device via Browserstack
image

@pradeepmdk
Copy link
Contributor

@MitchExpensify you can verify on the web also. because its not a platform specfic

@MitchExpensify
Copy link
Contributor

Ok awesome, trying that now @pradeepmdk !

@tranvantoan-qn
Copy link

On mobile, for the crash to occur, we will need to return to the LHN and then navigate to other reports, as demonstrated here:

Mobile.mp4

@MitchExpensify
Copy link
Contributor

Reproduced!

@MitchExpensify MitchExpensify added the External Added to denote the issue can be worked on by a contributor label Aug 18, 2023
@melvin-bot melvin-bot bot changed the title Android - Offline mode: Crash after deleting Split Bill request [$1000] Android - Offline mode: Crash after deleting Split Bill request Aug 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 18, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01e588feb8af6feae9

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

melvin-bot bot commented Aug 18, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 18, 2023

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

@MitchExpensify
Copy link
Contributor

MitchExpensify commented Aug 21, 2023

Payment summary:

Reporting - $250 via Upwork to @tranvantoan-qn
Contributor - $1500 via Upwork to @pradeepmdk

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Aug 21, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Offline mode: Crash after deleting Split Bill request [HOLD for payment 2023-08-28] [$1000] Offline mode: Crash after deleting Split Bill request Aug 21, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.55-8 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-28. 🎊

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:

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 21, 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:

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

@marcaaron
Copy link
Contributor

is resulting in null being included in allTransactions here. I'd say that's the real root cause for this issue

Hmm actually - I think @roryabraham you are suggesting something like:

Given this setup:

  • A subscriber to a collection key with waitForCollectionCallback: true

When this happens:

  • A collection member key is set to null

We would expect this:

  • The subscriber to get the new complete collection with any null values removed

If so, that makes sense to me and does sound like the real root cause. We should fix it in Onyx?

@pradeepmdk
Copy link
Contributor

@marcaaron Yes, if we fixed it in Onyx that is the best solution here

@roryabraham
Copy link
Contributor

Agree @marcaaron that's the real root cause and we should fix it in Onyx. Didn't do that today because I wanted to get the deploy out as quickly as possible, but I made a follow-up issue here: Expensify/react-native-onyx#310

@Pujan92
Copy link
Contributor

Pujan92 commented Aug 22, 2023

  • The subscriber to get the new complete collection with any null values removed
        if (_.isFunction(subscriber.callback)) {
            if (isCollectionKey(subscriber.key) && subscriber.waitForCollectionCallback) {
                const cachedCollection = getCachedCollection(subscriber.key);
                cachedCollection[key] = data;
                subscriber.callback(cachedCollection);
                continue;
            }

            subscriber.callback(data, key);
            continue;
        }

@marcaaron @roryabraham For non-collection also we are updating with a null value, so do we need to avoid that also?

@marcaaron
Copy link
Contributor

No, we cannot do this. At least for now, it's the only way a subscriber can know that some data has been removed.

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

Paid and contracts ended #25481 (comment)

@MitchExpensify
Copy link
Contributor

Bump BZ steps #25481 (comment)

@roryabraham
Copy link
Contributor

I checked off my pieces in the BZ checklist. The main takeaway here is that the root cause was actually a bug in Onyx, and I'm working on fixing that in Expensify/react-native-onyx#311

@melvin-bot melvin-bot bot removed the Overdue label Sep 1, 2023
@MitchExpensify
Copy link
Contributor

Thanks @roryabraham! Looks like this can be closed in that case

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 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests