Skip to content

[HOLD for payment 2024-11-13] [$250] RBR isn't displayed when scanning failed #50799

Closed

Description

@m-natarajan

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

Activity

  1. added
    Daily
    Bug
    on Oct 15, 2024
  2. melvin-bot commented on Oct 15, 2024

    @melvin-bot

    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.

  3. daledah commented on Oct 15, 2024

    @daledah
    Contributor

    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)

  4. FitseTLT commented on Oct 15, 2024

    @FitseTLT
    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)

  5. DylanDylann commented on Oct 15, 2024

    @DylanDylann
    Contributor

    @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

  6. pac-guerreiro commented on Oct 15, 2024

    @pac-guerreiro
    Contributor

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

  7. FitseTLT commented on Oct 15, 2024

    @FitseTLT
    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

  8. added
    External
    Help Wanted
    on Oct 15, 2024
  9. melvin-bot commented on Oct 15, 2024

    @melvin-bot
  10. changed the title [-]RBR isn't displayed when scanning failed[/-] [+][$250] RBR isn't displayed when scanning failed[/+] on Oct 15, 2024
  11. melvin-bot commented on Oct 15, 2024

    @melvin-bot

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

  12. 46 remaining items

  13. added
    Weekly
    Awaiting Payment
    on Nov 6, 2024
  14. 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[/+] on Nov 6, 2024
  15. removed
    Reviewing
    on Nov 6, 2024
  16. melvin-bot commented on Nov 6, 2024

    @melvin-bot

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

  17. melvin-bot commented on Nov 6, 2024

    @melvin-bot

    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:

  18. melvin-bot commented on Nov 6, 2024

    @melvin-bot

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

  19. DylanDylann commented on Nov 6, 2024

    @DylanDylann
    Contributor

    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 👎

  20. FitseTLT commented on Nov 6, 2024

    @FitseTLT
    Contributor

    @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!

  21. added
    Daily
    and removed
    Weekly
    on Nov 12, 2024
  22. isabelastisser commented on Nov 13, 2024

    @isabelastisser
    Contributor

    Payment summary:

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

    All set!

  23. DylanDylann commented on Nov 14, 2024

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

  24. isabelastisser commented on Nov 14, 2024

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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions