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-09-12] [$1000] RBR applies to newly created distance expenses when it shouldn't #26567

Closed
JmillsExpensify opened this issue Sep 2, 2023 · 56 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

@JmillsExpensify
Copy link

JmillsExpensify commented Sep 2, 2023

Reproduction video

RPReplay_Final1693665469.1.MP4
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01ccdddd243b0d35e1
  • Upwork Job ID: 1698032042096607232
  • Last Price Increase: 2023-09-02
  • Automatic offers:
    • situchan | Contributor | 26469930
    • Pujan92 | Contributor | 26470378
@JmillsExpensify JmillsExpensify self-assigned this Sep 2, 2023
@JmillsExpensify JmillsExpensify added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 2, 2023

Current assignee @JmillsExpensify is eligible for the Bug assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Sep 2, 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

@hayata-suenaga hayata-suenaga added the External Added to denote the issue can be worked on by a contributor label Sep 2, 2023
@melvin-bot melvin-bot bot changed the title RBR applies to newly created distance expenses when it shouldn't [$500] RBR applies to newly created distance expenses when it shouldn't Sep 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 2, 2023

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

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

melvin-bot bot commented Sep 2, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 2, 2023

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

@hayata-suenaga hayata-suenaga changed the title [$500] RBR applies to newly created distance expenses when it shouldn't [$1000] RBR applies to newly created distance expenses when it shouldn't Sep 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 2, 2023

Upwork job price has been updated to $1000

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 2, 2023
@hayata-suenaga hayata-suenaga added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 2, 2023
@Pujan92
Copy link
Contributor

Pujan92 commented Sep 2, 2023

Assuming it is similar to https://expensify.slack.com/archives/C049HHMV9SM/p1693604955703649

Proposal

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

Shows RBR for successful distance money request

What is the root cause of that problem?

In the MoneyRequestPreview we have a condition for hasMissingSmartscanFields which should not be consider for distance request. Bcoz we do not need to scan any fields for the distance request even though it has a receipt which generate through map.

const hasFieldErrors = TransactionUtils.hasMissingSmartscanFields(props.transaction);

{hasFieldErrors && (
<Icon
src={Expensicons.DotIndicator}
fill={colors.red}
/>
)}

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

I think we need to consider this RBR only for scanned requests. So we can add 1 more condition to ignore distance requests.
&& !isDistanceRequest(transaction)

function hasMissingSmartscanFields(transaction) {
return hasReceipt(transaction) && !isReceiptBeingScanned(transaction) && !areModifiedFieldsPopulated(transaction);
}

OR
!isDistanceRequest &&

Screenshot 2023-09-02 at 23 38 56

@b4s36t4
Copy link
Contributor

b4s36t4 commented Sep 2, 2023

Proposal

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

RBR applies to newly created distance expenses when it shouldn't

What is the root cause of that problem?

We have a field called hasErrors which checks for weather the transaction is valid or not. One of the check is returning false which is causing the issue.

The preview is enabled for Scan & Distance requests both but we're only checking the status for Scan related items.

function isReceiptBeingScanned(transaction) {
This function has the logic wrong.

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

We need to add CONST.IOU.RECEIPT_STATE.OPEN to the list which ensures we're also checking for the distance requests as well.

What alternative solutions did you explore? (Optional)

NA

Screenshot 2023-09-02 at 11 36 55 PM

@b4s36t4
Copy link
Contributor

b4s36t4 commented Sep 2, 2023

Kapture.2023-09-02.at.23.38.07.mp4

@b4s36t4
Copy link
Contributor

b4s36t4 commented Sep 2, 2023

Screenshot 2023-09-02 at 11 40 11 PM

@b4s36t4
Copy link
Contributor

b4s36t4 commented Sep 2, 2023

@hayata-suenaga requesting the review. Although I humbly request you to carefully review the proposals please 😅😂

@situchan
Copy link
Contributor

situchan commented Sep 2, 2023

@Pujan92's root cause is correct and first solution looks good.
We should add condition in hasMissingSmartscanFields so that it fixes both ReportPreview and MoneyRequestPreview

@parasharrajat
Copy link
Member

parasharrajat commented Sep 2, 2023

@situchan Can you please explain the basis as well? Why do you think that is correct?

@b4s36t4
Copy link
Contributor

b4s36t4 commented Sep 2, 2023

I'd say Scan and Distance are same except we're generating receipt in the backend. Loosening for one might break things somewhere else. Maybe wrong too

@Pujan92
Copy link
Contributor

Pujan92 commented Sep 2, 2023

When we have the transaction with receipt we try to make sure whether the receipt is being scanned or not inside hasMissingSmartscanFields. But for the case of distance request we have the receipt but we already verified the data before creating the request. So for specific to that type we need to avoid checking isReceiptBeingScanned.

I think adding a condition in one place hasMissingSmartscanFields makes more sense otherwise all the places we need to avoid calling hasMissingSmartscanFields by putting a condition of not distance transaction.

@melvin-bot
Copy link

melvin-bot bot commented Sep 5, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 5, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.63-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 2023-09-12. 🎊

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 Sep 5, 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:

  • [@situchan] The PR that introduced the bug has been identified. Link to the PR:
  • [@situchan] 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:
  • [@situchan] 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:
  • [@situchan] Determine if we should create a regression test for this bug.
  • [@situchan] 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.
  • [@JmillsExpensify] 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 Overdue and removed Weekly KSv2 labels Sep 12, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 15, 2023

@JmillsExpensify, @Pujan92, @hayata-suenaga, @situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@melvin-bot
Copy link

melvin-bot bot commented Sep 19, 2023

@JmillsExpensify, @Pujan92, @hayata-suenaga, @situchan 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@melvin-bot
Copy link

melvin-bot bot commented Sep 21, 2023

@JmillsExpensify, @Pujan92, @hayata-suenaga, @situchan 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!

@situchan
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: Display Smartscan errors #26155
  • 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: https://github.com/Expensify/App/pull/26155/files#r1313964793
  • 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: N/A
  • Determine if we should create a regression test for this bug.
  • 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.

I don't think we need special regression test here as long as we have distance request test case in TestRail.
If regression occurs again, it's clearly noticeable after creating any distance request.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Sep 21, 2023
@hayata-suenaga
Copy link
Contributor

waiting for payment

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Sep 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 28, 2023

@JmillsExpensify, @Pujan92, @hayata-suenaga, @situchan Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

@JmillsExpensify, @Pujan92, @hayata-suenaga, @situchan 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@hayata-suenaga
Copy link
Contributor

still waiting for payment

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Oct 3, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 6, 2023

@JmillsExpensify, @Pujan92, @hayata-suenaga, @situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@JmillsExpensify
Copy link
Author

Payment summary:

Issue reporter: N/A
Contributor: @Pujan92 $1,500 (price updated for internal priority; incl. urgency bonus)
Contributor+: @situchan $1,500 (price updated for internal priority; incl. urgency bonus)

@melvin-bot melvin-bot bot removed the Overdue label Oct 7, 2023
@JmillsExpensify
Copy link
Author

Offers sent to all contributors via Upwork.

@Pujan92
Copy link
Contributor

Pujan92 commented Oct 8, 2023

Offer Accepted!

@situchan
Copy link
Contributor

situchan commented Oct 8, 2023

I already have accepted offer - #26567 (comment)

@Pujan92
Copy link
Contributor

Pujan92 commented Oct 8, 2023

I also applied from this, needs to cancel/end the latter one.

@JmillsExpensify
Copy link
Author

Ah thanks. The job was closed in Upwork and I wasn't able to see the contract from the job. In any case, I paid both out via Upwork and have canceled the other offers. Thanks all!

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
None yet
Development

No branches or pull requests

8 participants