Skip to content

Expense - Distance expense can still be created after selecting "Out of date" rate. #95108

Closed

Description

@applause-bot

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.4.26-0
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #93555
Email or phone of affected tester (no customers): applausetester+ib0024@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Motorola MotoG60 / Android 12 (Hybrid app) - Windows 11 / Chrome
App Component: Money Requests

Action Performed:

Prerequisite: Use an expensifail account.
Prerequisite 2: User is owner of a workspace with "Distance Rates" enabled.
Prerequisite 3: Two custom distance rates created. (Rate A: 0,67/mi - Valid Jan 1 - Dec 31 2025 - Rate B: 0,70/MI - Valid Jan1 - Dec 31 2026)

  1. Open the staging.new.expensify.com wesbite.
  2. Navigate to workspace chat.
  3. Start creating a new map distance expense and select "Jun 15, 2025" as date.
  4. Note that "Rate A" is automatically selected.
  5. After rate is auto selected, change it manually to "Rate B"
  6. Note that "Out of rate" error appears, but "Create" button is not disabled and expense can still be created.

Expected Result:

When an "Out of date" rate is selected while creating distance expense, user shouldn´t be able to submit expense as "Create" button should be blocked.

Actual Result:

When an "Out of date" rate is selected while creating distance expense, user is still able to submit the expense as "Create" button is not blocked.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7196932_1782939173983.Invalid_4.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7196932

Activity

  1. applause-bot commented on Jul 2, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/e28557fa039df8f0b1a4edeea37e9229e6e2f352da74aeb659bd2c710e9fe163

  2. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jul 2, 2026
  3. melvin-bot commented on Jul 2, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #93555

  4. melvin-bot commented on Jul 2, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  5. github-actions commented on Jul 2, 2026

    @github-actions
    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.
  6. MelvinBot commented on Jul 2, 2026

    @MelvinBot
    Contributor

    Proposal

    TL;DR: The "out of date" rate error is display-only. It's computed locally inside RateField to draw the red brick road, but it is never wired into the confirmation screen's submit-gating logic, so the Create button stays enabled and the expense goes through.

    What is the root cause of that problem?

    PR #93555 added the customUnitRateOutOfDateRange violation and its display, but did not connect it to the create/confirm gating path.

    On the confirmation screen the Create/Submit button has no violation-driven isDisabled — it's only gated at press-time by useConfirmationValidation.validate(). That function checks amount, merchant, category, tax, per-diem, etc., but has no branch for an out-of-date distance rate, so it returns {errorKey: null} and onConfirm fires.

    Meanwhile the "Out of rate" error the user sees is computed locally inside RateField.tsx:72 via DistanceRequestUtils.isCustomUnitRateOutOfDateRange(...) and only drives the brickRoadIndicator / errorText. That isRateOutOfDateRange boolean is never lifted up to the parent or passed to validate(). The display path and the gating path never meet.

    Evidence / data flow

    Select out-of-date rate → RateField computes isRateOutOfDateRange = true → shows red dot + "Out of rate" text (display only) → tap Create → confirmAction runs validate() → no out-of-date branch → returns {errorKey: null} → onConfirm fires → expense created.

    This also explains why the PR's own test steps were internally contradictory: Test 1 ("Submit / Create is not blocked") matches the actual code, while Test 5 ("submit blocked") describes behavior that was never implemented on the create flow.

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

    Add a blocking check to validate() in useConfirmationValidation.ts, reusing the same predicate RateField already uses so the field error and button gating stay in sync. Inside the iouType !== CONST.IOU.TYPE.PAY block, alongside the existing distance checks, when isDistanceRequest and DistanceRequestUtils.isCustomUnitRateOutOfDateRange({customUnitRateID, policy, expenseDate}) is true, return an errorKey so onConfirm is short-circuited. The hook already has transaction (source of customUnitRateID and the expense date via getCreated) and policy.

    What alternative solutions did you explore? (Optional)

    Lifting isRateOutOfDateRange out of RateField and passing an isDisabled into the footer button. This works but fights the codebase's established pattern (the confirm button is gated by press-time validate(), not a disabled prop), so it's the larger/less consistent option.

    ⚠️ One product decision to confirm before implementing

    customUnitRateOutOfDateRange is defined as a WARNING-type violation (RateField.tsx:78), not an error. There's a genuine question of whether a warning-severity violation should hard-block creation. This DeployBlocker + the PR's Test 5 say it should block on create; the current code + Test 1 say it shouldn't. The fix is straightforward once that intent is confirmed — but it should be confirmed so the copy/severity match.

    Confidence: High — root cause is a verifiable code-path gap (confirmed in the checked-out source); no production logs needed.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/95108) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  7. thelullabyy commented on Jul 2, 2026

    @thelullabyy
    Contributor

    I think it is expected behavior

    cc @rlinoz for double check

  8. rlinoz commented on Jul 2, 2026

    @rlinoz
    Contributor

    Yes, it is the expected behavior, closing.

  9. removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringHourlyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions