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

[LOW] [Splits] [$500] IOU - When paying a deleted IOU disappears and RBR does not appear when going online #38338

Closed
6 tasks done
kbecciv opened this issue Mar 14, 2024 · 71 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Monthly KSv2

Comments

@kbecciv
Copy link

kbecciv commented Mar 14, 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.52-0
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4424536
Issue reported by: Applause - Internal Team

Action Performed:

  1. Open NewDot app or https://staging.new.expensify.com/
  2. Log in to account A and B in incognito mode
  3. [User B] Request money from User A
  4. [User A] Go offline
  5. [User A] Open the IOU report and tap Pay elsewhere
  6. [User B] Delete the IOU
  7. [User A] Go online

Expected Result:

The deleted IOU should not disappear when you pay and should appear RBR when you go online

Actual Result:

When paying a deleted IOU disappears and RBR does not appear when going online

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

Add any screenshot/video evidence

Bug6413557_1710423588803.Recording__1425.1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01606c57f19fab1b0c
  • Upwork Job ID: 1768749861959938048
  • Last Price Increase: 2024-08-08
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 14, 2024
Copy link

melvin-bot bot commented Mar 14, 2024

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

@kbecciv
Copy link
Author

kbecciv commented Mar 14, 2024

@mallenexpensify 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.

@kbecciv
Copy link
Author

kbecciv commented Mar 14, 2024

We think that this bug might be related to #vip-bills
CC @quinthar

@mallenexpensify mallenexpensify added the External Added to denote the issue can be worked on by a contributor label Mar 15, 2024
Copy link

melvin-bot bot commented Mar 15, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01606c57f19fab1b0c

@melvin-bot melvin-bot bot changed the title IOU - When paying a deleted IOU disappears and RBR does not appear when going online [$500] IOU - When paying a deleted IOU disappears and RBR does not appear when going online Mar 15, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 15, 2024
Copy link

melvin-bot bot commented Mar 15, 2024

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

@mallenexpensify
Copy link
Contributor

Was able to reproduce, pretty sure we're filing this in #vip-split. Going to add there.
@akinwale I marked this External, do you agree?

@melvin-bot melvin-bot bot added the Overdue label Mar 18, 2024
@akinwale
Copy link
Contributor

@akinwale I marked this External, do you agree?

Yes. It makes sense to let the user know that the attempted payment actually failed.

@melvin-bot melvin-bot bot removed the Overdue label Mar 18, 2024
@ijmalik
Copy link
Contributor

ijmalik commented Mar 22, 2024

Proposal

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

  1. Open NewDot app or https://staging.new.expensify.com/
  2. Log in to account A and B in incognito mode
  3. [User B] Request money from User A
  4. [User A] Go offline
  5. [User A] Open the IOU report and tap Pay elsewhere
  6. [User B] Delete the IOU
  7. [User A] Go online
  8. Paid IOU disappears and RBR does not appear when going online

What is the root cause of that problem?
In Step-6, [User B] deletes the IOU, removing it from the server. When [User A] goes online, an API call sends a PayMoneyRequest. Since the related paid IOU no longer exists on the server, the server responds with an error message.

PayMoneyRequest is sent to the server and a response is received before the ReconnectApp request. I have tested it more than 50 times on staging/local system

1- Response of https://dev.new.expensify.com:8082/api/PayMoneyRequest?

{
    "code": 666,
    "jsonCode": 666,
    "type": "Expensify\\Libs\\Error\\ExpError",
    "UUID": "15599214-3cf5-486d-a718-7473f9a66461",
    "message": "The request has been deleted since you started reviewing it",
    "title": "",
    "data": {
        "onyxData": [
            {
                "onyxMethod": "merge",
                "key": "reportActions_7570059040520446",
                "value": {
                    "8410491383366069554": {
                        "errors": {
                            "1717213301956141": "The request has been deleted since you started reviewing it"
                        }
                    }
                }
            }
        ]
    },
    "htmlMessage": "",
    "onyxData": [
        {
            "onyxMethod": "merge",
            "key": "reportActions_7570059040520446",
            "value": {
                "8410491383366069554": {
                    "errors": {
                        "1717213301956141": "The request has been deleted since you started reviewing it"
                    }
                }
            }
        }
    ],
    "requestID": "88cc307e4aac9fe6-SIN"
}

This error message should be shown to the user, but following the ReconnectApp response, the deleted IOU data from Onyx at the client side removes the IOU for [User A], causing the IOU to disappear and the RBR not to be shown

2- Response of https://dev.new.expensify.com:8082/api/ReconnectApp?

{
    "onyxData": [
        {
            "key": "reportActions_5865121211484369",
            "onyxMethod": "merge",
            "value": {
                "5066949385780238245": {
                    "message": [
                        {
                            "deleted": "2024-06-01 03:41:13.452",
                            "type": "TEXT"
                        }
                    ],
                    "originalMessage": {
                        "deleted": "2024-06-01 03:41:13.452"
                    }
                }
            }
        },
        {
            "key": "report_7535596232475694",
            "onyxMethod": "set",
            "value": null
        },
        {
            "key": "reportActions_7535596232475694",
            "onyxMethod": "set",
            "value": null
        },
        {
            "key": "report_7570059040520446",
            "onyxMethod": "set",
            "value": null
        },
        {
            "key": "reportActions_7570059040520446",
            "onyxMethod": "set",
            "value": null
        },
        {
            "key": "transactions_4222740866756488814",
            "onyxMethod": "set",
            "value": null
        },
        {
            "key": "reportActions_7570059040520446",
            "onyxMethod": "set",
            "value": null
        },
        {
            "key": "report_7570059040520446",
            "onyxMethod": "set",
            "value": null
        },
        {
            "key": "reportActions_5865121211484369",
            "onyxMethod": "merge",
            "value": {
                "5066949385780238245": {
                    "message": [
                        {
                            "deleted": "2024-06-01 03:41:13.452",
                            "html": "",
                            "isDeletedParentAction": false,
                            "isEdited": false,
                            "text": "",
                            "type": "COMMENT",
                            "whisperedTo": []
                        }
                    ],
                    "originalMessage": {
                        "deleted": "2024-06-01 03:41:13.452"
                    }
                }
            }
        },
        {
            "key": "report_7535596232475694",
            "onyxMethod": "set",
            "value": null
        },
        {
            "key": "reportActions_7535596232475694",
            "onyxMethod": "set",
            "value": null
        },
        {
            "key": "report_5865121211484369",
            "onyxMethod": "merge",
            "value": {
                "iouReportID": null,
                "lastActorAccountID": 16328678,
                "lastMessageHtml": "",
                "lastMessageText": "",
                "lastVisibleActionCreated": "2024-06-01 03:39:54.784"
            }
        }
    ],
    "lastUpdateID": "418604732",
    "previousUpdateID": "418603927",
    "jsonCode": 200,
    "requestID": "88cc30863a5aa98e-SIN"
}

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

const onyxDataUpdatePromise = response.onyxData ? updateHandler(response.onyxData) : Promise.resolve();

We change it as

const filteredOnyxData = filterOutPaidIOUDeletions(response.onyxData);
const onyxDataUpdatePromise = filteredOnyxData ? updateHandler(filteredOnyxData) : Promise.resolve();

Since the response of ReconnectApp directly updates Onyx, we need to filter the server response of ReconnectApp in the filterOutPaidIOUDeletions function to prevent data deletion from Onyx (Client Side).
I think we should have to modify this file or possibly another part of the middlewares to achieve this.

PayMoneyRequest and its response are fine and do not require changes.

Before Code Change:

38338-Before.mp4

After Code Change:

38338-After.mp4

What alternative solutions did you explore?
Don't allow to pay IOU offline.

@melvin-bot melvin-bot bot added the Overdue label Mar 22, 2024
Copy link

melvin-bot bot commented Mar 22, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@arielgreen arielgreen changed the title [$500] IOU - When paying a deleted IOU disappears and RBR does not appear when going online [LOW] [Splits] [$500] IOU - When paying a deleted IOU disappears and RBR does not appear when going online Mar 22, 2024
@mallenexpensify
Copy link
Contributor

@akinwale can you please review the proposal above? Thx

@melvin-bot melvin-bot bot removed the Overdue label Mar 25, 2024
Copy link

melvin-bot bot commented Mar 29, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Mar 29, 2024
@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Mar 31, 2024
@mallenexpensify mallenexpensify added External Added to denote the issue can be worked on by a contributor and removed External Added to denote the issue can be worked on by a contributor labels Mar 31, 2024
@abdulrahuman5196
Copy link
Contributor

abdulrahuman5196 commented Jun 4, 2024

On @ijmalik 's proposal here - #38338 (comment). I don't agree on the solution suggested to make changes in the central SaveResponseInOnyx.ts component to fix this particular case. I think we don't have any proposals to approve yet.

I am still on this. I don't think its a good solution to update the central middlewares and API infra to reflect this exception for a specific case. @ijmalik Is there a different way where we can set optimistic failure report action when the API fails?

Currently we don't have any proposals to be approved yet.

@melvin-bot melvin-bot bot removed the Overdue label Jun 4, 2024
@ijmalik
Copy link
Contributor

ijmalik commented Jun 5, 2024

I am still on this. I don't think its a good solution to update the central middlewares and API infra to reflect this exception for a specific case. @ijmalik Is there a different way where we can set optimistic failure report action when the API fails?

Currently we don't have any proposals to be approved yet.

@mallenexpensify

@abdulrahuman5196 Thank you for your feedback on proposal in #38338 (comment) . I understand your concerns regarding the suggested changes to the central SaveResponseInOnyx.ts component.

I agree that updating central middlewares and API infrastructure for this specific case may not be the best approach. Instead, could we explore alternative solutions?

The root cause of our issue is not related to an API failure. If it were, setting optimistic data would indeed be the correct approach. However, this case is different and warrants a different strategy.

  • The PayMoneyRequest API call is functioning correctly.
  • The failure response for PayMoneyRequest is properly received.
  • The RBR is displayed correctly.

Up to this point, everything is working as expected.

The issue arises when the API ReconnectApp response is received. The response includes onyxData related to this specific IOU and other activities associated with User-A while offline. The IOU deletion data updates Onyx directly, bypassing most of our app's code except for the middleware.

Therefore, we need to identify IOU deletions in the response and skip these updates to Onyx.

@abdulrahuman5196
Copy link
Contributor

@mallenexpensify Can we involve an internal engineer here to provide information from backend as well? Or some other direction as well.

Basically, the reportAction(IOU) is deleted from the ReconnectApp API call response. So we don't have a report action where we can show an error.

@saracouto saracouto added Monthly KSv2 and removed Daily KSv2 labels Jun 7, 2024
Copy link

melvin-bot bot commented Jun 7, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@mallenexpensify
Copy link
Contributor

@abdulrahuman5196 before assigning an engineer, can you post in #expensify-open-source to see if you can get a reply from someone from the team? Thx

@sonialiap
Copy link
Contributor

@mallenexpensify @abdulrahuman5196 I came across a similar sounding issue, do you think they're connected #40705

Copy link

melvin-bot bot commented Jun 14, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@mallenexpensify
Copy link
Contributor

Good 👀 @sonialiap , the steps are near identical. @abdulrahuman5196 can you review that issue and comment here or there with any thoughts? Normally we'd keep the older issue open but it looks like both these have quite a few comments (and no suggested proposals).

@abdulrahuman5196
Copy link
Contributor

abdulrahuman5196 commented Jun 20, 2024

@mallenexpensify Both are almost similar issues. And I can see comments that other issue is not reproducible. So we can focus on this issue.

But anyways I agree on this #40705 (comment), we need internal guidance on if we should fix this, and if so in what direction.

Copy link

melvin-bot bot commented Jun 21, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

2 similar comments
Copy link

melvin-bot bot commented Jun 28, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Copy link

melvin-bot bot commented Jul 5, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@mallenexpensify
Copy link
Contributor

Checking in #vip-split to see what folks think
https://expensify.slack.com/archives/C05RECHFBEW/p1720481477873549

Copy link

melvin-bot bot commented Jul 12, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

1 similar comment
Copy link

melvin-bot bot commented Jul 19, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@mallenexpensify mallenexpensify removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 22, 2024
@melvin-bot melvin-bot bot added the Overdue label Jul 22, 2024
@mallenexpensify
Copy link
Contributor

From chat a couple weeks ago

I think we should fix this bug but not now. You can make it a monthly and add it under the paused items under this proje

I removed Help Wanted

@mallenexpensify
Copy link
Contributor

Gonna be a min til we get to this

@melvin-bot melvin-bot bot removed the Overdue label Jul 31, 2024
Copy link

melvin-bot bot commented Aug 8, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Sep 2, 2024
@mallenexpensify
Copy link
Contributor

IOUs are a priority right now

@melvin-bot melvin-bot bot removed the Overdue label Sep 4, 2024
@mallenexpensify
Copy link
Contributor

Closing as we're closing #vip-split

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Monthly KSv2
Projects
None yet
Development

No branches or pull requests

9 participants