Skip to content

[Due for payment 2026-08-14] [Hold #72230] [$250] Expense - In "Rate" field, "Rate out of policy" error is not shown. #73680

Closed

Description

@jponikarchuk

Note

This is currently on hold for #72230

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: V9.2.39-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: retesting https://github.com/Expensify/Expensify/issues/528139
https://test-management.browserstack.com/projects/2219752/folder/13176670/test-cases/41237109
Email or phone of affected tester (no customers): Slottwo1@gmail.com
Issue reported by: Applause Internal Team
Device used: Redminote 10s android 13 phone
App Component: Money Requests

Action Performed:

1.Open the Expensify app.
2.Open any workspace chat.
3.Submit two expenses to it. (One of them, has to be distance expense)
4.Open the report of the just created expenses.
5.Tap on "More"
6.Delete the report
7.Return to LHN.
8.Note that the preview of the distance expense report, it now shows correctly.
9.Open Self DM.
10.Note that expenses are now displayed on that chat
11. Note distance receipt is displayed with empty space
12. Open the distance expense
Note that "Distance" field is displayed correctly,

Expected Result:

In "Rate" field, "Rate out of policy" error must be shown.

Actual Result:

In "Rate" field, "Rate out of policy" error is not shown.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6986635_1761640622926.Screenrecorder-2025-10-28-13-57-36-673.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021983335586114224619
  • Upwork Job ID: 1983335586114224619
  • Last Price Increase: 2025-10-29
  • Automatic offers:
  • FitseTLT | Contributor | 109291007
  • truph01 | Reviewer | 109369818
  • daledah | Contributor | 109369820
Issue Owner

Current Issue Owner: @francoisl

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 28, 2025
  2. melvin-bot commented on Oct 28, 2025

    @melvin-bot

    Triggered auto assignment to @NicMendonca (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 28, 2025

    @daledah
    Contributor

    Proposal

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

    In "Rate" field, "Rate out of policy" error is not shown.

    What is the root cause of that problem?

    We are just checking the workspace conditions here.

    if (isCustomUnitOutOfPolicy && field === 'customUnitRateID') {
    return translate('violations.customUnitOutOfPolicy');
    }

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

    We should update the logic to use utils function isUnreportedAndHasInvalidDistanceRateTransaction like we did in transaction preview here

    if (RBRMessage === undefined && isUnreportedAndHasInvalidDistanceRateTransaction(transaction)) {
    RBRMessage = {translationPath: 'violations.customUnitOutOfPolicy'};
    }

        if (field === 'customUnitRateID' && (isCustomUnitOutOfPolicy || isUnreportedAndHasInvalidDistanceRateTransaction(transaction))) {
            return translate('violations.customUnitOutOfPolicy');
        }
    

    if (isCustomUnitOutOfPolicy && field === 'customUnitRateID') {
    return translate('violations.customUnitOutOfPolicy');
    }

    Note: we can update the isCustomUnitOutOfPolicy variable here

    const isCustomUnitOutOfPolicy = transactionViolations.some((violation) => violation.name === CONST.VIOLATIONS.CUSTOM_UNIT_OUT_OF_POLICY) || (isDistanceRequest && !rate);

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

    None

    What alternative solutions did you explore? (Optional)

    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.

  4. hasib711 commented on Oct 28, 2025

    @hasib711

    Proposal

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

    In "Rate" field, "Rate out of policy" error is not shown.

    What is the root cause of that problem?

    In the report list view, the rate error message appears below the code.
    App/src/libs/TransactionPreviewUtils.ts

    if (isDistanceRequest(transaction)) {
            previewHeaderText = [{translationPath: 'common.distance'}];
    
            if (RBRMessage === undefined && isUnreportedAndHasInvalidDistanceRateTransaction(transaction)) {
                RBRMessage = {translationPath: 'violations.customUnitOutOfPolicy'};
            }
        } 
    

    And on the detail page, the rate error message appears below the code.
    [App/src/components/ReportActionItem/MoneyRequestView.tsx]
    (

    const isCustomUnitOutOfPolicy = transactionViolations.some((violation) => violation.name === CONST.VIOLATIONS.CUSTOM_UNIT_OUT_OF_POLICY) || (isDistanceRequest && !rate);
    const rateToDisplay = isCustomUnitOutOfPolicy ? translate('common.rateOutOfPolicy') : DistanceRequestUtils.getRateForDisplay(unit, rate, currency, translate, toLocaleDigit, isOffline);
    const distanceToDisplay = DistanceRequestUtils.getDistanceForDisplay(hasRoute, distance, unit, rate, translate);
    let merchantTitle = isEmptyMerchant ? '' : transactionMerchant;
    let amountTitle = formattedTransactionAmount ? formattedTransactionAmount.toString() : '';
    if (isTransactionScanning) {
    merchantTitle = translate('iou.receiptStatusTitle');
    amountTitle = translate('iou.receiptStatusTitle');
    }
    const shouldNavigateToUpgradePath = !policyForMovingExpenses && !shouldSelectPolicy;
    const updatedTransactionDescription = useMemo(() => {
    if (!updatedTransaction) {
    return undefined;
    }
    return getDescription(updatedTransaction ?? null);
    }, [updatedTransaction]);
    const isEmptyUpdatedMerchant = updatedTransaction?.modifiedMerchant === '' || updatedTransaction?.modifiedMerchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT;
    const updatedMerchantTitle = isEmptyUpdatedMerchant ? '' : (updatedTransaction?.modifiedMerchant ?? merchantTitle);
    const saveBillable = useCallback(
    (newBillable: boolean) => {
    // If the value hasn't changed, don't request to save changes on the server and just close the modal
    if (newBillable === getBillable(transaction) || !transaction?.transactionID || !report?.reportID) {
    return;
    }
    updateMoneyRequestBillable(transaction.transactionID, report?.reportID, newBillable, policy, policyTagList, policyCategories);
    },
    [transaction, report?.reportID, policy, policyTagList, policyCategories],
    );
    const saveReimbursable = useCallback(
    (newReimbursable: boolean) => {
    // If the value hasn't changed, don't request to save changes on the server and just close the modal
    if (newReimbursable === getReimbursable(transaction) || !transaction?.transactionID || !report?.reportID) {
    return;
    }
    updateMoneyRequestReimbursable(transaction.transactionID, report?.reportID, newReimbursable, policy, policyTagList, policyCategories);
    },
    [transaction, report, policy, policyTagList, policyCategories],
    );
    if (isCardTransaction) {
    if (transactionPostedDate) {
    dateDescription += ` ${CONST.DOT_SEPARATOR} ${translate('iou.posted')} ${transactionPostedDate}`;
    }
    if (formattedOriginalAmount) {
    amountDescription += ` ${CONST.DOT_SEPARATOR} ${translate('iou.original')} ${formattedOriginalAmount}`;
    }
    if (isCancelled) {
    amountDescription += ` ${CONST.DOT_SEPARATOR} ${translate('iou.canceled')}`;
    }
    } else {
    if (!isDistanceRequest && !isPerDiemRequest) {
    amountDescription += ` ${CONST.DOT_SEPARATOR} ${translate('iou.cash')}`;
    }
    if (isCancelled) {
    amountDescription += ` ${CONST.DOT_SEPARATOR} ${translate('iou.canceled')}`;
    } else if (isApproved) {
    amountDescription += ` ${CONST.DOT_SEPARATOR} ${translate('iou.approved')}`;
    } else if (shouldShowPaid) {
    amountDescription += ` ${CONST.DOT_SEPARATOR} ${translate('iou.settledExpensify')}`;
    }
    }
    if (isExpenseSplit) {
    amountDescription += ` ${CONST.DOT_SEPARATOR} ${translate('iou.split')}`;
    }
    const hasErrors = hasMissingSmartscanFields(transaction);
    const pendingAction = transaction?.pendingAction;
    // Need to return undefined when we have pendingAction to avoid the duplicate pending action
    const getPendingFieldAction = (fieldPath: TransactionPendingFieldsKey) => (pendingAction ? undefined : transaction?.pendingFields?.[fieldPath]);
    const getErrorForField = useCallback(
    (field: ViolationField, data?: OnyxTypes.TransactionViolation['data'], policyHasDependentTags = false, tagValue?: string) => {
    // Checks applied when creating a new expense
    // NOTE: receipt field can return multiple violations, so we need to handle it separately
    const fieldChecks: Partial<Record<ViolationField, {isError: boolean; translationPath: TranslationPaths}>> = {
    amount: {
    isError: transactionAmount === 0,
    translationPath: canEditAmount ? 'common.error.enterAmount' : 'common.error.missingAmount',
    },
    merchant: {
    isError: !isSettled && !isCancelled && isPolicyExpenseChat && isEmptyMerchant,
    translationPath: canEditMerchant ? 'common.error.enterMerchant' : 'common.error.missingMerchantName',
    },
    date: {
    isError: transactionDate === '',
    translationPath: canEditDate ? 'common.error.enterDate' : 'common.error.missingDate',
    },
    };
    const {isError, translationPath} = fieldChecks[field] ?? {};
    if (readonly) {
    return '';
    }
    // Return form errors if there are any
    if (hasErrors && isError && translationPath) {
    return translate(translationPath);
    }
    if (isCustomUnitOutOfPolicy && field === 'customUnitRateID') {
    return translate('violations.customUnitOutOfPolicy');
    }
    )

    const isCustomUnitOutOfPolicy = transactionViolations.some((violation) => violation.name === CONST.VIOLATIONS.CUSTOM_UNIT_OUT_OF_POLICY) || (isDistanceRequest && !rate);
     ... ... ..
    if (isCustomUnitOutOfPolicy && field === 'customUnitRateID') {
                    return translate('violations.customUnitOutOfPolicy');
            }
    

    But when we delete a report, we update the transaction’s violation.

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

    We can fix the problem of updating a transaction’s violation when deleting a report.
    App/blob/main/src/libs/actions/Report.ts

    Line: 4951
    function deleteAppReport(reportID: string | undefined) {
        if (!reportID) {
            Log.warn('[Report] deleteReport called with no reportID');
            return;
        }
    ... ... ...
    

    What alternative solutions did you explore? (Optional)

  5. FitseTLT commented on Oct 28, 2025

    @FitseTLT
    Contributor

    Proposal

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

    Expense - In "Rate" field, "Rate out of policy" error is not shown.

    What is the root cause of that problem?

    We already implemented showing rate out of policy for unreported expenses here and we implemented it for MoneyRequestView too

    const isCustomUnitOutOfPolicy = transactionViolations.some((violation) => violation.name === CONST.VIOLATIONS.CUSTOM_UNIT_OUT_OF_POLICY) || (isDistanceRequest && !rate);

    and the rate was calculated with the expensePolicy but we updated the policy to use policyForMovingExpenses when isExpenseUnreported in #72102
    const policy = isExpenseUnreported ? policyForMovingExpenses : expensePolicy;

    so we are getting the rate from the moved policy so the rate will still exist so the error will not show

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

    We should get the rate without using policyForMovingExpenses for the case of isCustomUnitOutOfPolicy

     const isCustomUnitOutOfPolicy =
            transactionViolations.some((violation) => violation.name === CONST.VIOLATIONS.CUSTOM_UNIT_OUT_OF_POLICY) ||
            (isDistanceRequest && !DistanceRequestUtils.getRate({transaction, policy: expensePolicy}).rate);
       
    

    What alternative solutions did you explore? (Optional)

  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 29, 2025
  7. changed the title [-]Expense - In "Rate" field, "Rate out of policy" error is not shown.[/-] [+][$250] Expense - In "Rate" field, "Rate out of policy" error is not shown.[/+] on Oct 29, 2025
  8. melvin-bot commented on Oct 29, 2025

    @melvin-bot
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 29, 2025
  10. melvin-bot commented on Oct 29, 2025

    @melvin-bot

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

  11. truph01 commented on Oct 29, 2025

    @truph01
    Contributor

    @hasib711 Your proposal would require backend changes to address the issue. However, we already have frontend logic in place to display the error, so your approach doesn't seem viable at this time.


    @daledah @FitseTLT Both of your proposals follow a similar general approach: displaying an "out of policy" message below the rate field when the selected rate isn't defined in the expense policy. That said, there are some differences in the implementation details:

    @daledah’s Proposal @FitseTLT’s Proposal
    Image Image

    I'd like to ask @Expensify/design team to determine which behavior is more appropriate in this case. Once we get their input, we can proceed with the preferred approach.

    FYI: The behavior in @FitseTLT’s proposal aligns with the expected outcome described in the test steps.

  12. FitseTLT commented on Oct 29, 2025

    @FitseTLT
    Contributor

    @truph01 I don't think we will need design input here this is a direct regression of test case linked to #65301 (comment) and the expected result clearly is depicted in the test steps

    1. Note that "Distance" field is displayed correctly, "Rate" field is displayed as "Rate out of policy" and there is an error "Rate not valid for this workspace".
  13. 53 remaining items

  14. changed the title [-][Hold #72230] [$250] Expense - In "Rate" field, "Rate out of policy" error is not shown.[/-] [+][Due for payment 2026-08-14] [Hold #72230] [$250] Expense - In "Rate" field, "Rate out of policy" error is not shown.[/+] on Aug 14, 2026
  15. melvin-bot commented on Aug 14, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  16. cristipaval commented on Aug 14, 2026

    @cristipaval
    Contributor

    @cristipaval Could you handle the payment for this issue since both @daledah and I have been assigned to it?

    Defering this to @mallenexpensify

  17. melvin-bot commented on Aug 14, 2026

    @melvin-bot

    Payment Summary

    • Reviewer: @truph01 owed $250 via NewDot
    • Reviewer: @daledah owed $250 via NewDot

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
  18. mallenexpensify commented on Aug 18, 2026

    @mallenexpensify
    Contributor

    @MelvinBot who is due how much here? Link to PRs that were worked on and if mention if they were merged. @truph01 and @daledah, plz chime in with specifics too. I want to avoid going down an 🐰🕳

  19. MelvinBot commented on Aug 18, 2026

    @MelvinBot
    Contributor

    🤖 Short answer: No PR was ever merged for this issue. The bug was fixed as a side-effect of FitseTLT's work on the separate (and separately-paid) hold issue #72230. So the auto-generated Payment Summary above (which lists truph01 and daledah each at $250, both mislabeled "Reviewer") doesn't line up with what actually shipped here — I'd treat it as suspect before paying.

    PRs that touched this bug

    PR Author For issue Status
    Expensify/App#73890 FitseTLT This issue (#73680) Closed, never merged (closed 2026-01-28)
    Expensify/App#74967 FitseTLT #72230 (the hold) Merged 2026-02-28
    Expensify/App#84136 FitseTLT #72230 (the hold) Merged 2026-04-06

    daledah did not open a PR for this issue — the only recent action was verifying the bug is gone via video. The fix landed entirely through FitseTLT's two merged PRs on #72230.

    What happened, briefly

    1. Three proposals came in. truph01 (C+) initially selected FitseTLT's proposal, and FitseTLT opened fix - Expense - In "Rate" field, "Rate out of policy" error is not shown. #73890 to fix it.
    2. Design/product then leaned toward daledah's UI, and it was found to overlap with the Unreported-expenses project ([Due for payment 2026-04-14] [$250] [Unreported] Add distance rate to the distance expenses tracked in selfDM #72230). The issue was put on hold and fix - Expense - In "Rate" field, "Rate out of policy" error is not shown. #73890 was closed unmerged.
    3. The plan was: FitseTLT fixes [Due for payment 2026-04-14] [$250] [Unreported] Add distance rate to the distance expenses tracked in selfDM #72230, then daledah handles any remaining UI here. But [Due for payment 2026-04-14] [$250] [Unreported] Add distance rate to the distance expenses tracked in selfDM #72230's fix (FitseTLT's Fix - [Unreported] Add distance rate to the distance expenses tracked in selfDM #74967 + Feat - [Unreported] Add distance rate to the distance expenses tracked in selfDM #84136) resolved this bug too, so no further code was needed here and daledah never had to open a PR.

    My read on who's due what (please sanity-check)

    So this looks like a candidate to close with no payment on #73680 (fix + comp handled under #72230), unless BZ policy compensates the accepted proposal / C+ review time even when the fix ships via a linked issue. That's the judgment call — flagging it rather than asserting it.

    truph01 / daledah — please confirm: did either of you do billable work that landed outside what FitseTLT merged in #72230?

  20. mallenexpensify commented on Aug 18, 2026

    @mallenexpensify
    Contributor

    @daledah @truph01 can you help with $$$ stuff based on the above? Thx

  21. daledah commented on Aug 24, 2026

    @daledah
    Contributor

    50% payment to contributor and C+ if the contributor was hired/assigned

    @mallenexpensify, since my proposal was accepted and I was assigned to this issue, but the bug can no longer be reproduced, I think i and @truph01 should receive 50% compensation here according to this rule.

  22. mallenexpensify commented on Aug 24, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @daledah due $125 via NewDot
    Contributor+: @truph01 due $125 via NewDot

    From internal docs

    50% payment to contributor and C+ if the contributor was hired/assigned.

  23. quinthar commented on Sep 2, 2026

    @quinthar
    Contributor

    Approved @daledah for $125

  24. garrettmknight commented on Sep 7, 2026

    @garrettmknight
    Contributor

    $125 approved for @truph01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorNot a priorityReviewingHas a PR in review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions