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 2025-02-04] [$250] Expense - Edited amount for a paid request does not revert to paid amount when dismiss the error #54471

Closed
2 of 8 tasks
vincdargento opened this issue Dec 23, 2024 · 35 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 External Added to denote the issue can be worked on by a contributor

Comments

@vincdargento
Copy link

vincdargento commented Dec 23, 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: v9.0.77-6
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team

Action Performed:

  1. Navigate to staging.new.expensify.com.
  2. [User A] Request money from User B.
  3. [User A] Open IOU details page > Click Amount.
  4. [User B] Pay the request.
  5. [User A] Enter a new amount and save it.
  6. [User A] Close the error message.

Expected Result:

The amount in IOU details page should revert to the original amount after closing the error message (as in PR #32898)

Actual Result:

The amount in IOU details page does not revert to the original amount after closing the error message. It only reverts after refreshing the app.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

bug.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021871573512679466358
  • Upwork Job ID: 1871573512679466358
  • Last Price Increase: 2025-01-07
  • Automatic offers:
    • Tony-MK | Contributor | 105631903
Issue OwnerCurrent Issue Owner: @bfitzexpensify
@vincdargento vincdargento added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 23, 2024
Copy link

melvin-bot bot commented Dec 23, 2024

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

@mkzie2
Copy link
Contributor

mkzie2 commented Dec 23, 2024

Edited by proposal-police: This proposal was edited at 2024-12-23 19:30:42 UTC.

Proposal

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

The amount in IOU details page does not revert to the original amount after closing the error message. It only reverts after refreshing the app.

What is the root cause of that problem?

We only update the pending field and error field of transactions in failureData. Then the updated data isn't reverted.

App/src/libs/actions/IOU.ts

Lines 2992 to 3000 in 2458635

failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
value: {
pendingFields: clearedPendingFields,
isLoading: false,
errorFields,
},
});

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

We should revert to original transaction data and only override the pending field and error field. Or we can simply revert to transaction

failureData.push({
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
    value: {
        ...transaction,
        pendingFields: clearedPendingFields,
        isLoading: false,
        errorFields,
    },
});

Or

failureData.push({
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
    value: transaction,
});

App/src/libs/actions/IOU.ts

Lines 2992 to 3000 in 2458635

failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
value: {
pendingFields: clearedPendingFields,
isLoading: false,
errorFields,
},
});

We can check if getUpdateTrackExpenseParams has the same problem and fix it

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

We must create a unit test for one of the update money request APIs, making the request fail. After that we need to verify the transaction data is reverted to the original value before the API is called.

What alternative solutions did you explore? (Optional)

NA

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

@Tony-MK
Copy link
Contributor

Tony-MK commented Dec 23, 2024

Proposal

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

Expense - Edited amount for a paid request does not revert to paid amount when dismissing the error

What is the root cause of that problem?

We are not returning the transaction amount figure back to the original amount and will take the figure from modifiedAmount since it is not empty.

clearError={Transaction.clearError}

So, we any clear the errors but we don't revert the transaction changes.

function clearError(transactionID: string) {
Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {errors: null, errorFields: {route: null, waypoints: null, routes: null}});
}

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

Create a new function for the clearError prop, over here, to revert the transaction data to the previous values depending on which field was attempted to change while calling Transaction.clearError.

We will revert the transaction values from the report's modified Expense action originalMessage.

clearError={
 (transactionID) => {
  // Revert the transaction values from reportAction.originalMessage
  Transaction.clearError(transactionID)
 }
}

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

Create a unit test for the new function to check if it can restore the previous values of the transaction even with different changes.

What alternative solutions did you explore? (Optional)

Let's update the failureData and add the previous values of the transaction, in this case, the amount, modified amount, etc...

@bfitzexpensify bfitzexpensify added the External Added to denote the issue can be worked on by a contributor label Dec 24, 2024
@melvin-bot melvin-bot bot changed the title Expense - Edited amount for a paid request does not revert to paid amount when dismiss the error [$250] Expense - Edited amount for a paid request does not revert to paid amount when dismiss the error Dec 24, 2024
Copy link

melvin-bot bot commented Dec 24, 2024

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

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

melvin-bot bot commented Dec 24, 2024

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

@bfitzexpensify bfitzexpensify moved this to Bugs and Follow Up Issues in [#whatsnext] #expense Dec 24, 2024
@hungvu193
Copy link
Contributor

hungvu193 commented Dec 25, 2024

Thanks for the proposals, everyone.
Both proposals make sense to me.

As described in the expected result, we should revert the edited amount after closing error message. Because of that I'm aligned with @Tony-MK 's proposal.

🎀👀🎀

Copy link

melvin-bot bot commented Dec 25, 2024

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

@mkzie2
Copy link
Contributor

mkzie2 commented Dec 25, 2024

Verify you will get an error message
Verify the amount is reverted to the paid amount

@hungvu193 Based on the PR mentioned in OP, the expected amount is reverted immediately after we get an error message. You also can see other patterns of the App like editing comments, and edit task title/description it also reverts immediately after the API fails.

@mkzie2
Copy link
Contributor

mkzie2 commented Dec 25, 2024

@tylerkaraszewski, please wait for the assignment until we clarify what is expected.

@hungvu193
Copy link
Contributor

I'm fine with both solutions:

Screenshot 2024-12-26 at 09 40 39

cc @tylerkaraszewski and @bfitzexpensify for the expected behavior here.

@mkzie2
Copy link
Contributor

mkzie2 commented Dec 26, 2024

The amount in IOU details page should revert to the original amount after closing the error message (as in PR #32898)

@bfitzexpensify I think we need to update the expected to avoid confusion. As in #32898, the expected should be The amount in IOU details page should revert to the original amount after getting the error

@mkzie2
Copy link
Contributor

mkzie2 commented Dec 30, 2024

@bfitzexpensify Please help to take a look at this comment when you have time

@melvin-bot melvin-bot bot added the Overdue label Dec 30, 2024
@tylerkaraszewski
Copy link
Contributor

No update.

@tylerkaraszewski
Copy link
Contributor

How do I make this not overdue? Does @bfitzexpensify need to comment?

@hungvu193
Copy link
Contributor

Oh I need to comment, I'm still the owner of this issue.

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

melvin-bot bot commented Dec 31, 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 9, 2025
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 9, 2025
Copy link

melvin-bot bot commented Jan 9, 2025

📣 @Tony-MK 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot removed the Overdue label Jan 9, 2025
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Jan 10, 2025
@Tony-MK
Copy link
Contributor

Tony-MK commented Jan 10, 2025

Hey @hungvu193, the PR is ready for review.

@mkzie2
Copy link
Contributor

mkzie2 commented Jan 13, 2025

@tylerkaraszewski I believe this isn't the correct expectation for this issue. Additionally, If we do this, we can have a case that is wrong like and this bug also happens if we edit other fields and the API fails.

  1. Create an expense in WS
  2. First device go offline and edit the amount
  3. Second device paid this one
  4. First device will see the error in the system message
  5. Cancel the payment
  6. After canceling, reload the paid and edit the amount
  7. Now after editing the amount if we clear the error and do with the selected proposal, the amount is reverted to wrong value.

@hungvu193 I don't have access to Slack so please help raise a thread to discuss with @bfitzexpensify and @tylerkaraszewski or other internal teams about the expected again. Also please help to post the video below. about the previous expected in #32898. Let's me know if you need more information, thanks.

Screen.Recording.2025-01-03.at.14.33.08.mov

@hungvu193
Copy link
Contributor

@mkzie2 Appreciate your input, I will review it and keep you posted.

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Jan 15, 2025
@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 28, 2025
@melvin-bot melvin-bot bot changed the title [$250] Expense - Edited amount for a paid request does not revert to paid amount when dismiss the error [HOLD for payment 2025-02-04] [$250] Expense - Edited amount for a paid request does not revert to paid amount when dismiss the error Jan 28, 2025
Copy link

melvin-bot bot commented Jan 28, 2025

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jan 28, 2025
Copy link

melvin-bot bot commented Jan 28, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.89-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 2025-02-04. 🎊

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

Copy link

melvin-bot bot commented Jan 28, 2025

@hungvu193 @bfitzexpensify @hungvu193 The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@garrettmknight garrettmknight moved this from Bugs and Follow Up Issues to Hold for Payment in [#whatsnext] #expense Jan 28, 2025
@hungvu193
Copy link
Contributor

@mkzie2 Appreciate your input, I will review it and keep you posted.

Both @Tony-MK and I tested and couldn't reproduce the bug you mentioned, so we decided to proceed with the PR. Thanks for your input anyway.

@hungvu193
Copy link
Contributor

hungvu193 commented Feb 3, 2025

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other:

Where bug was reported:

  • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
  • 2b. Reported on staging (eg. found during regression or PR testing)
  • 2d. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] 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: I can't really find the offending PR of this issue, we can consider this is an improvement to the request money flow.

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: N/A

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

Test:

  1. Navigate to staging.new.expensify.com.
  2. [User A] Request money from User B.
  3. [User A] Open the IOU details page > Click Amount.
  4. [User B] Pay the request.
  5. [User A] Enter a new amount and save it.
  6. [User A] Close the error message.
  7. Verify that the amount will be reverted to the old amount.

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Feb 3, 2025
@bfitzexpensify
Copy link
Contributor

Payment summary:
@hungvu193 to be paid $250 through NewDot Manual Requests
@Tony-MK paid $250 via Upwork

@github-project-automation github-project-automation bot moved this from Hold for Payment to Done in [#whatsnext] #expense Feb 4, 2025
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 External Added to denote the issue can be worked on by a contributor
Projects
Status: Done
Development

No branches or pull requests

6 participants