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-01-25] [$500] Deleted IOU offline disappears after going online if it has already been paid for by another user. #33158

Closed
6 tasks done
kbecciv opened this issue Dec 15, 2023 · 30 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@kbecciv
Copy link

kbecciv commented Dec 15, 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!


Version Number: 1.4.13-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:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Open New Expensify app or https://staging.new.expensify.com/
  2. Log in with separate accounts in the main testing device and a secondary device
  3. In the main testing device create an 2 IOU with a user
  4. Disable the internet connection in the main testing device
  5. On the main test device (offline), cancel one of the sent IOU
  6. In the secondary device (online), mark all IOU as paid with the "Pay elsewhere" option.
  7. Enable the internet connection in the main testing device
  8. On the main device, delete the error "Unexpected error deleting the money request, please try again later" in the IOU report

Expected Result:

Once the error has been removed, the primary device should display the paid IOU that failed to be removed.

Actual Result:

Deleted IOU offline disappears after going online if it has already been paid for by another user.

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

Bug6314527_1702644676009.Recording__944.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01fed1ad1953a51e12
  • Upwork Job ID: 1735648259511918592
  • Last Price Increase: 2024-01-09
  • Automatic offers:
    • hoangzinh | Reviewer | 28096820
    • bernhardoj | Contributor | 28096822
@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 15, 2023
@melvin-bot melvin-bot bot changed the title Deleted IOU offline disappears after going online if it has already been paid for by another user. [$500] Deleted IOU offline disappears after going online if it has already been paid for by another user. Dec 15, 2023
Copy link

melvin-bot bot commented Dec 15, 2023

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

Copy link

melvin-bot bot commented Dec 15, 2023

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

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

melvin-bot bot commented Dec 15, 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

Copy link

melvin-bot bot commented Dec 15, 2023

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

@namhihi237
Copy link
Contributor

namhihi237 commented Dec 15, 2023

Proposal

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

Deleted IOU offline disappears after going online if it has already been paid for by another user

What is the root cause of that problem?

In here we only clear errors in the reportAction the pendingAction still delete
So the IOU will hide because this condition

const hideChildren = shouldHideOnDelete && !isOffline && pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE && !hasErrors;

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

We should remove the pendingAction when clear the error message too.

   Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${originalReportID}`, {
        [reportAction.reportActionID]: {
            errors: null,
            pendingAction: null,
        },
    });

What alternative solutions did you explore? (Optional)

@bernhardoj
Copy link
Contributor

Proposal

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

If we close the request/transaction delete error message, the report action also disappears, but it should stay visible.

What is the root cause of that problem?

When we delete the request, we optimistically set the pendingAction to DELETE.

App/src/libs/actions/IOU.js

Lines 2274 to 2276 in 275bd03

const updatedReportAction = {
[reportAction.reportActionID]: {
pendingAction: shouldShowDeletedRequestMessage ? CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE : CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,

This will show the strikethrough text while offline. If we pay the request from the requested user, the delete action will fail when we come back online. If fails, the error message will show with a close button, but the DELETE pendingAction still exists.

If the pendingAction is DELETE while online, the view should be hidden, but because we have an error message, the view is displayed.

const hasErrors = isNotEmptyObject(errors ?? {});

const hideChildren = shouldHideOnDelete && !isOffline && pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE && !hasErrors;

So, once we press the close error message, the request view is hidden.

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

We should clear the pendingAction when the delete fails.

App/src/libs/actions/IOU.js

Lines 2443 to 2450 in 275bd03

onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport.reportID}`,
value: {
[reportAction.reportActionID]: {
...reportAction,
errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericDeleteFailureMessage'),
},
},

@abekkala
Copy link
Contributor

Dupe of 26511
Closing

@bernhardoj
Copy link
Contributor

@abekkala hi, 26511 is different with this issue. In 26511, we create and delete the money request while offline, but the money request reappears after refresh.

In this issue, we create the money request while online, delete it while offline, and come back online but the delete fails because we already paid it on a different device. When the delete fails, the money request is still displayed, but hidden as soon as we clear the error message.

In short,
26511: money request reappears even though we delete it
this issue: money request disappears after clearing the fail-to-delete error message

I also check the PR there and it didn't include any of the proposed solution here.

@bernhardoj
Copy link
Contributor

@abekkala hi, can you recheck this please? The issue still happens.

@hoangzinh
Copy link
Contributor

Right, it looks like 2 different issues.

@hoangzinh
Copy link
Contributor

@bernhardoj
Copy link
Contributor

@abekkala bump

@abekkala abekkala reopened this Jan 8, 2024
Copy link

melvin-bot bot commented Jan 9, 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 Jan 11, 2024
@abekkala
Copy link
Contributor

@hoangzinh is either proposal above sufficient? Do you have feedback for them or do we need different proposals?

@melvin-bot melvin-bot bot removed the Overdue label Jan 11, 2024
@hoangzinh
Copy link
Contributor

@namhihi237 @bernhardoj Thanks for your proposal. @bernhardoj's proposal has more details of RCA and his solution looks good to me. We also apply that approach in other action utils.

Link to proposal #33158 (comment)

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Jan 12, 2024

Triggered auto assignment to @arosiclair, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 12, 2024
@hoangzinh
Copy link
Contributor

oop @abekkala @arosiclair could you help to re-add the External label for this issue? Thanks

@bernhardoj
Copy link
Contributor

PR is ready

cc: @hoangzinh

@arosiclair arosiclair added External Added to denote the issue can be worked on by a contributor and removed Internal Requires API changes or must be handled by Expensify staff labels Jan 15, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 15, 2024
Copy link

melvin-bot bot commented Jan 15, 2024

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

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jan 15, 2024
@arosiclair arosiclair added Weekly KSv2 and removed Daily KSv2 Help Wanted Apply this label when an issue is open to proposals by contributors labels Jan 15, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jan 18, 2024
@melvin-bot melvin-bot bot changed the title [$500] Deleted IOU offline disappears after going online if it has already been paid for by another user. [HOLD for payment 2024-01-25] [$500] Deleted IOU offline disappears after going online if it has already been paid for by another user. Jan 18, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jan 18, 2024
Copy link

melvin-bot bot commented Jan 18, 2024

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

Copy link

melvin-bot bot commented Jan 18, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.26-2 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-01-25. 🎊

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

Copy link

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

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

@abekkala
Copy link
Contributor

PAYMENTS FOR JAN 25

@hoangzinh
Copy link
Contributor

Regression Test Proposal

I would like to borrow the Test steps of @bernhardoj in his PR here #34469

  1. [User A] Open chat with User B
  2. [User A] Request money twice to User B
  3. [User A] Turn off internet connection
  4. [User A] Delete one of the request
  5. [User B] Pay the money request
  6. [User A] Turn the internet connection back
  7. [User A] Verify you got an error on the request
  8. [User A] Close the error message
  9. [User A] Verify the error message disappears and the IOU is still visible

Do we agree 👍 or 👎

@hoangzinh hoangzinh mentioned this issue Jan 24, 2024
57 tasks
@hoangzinh
Copy link
Contributor

BugZero Checklist:

@abekkala
Copy link
Contributor

@bernhardoj @hoangzinh payments sent and contracts ended - thank you! 🎉

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

No branches or pull requests

6 participants