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-07-10] [HOLD for payment 2024-07-02] [$250] Scan - "Unhold" option appears in report details page of scanning expense #44195

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

Comments

@lanitochka17
Copy link

lanitochka17 commented Jun 22, 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: 9.0.1-0
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat
  3. Submit two scan expenses
  4. Go to transaction thread of either one of the scan expenses
  5. Click on the chat header

Expected Result:

"Unhold" option should not appear in report details page of scanning expense

Actual Result:

"Unhold" option appears in report details page of scanning expense

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

Bug6521355_1719047083743.unhold.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0183882a32ebd33716
  • Upwork Job ID: 1805164343050042330
  • Last Price Increase: 2024-06-24
Issue OwnerCurrent Issue Owner: @hoangzinh
@lanitochka17 lanitochka17 added DeployBlockerCash This issue or pull request should block deployment DeployBlocker Indicates it should block deploying the API labels Jun 22, 2024
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.

Copy link

melvin-bot bot commented Jun 22, 2024

Triggered auto assignment to @Beamanator (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

@lanitochka17
Copy link
Author

@Beamanator FYI 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

@lanitochka17
Copy link
Author

We think that this bug might be related to #wave-collect - Release 1

@Krishna2323
Copy link
Contributor

Krishna2323 commented Jun 22, 2024

Proposal

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

Scan - "Unhold" option appears in report details page of scanning expense

What is the root cause of that problem?

  • We use shouldShowHoldAction const to add hold/unhold action, the shouldShowHoldAction doesn't have a check for scanning request.

    const shouldShowHoldAction = caseID !== CASES.MONEY_REPORT && !isSettled && !isApproved && !isDeletedParentAction && !ReportUtils.isArchivedRoom(parentReport);

  • When adding hold/unhold action we use isExpenseReport && shouldShowHoldAction check and when canHoldUnholdReportAction.canHoldRequest is false, we add unhold action.

    if (isExpenseReport && shouldShowHoldAction) {
    result.push(PromotedActions.hold({isTextHold: canHoldUnholdReportAction.canHoldRequest, reportAction: parentReportAction}));
    }

    hold: ({isTextHold, reportAction}) => ({
    key: CONST.PROMOTED_ACTIONS.HOLD,
    icon: Expensicons.Stopwatch,
    text: Localize.translateLocal(`iou.${isTextHold ? 'hold' : 'unhold'}`),
    onSelected: () => {
    Navigation.dismissModal();
    ReportUtils.changeMoneyRequestHoldStatus(reportAction);
    },
    }),

  • This is wrong because first we don't check for scanning state and then the unhold action is added just because the hold action is false.

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

When adding hold/unhold action, we should make sure that canHoldUnholdReportAction.canHoldRequest or canHoldUnholdReportAction.canUnholdRequest is true. This way hold action will be only added when canHoldUnholdReportAction.canHoldRequest is true and unhold will be only added when canHoldUnholdReportAction.canUnholdRequest is true. canHoldUnholdReportAction.canUnholdRequest will be only true when request is already on hold.

if (isExpenseReport && shouldShowHoldAction) {
result.push(PromotedActions.hold({isTextHold: canHoldUnholdReportAction.canHoldRequest, reportAction: parentReportAction}));
}

if (isExpenseReport && shouldShowHoldAction && (canHoldUnholdReportAction.canHoldRequest || canHoldUnholdReportAction.canUnholdRequest)) {
    result.push(PromotedActions.hold({isTextHold: canHoldUnholdReportAction.canHoldRequest, reportAction: parentReportAction}));
}

What alternative solutions did you explore? (Optional)

We can get the transaction from onyx and use TransactionUtils to determine if the receipt is being scanned and add the check to shouldShowHoldAction or at the if check which adds the action.

const isScanning = TransactionUtils.hasReceipt(transaction) && TransactionUtils.isReceiptBeingScanned(transaction);

Result

can_hold_unhold_issue.mp4

@mountiny mountiny added External Added to denote the issue can be worked on by a contributor and removed DeployBlocker Indicates it should block deploying the API labels Jun 24, 2024
@melvin-bot melvin-bot bot changed the title Scan - "Unhold" option appears in report details page of scanning expense [$250] Scan - "Unhold" option appears in report details page of scanning expense Jun 24, 2024
Copy link

melvin-bot bot commented Jun 24, 2024

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

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

melvin-bot bot commented Jun 24, 2024

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

@mountiny
Copy link
Contributor

@Krishna2323 Are you available to raise the PR for this quickly?

@Krishna2323
Copy link
Contributor

@mountiny, yes.

@Beamanator
Copy link
Contributor

Hey @mountiny i'm planning to test this out & figure out the PR that caused the regression (probably #43251)

@mountiny
Copy link
Contributor

@Beamanator thanks!

@Beamanator
Copy link
Contributor

Beamanator commented Jun 24, 2024

@Krishna2323 I don't really like adding (canHoldUnholdReportAction.canHoldRequest || canHoldUnholdReportAction.canUnholdRequest) to the if condition before result.push(PromotedActions.hold, mainly because I feel like .canHoldRequest and .canUnholdRequest should always relate to shouldShowHoldAction - a.k.a. why not add (canHoldUnholdReportAction.canHoldRequest || canHoldUnholdReportAction.canUnholdRequest) into the calculation of shouldShowHoldAction?

I see that isScanning is already used in ReportUtils.canHoldUnholdReportAction so hopefully this is all we need?

@Krishna2323
Copy link
Contributor

@Beamanator, yeah we can do that when calculating shouldShowHoldAction, it will work.

@Beamanator
Copy link
Contributor

I ping'd @grgia and @cdOut in internal slack thread (here) so will wait for their thoughts

@Beamanator
Copy link
Contributor

Ok @cdOut will make the PR to fix, @Krishna2323 we should still pay you something for finding the correct root cause & providing the best solution (assuming we end up going with your solution in the end, which i think we will)

@Beamanator Beamanator added the Bug Something is broken. Auto assigns a BugZero manager. label Jun 24, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Hourly KSv2 labels Jun 24, 2024
@Beamanator Beamanator removed DeployBlockerCash This issue or pull request should block deployment Reviewing Has a PR in review labels Jun 24, 2024
@Beamanator
Copy link
Contributor

Working well in staging!! @sonialiap i believe we're ready for payment!

@Krishna2323 provided the correct regression which helped @cdOut complete the PR (since it was a regression)

Also @hoangzinh was C+ for the PR 👍

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jun 25, 2024
@melvin-bot melvin-bot bot changed the title [$250] Scan - "Unhold" option appears in report details page of scanning expense [HOLD for payment 2024-07-02] [$250] Scan - "Unhold" option appears in report details page of scanning expense Jun 25, 2024
Copy link

melvin-bot bot commented Jun 25, 2024

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

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

  • @hoangzinh requires payment (Needs manual offer from BZ)

Copy link

melvin-bot bot commented Jun 25, 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.
  • [@sonialiap] 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 Jul 2, 2024
Copy link

melvin-bot bot commented Jul 2, 2024

Payment Summary

Upwork Job

  • ROLE: @hoangzinh paid $(AMOUNT) via Upwork (LINK)

BugZero Checklist (@sonialiap)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1805164343050042330/hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@sonialiap
Copy link
Contributor

sonialiap commented Jul 3, 2024

Payment summary
@hoangzinh $250 - offer sent in Upwork - paid ✔️
@Krishna2323 $250 - offer sent in Upwork - paid ✔️

@hoangzinh
Copy link
Contributor

Accepted. thanks @sonialiap

@Krishna2323
Copy link
Contributor

@sonialiap, I'm also eligible for payment. Can you pls check this #44195 (comment)? Thanks

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Jul 3, 2024
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2024-07-02] [$250] Scan - "Unhold" option appears in report details page of scanning expense [HOLD for payment 2024-07-10] [HOLD for payment 2024-07-02] [$250] Scan - "Unhold" option appears in report details page of scanning expense Jul 3, 2024
Copy link

melvin-bot bot commented Jul 3, 2024

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

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

  • @hoangzinh requires payment (Needs manual offer from BZ)

Copy link

melvin-bot bot commented Jul 3, 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.
  • [@sonialiap] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@sonialiap
Copy link
Contributor

@Krishna2323 sorry I missed that! Offer sent

@Krishna2323
Copy link
Contributor

@sonialiap, offer accepted.

@sonialiap
Copy link
Contributor

@hoangzinh please complete the checklist

@hoangzinh
Copy link
Contributor

It's a DB issue, we already found the offending PR here #44195 (comment), therefore I think we don't need a checklist for this issue anymore

Copy link

melvin-bot bot commented Jul 10, 2024

Payment Summary

Upwork Job

  • ROLE: @hoangzinh paid $(AMOUNT) via Upwork (LINK)

BugZero Checklist (@sonialiap)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1805164343050042330/hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

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. Engineering 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