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-11-13] [$250] RBR isn't displayed when scanning failed #50799

Closed
1 of 6 tasks
m-natarajan opened this issue Oct 15, 2024 · 49 comments
Closed
1 of 6 tasks
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

@m-natarajan
Copy link

m-natarajan commented Oct 15, 2024

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: 9.0.49-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: @DylanDylann
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1728897430938149

Action Performed:

  1. Login to new account
  2. Create new workspace
  3. Create a manual request on the above workspace
  4. Next, create a scan request with wrong image on the above workspace
  5. Waiting for scanning
  6. Go to transaction thread and see that there are no RBR on LHN

Expected Result:

RBR is displayed when scanning failed

Actual Result:

RBR isn't displayed when scanning failed

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

BUG-RBR.mov
Recording.661.mp4
Add any screenshot/video evidence

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021846286418177490016
  • Upwork Job ID: 1846286418177490016
  • Last Price Increase: 2024-10-22
  • Automatic offers:
    • DylanDylann | Contributor | 104595958
    • daledah | Contributor | 104676254
Issue OwnerCurrent Issue Owner: @isabelastisser
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 15, 2024
Copy link

melvin-bot bot commented Oct 15, 2024

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

@daledah
Copy link
Contributor

daledah commented Oct 15, 2024

Proposal

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

The RBR doesn't display in LHn even though the scanning failed

What is the root cause of that problem?

function hasWarningTypeViolation(transactionID: string, transactionViolations: OnyxCollection<TransactionViolation[]>): boolean {
if (!Permissions.canUseDupeDetection(allBetas ?? [])) {
return false;
}

hasWarningTypeViolation always returns false if canUseDupeDetection is false, but dupe detection is only one reason that causes a warning violation type. When a receipt scanning fails, the BE still returns a warning violation

Screenshot 2024-10-14 at 16 41 33

In this case, hasWarningTypeViolation should return true

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

We should only check canUseDupeDetection permission if all warning violations are DUPLICATED_TRANSACTION. If another reason like smartscanFailed causes a warning violation, hasWarningTypeViolation still should return true

This is my draft implementation for the above idea, we can improve it later

function hasWarningTypeViolation(transactionID: string, transactionViolations: OnyxCollection<TransactionViolation[]>): boolean {
    const warningTypeViolations = transactionViolations?.[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS + transactionID]?.filter(
        (violation: TransactionViolation) => violation.type === CONST.VIOLATION_TYPES.WARNING,
    );
    if (!Permissions.canUseDupeDetection(allBetas ?? []) && warningTypeViolations?.every((violation) => violation.name === CONST.VIOLATIONS.DUPLICATED_TRANSACTION)) {
        return false;
    }
    return !!warningTypeViolations && warningTypeViolations.length > 0;
}

What alternative solutions did you explore? (Optional)

@FitseTLT
Copy link
Contributor

Proposal

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

RBR isn't displayed when scanning failed

What is the root cause of that problem?

We already have the logic to check for missing smart scan fields for thread transaction threads here

!report?.parentReportID || !report?.parentReportActionID ? undefined : allReportActions?.[report.parentReportID ?? '-1']?.[report.parentReportActionID ?? '-1'];
if (ReportActionUtils.wasActionTakenByCurrentUser(parentReportAction) && ReportActionUtils.isTransactionThread(parentReportAction)) {
const transactionID = ReportActionUtils.isMoneyRequestAction(parentReportAction) ? ReportActionUtils.getOriginalMessage(parentReportAction)?.IOUTransactionID : null;
const transaction = allTransactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`];
if (TransactionUtils.hasMissingSmartscanFields(transaction ?? null) && !ReportUtils.isSettled(transaction?.reportID)) {
reportActionErrors.smartscan = ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericSmartscanFailureMessage');
reportAction = undefined;
}

the only problem being we are trying to access allReportActions without the report actions collection prefix

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

Change it to

const parentReportAction: OnyxEntry<ReportAction> =
        !report?.parentReportID || !report?.parentReportActionID
            ? undefined
            : allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.parentReportID ?? '-1'}`]?.[report.parentReportActionID ?? '-1'];

What alternative solutions did you explore? (Optional)

@DylanDylann
Copy link
Contributor

DylanDylann commented Oct 15, 2024

@isabelastisser I discovered this bug while reviewing this PR. Just a note, when implementing PR to fix this issue, we also need to ensure that RBR in scanning failed works well for the debug feature

@pac-guerreiro
Copy link
Contributor

I can apply the fix for this in #50468 before it gets merged

@FitseTLT
Copy link
Contributor

@pac-guerreiro The issue is totally unrelated with the PR, it has nothing to do with Debug (it's just only linked because @DylanDylann found it coincedentally reviewing the pr) I don't see it logical to fix it there and, of course, as we have proposed appropriate fixes here.
@DylanDylann WDYT

@isabelastisser isabelastisser added External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors labels Oct 15, 2024
Copy link

melvin-bot bot commented Oct 15, 2024

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

@melvin-bot melvin-bot bot changed the title RBR isn't displayed when scanning failed [$250] RBR isn't displayed when scanning failed Oct 15, 2024
Copy link

melvin-bot bot commented Oct 15, 2024

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

@DylanDylann
Copy link
Contributor

DylanDylann commented Oct 16, 2024

@getusha Could I take over this from you?

IMO, I think we should fix this issue on #50468 to ensure RBR in scanning failed works well for the debug feature

@DylanDylann
Copy link
Contributor

If we consider this issue only, we should apply both proposals (@FitseTLT and @daledah) because we are using hasErrors || hasViolations. @daledah fixes the problem on hasViolations, @FitseTLT fixes the problem on hasErrors

@FitseTLT
Copy link
Contributor

If we consider this issue only, we should apply both proposals (@FitseTLT and @daledah) because we are using hasErrors || hasViolations. @daledah fixes the problem on hasViolations, @FitseTLT fixes the problem on hasErrors

I disagree with this @DylanDylann because, firstly, we don't normally show rbr for warning type violations we only allowed that for hold as an exception. Secondly, we handle the missing smart scan fields via hasMissingSmartscanFields in other places like for iouReport here and for the current case of transactionThread report we already have the code here

!report?.parentReportID || !report?.parentReportActionID ? undefined : allReportActions?.[report.parentReportID ?? '-1']?.[report.parentReportActionID ?? '-1'];
if (ReportActionUtils.wasActionTakenByCurrentUser(parentReportAction) && ReportActionUtils.isTransactionThread(parentReportAction)) {
const transactionID = ReportActionUtils.isMoneyRequestAction(parentReportAction) ? ReportActionUtils.getOriginalMessage(parentReportAction)?.IOUTransactionID : null;
const transaction = allTransactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`];
if (TransactionUtils.hasMissingSmartscanFields(transaction ?? null) && !ReportUtils.isSettled(transaction?.reportID)) {
reportActionErrors.smartscan = ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericSmartscanFailureMessage');
reportAction = undefined;
}

The problem is we forgot ONYXKEYS.COLLECTION.REPORT_ACTIONS prefix as I have discussed in my proposal and that is the correct RCA.

@DylanDylann
Copy link
Contributor

DylanDylann commented Oct 16, 2024

we don't normally show rbr for warning type violations

@FitseTLT Wait wait, why do you think so? Please correct me If I am missing anything

@FitseTLT
Copy link
Contributor

@FitseTLT Wait wait, why do you think so? Please correct me If I am missing anything

We are returning false if permission for dupe detection is off

if (!Permissions.canUseDupeDetection(allBetas ?? [])) {
return false;

that clearly shows an intent to disable as long as we are on beta for dupe detection so will require separate discussion if we need to allow it. And regarding the current issue, missing scanning fields, there is a clear way to handle it, which checks for missing fields, that is used in all other places so in this case we need to only fix the problem I mentioned to make the already existing code to work.

Copy link

melvin-bot bot commented Oct 21, 2024

@isabelastisser, @getusha Huh... This is 4 days overdue. Who can take care of this?

@melvin-bot melvin-bot bot added the Overdue label Oct 21, 2024
Copy link

melvin-bot bot commented Oct 22, 2024

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

@isabelastisser
Copy link
Contributor

@getusha, please provide an update, thanks! I will DM you for visibility.

@DylanDylann
Copy link
Contributor

@isabelastisser Could you please check this comment? I reported this bug and have more context here

@isabelastisser
Copy link
Contributor

@DylanDylann, are you referring to this comment: #50799 (comment)?

@getusha, can you please review the discussion above and weigh in? Thanks!

@DylanDylann
Copy link
Contributor

@isabelastisser Ahh yes 😄

@getusha
Copy link
Contributor

getusha commented Oct 23, 2024

Go ahead @DylanDylann

@getusha getusha removed their assignment Oct 23, 2024
@melvin-bot melvin-bot bot removed the Overdue label Oct 23, 2024
Copy link

melvin-bot bot commented Oct 29, 2024

@Julesssss @isabelastisser @DylanDylann this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@DylanDylann
Copy link
Contributor

@MelvinBot No, we close to the implementation phase

@DylanDylann
Copy link
Contributor

@Julesssss Friendly bump

@Julesssss
Copy link
Contributor

@Julesssss What do you think about split compensation for both @daledah and @FitseTLT as per this comment

We can. But who would like to implement?

@DylanDylann
Copy link
Contributor

@daledah @FitseTLT Who wants to implement PR? I think we can split 150$ for the implementer and 100$ for the rest one

@daledah
Copy link
Contributor

daledah commented Oct 31, 2024

@DylanDylann I can raise a PR ASAP for this.

@DylanDylann
Copy link
Contributor

Perfect

cc @Julesssss

Copy link

melvin-bot bot commented Oct 31, 2024

📣 @daledah 🎉 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 added Reviewing Has a PR in review Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 Weekly KSv2 labels Oct 31, 2024
@melvin-bot melvin-bot bot changed the title [$250] RBR isn't displayed when scanning failed [HOLD for payment 2024-11-13] [$250] RBR isn't displayed when scanning failed Nov 6, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 6, 2024
Copy link

melvin-bot bot commented Nov 6, 2024

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

Copy link

melvin-bot bot commented Nov 6, 2024

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

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

Copy link

melvin-bot bot commented Nov 6, 2024

@DylanDylann @isabelastisser 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]

@DylanDylann
Copy link
Contributor

DylanDylann commented Nov 6, 2024

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
  • 2b. Reported on staging (deploy blocker)
  • 2c. 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: Put duplicate detection under a new beta #43864 (comment)

  • [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:

  • [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.

Regression Test Proposal Template
  • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

    Link to issue: It happens long time ago and It is hard to find the exact PR that cause this problem

Regression Test Proposal

Precondition:

Test:

  1. Login with a new account, create a WS and submit a manual expense
  2. Submit a scan expense with a wrong image
  3. After scanning, verify that: RBR is displayed for the transaction thread in LHN

Do we agree 👍 or 👎

@FitseTLT
Copy link
Contributor

FitseTLT commented Nov 6, 2024

@isabelastisser It is to remind you the payment setup for this issue it's $100 for me and $150 for @daledah based on #50799 (comment) Thx!

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Nov 12, 2024
@isabelastisser
Copy link
Contributor

Payment summary:

@daledah requires payment automatic offer (Contributor) $150 Paid!
@FitseTLT paid in Upwork C+. $100.

All set!

@DylanDylann
Copy link
Contributor

@isabelastisser In this issue, we split the compensation to two contributors (@daledah and @FitseTLT). I am C+ on this issue and I should get paid 250$ for this work. Thanks

@isabelastisser
Copy link
Contributor

@DylanDylann, sorry for the confusion! I've processed your payment in Upwork now. Thanks!

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