You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD App 100555] Expense-Rate violation disappears after moving expense to another report #98341
Version Number: V9.4.52-2 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:https://test-management.browserstack.com/projects/2219752/folder/13176670/test-cases/41237109 Email or phone of affected tester (no customers):dreamnitethedragon+vegst@gmail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Redmi note 10s android 13 App Component: Money Requests
Action Performed:
Pre-condition Have 2 Workspace
Launch app
Open default workspace chat
Create a distance manual expense
Open the expense
Tap more - change workspace
Note distance row shows Rate not valid for this workspace
Create another report ( not default workspace)
Open the expense - More - move report - select report created in step 6
Note Rate not valid for this workspace violation is not shown
Expected Result:
The “Rate not valid for this workspace” violation should remain displayed after moving the expense to another report within the same workspace, since the workspace and distance rate have not changed.
Actual Result:
The “Rate not valid for this workspace” violation disappears after moving the expense to another report within the same workspace.
Root Cause: When you move a distance expense to another report, changeTransactionsReport runs an "auto-select a valid default rate" block that fires for any group-policy destination whenever the expense's current rate is invalid/disabled — with no check that the destination is a different workspace (Transaction.ts:1218-1224). A "Rate not valid for this workspace" expense has an invalid rate by definition, so moving it to another report on the same workspace swaps in that workspace's default mileage rate, recalculates amount/merchant/currency, and sends the new rate to the backend. The violation recompute right after then sees a now-valid rate and drops customUnitOutOfPolicy (ViolationsUtils.ts:665-667) — so the violation disappears even though nothing about the workspace or rate should have changed.
This also explains why the "change workspace" path behaves correctly: changeReportPolicy does not auto-swap the rate, so the violation persists there as expected.
What changes do you think we should make in order to solve the problem?
Guard the auto-rate-selection block in getChangeTransactionsReportOnyxData so it only runs when the destination report is on a different policy than the transaction's current/source report. When moving within the same workspace, skip the rate swap entirely — leave the invalid rate (and its customUnitOutOfPolicy violation) untouched. The subsequent violation recompute will then correctly preserve the "Rate not valid for this workspace" violation.
Investigation details & evidence
Violation:customUnitOutOfPolicy (CONST.VIOLATIONS.CUSTOM_UNIT_OUT_OF_POLICY), rendered from en.ts:9832 → 'Rate not valid for this workspace'. It is computed client-side/optimistically in ViolationsUtils.getViolationsOnyxData: pushed when the transaction's customUnitRateID doesn't resolve to an enabled rate in the policy, and reject()-ed (cleared) when it does.
Data flow on the buggy move:
Distance expense already carries customUnitOutOfPolicy (rate invalid for its workspace).
Move to a different report → changeTransactionsReport → getChangeTransactionsReportOnyxData.
Transaction.ts:1221-1224: isGroupPolicy(policy) && isDistanceRequest(transaction) is true and the current rate is invalid → enters the block. There is no oldReport.policyID !== policy.id check here.
It picks getDefaultMileageRate(policy), recalculates amount/merchant/currency, and records transactionIDToUpdatedCustomUnitRateID — which is also sent to the backend, so the change persists on success (not just optimistically).
Transaction.ts:1319-1341 recomputes violations with the now-valid rate → customUnitOutOfPolicy is rejected → violation disappears.
Alternative explanation considered: that the backend independently drops the violation on move. Ruled out as the trigger — the client both swaps the rate and tells the backend to do so, so the disappearance originates in App's optimistic path. (Backend behavior wasn't inspected but the client change is sufficient to explain the symptom.)
Confidence: High — root cause pinned to exact code, both the buggy path and the correct "change workspace" contrast path verified.
Possibly related issues (same "invalid rate" feature cluster)
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/98341#issuecomment-5256823744) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
@neil-marcellini@abdulrahuman5196 this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
In that thread, we decided that whenever an expense is moved to a different policy (either by changing a report's workspace or changing the expense report to a report on a different workspace), we should automatically select a matching rate from that policy or the default rate. The default rate should use the rate that has the narrowest and most recent date range, but I believe we already have that default rate date range logic implemented. For an existing expense, there should be a system message from Concierge explaining that we automatically selected a new distance rate when the workspace was updated, directly or via changing the report. Exact copy TBD. This will need frontend and backend changes.
changed the title [-]Expense-Rate violation disappears after moving expense to another report[/-][+][HOLD App 100555] Expense-Rate violation disappears after moving expense to another report[/+]on Sep 7, 2026
Activity
applause-bot commentedon Aug 11, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/041ded28aadd370cfd593e17b4eea78d6b956131f0535f50080cc59bb42e53e1
MelvinBot commentedon Aug 11, 2026
Proposal
Root Cause: When you move a distance expense to another report,
changeTransactionsReportruns an "auto-select a valid default rate" block that fires for any group-policy destination whenever the expense's current rate is invalid/disabled — with no check that the destination is a different workspace (Transaction.ts:1218-1224). A "Rate not valid for this workspace" expense has an invalid rate by definition, so moving it to another report on the same workspace swaps in that workspace's default mileage rate, recalculates amount/merchant/currency, and sends the new rate to the backend. The violation recompute right after then sees a now-valid rate and dropscustomUnitOutOfPolicy(ViolationsUtils.ts:665-667) — so the violation disappears even though nothing about the workspace or rate should have changed.This also explains why the "change workspace" path behaves correctly:
changeReportPolicydoes not auto-swap the rate, so the violation persists there as expected.What changes do you think we should make in order to solve the problem?
Guard the auto-rate-selection block in
getChangeTransactionsReportOnyxDataso it only runs when the destination report is on a different policy than the transaction's current/source report. When moving within the same workspace, skip the rate swap entirely — leave the invalid rate (and itscustomUnitOutOfPolicyviolation) untouched. The subsequent violation recompute will then correctly preserve the "Rate not valid for this workspace" violation.Investigation details & evidence
Violation:
customUnitOutOfPolicy(CONST.VIOLATIONS.CUSTOM_UNIT_OUT_OF_POLICY), rendered fromen.ts:9832→'Rate not valid for this workspace'. It is computed client-side/optimistically inViolationsUtils.getViolationsOnyxData: pushed when the transaction'scustomUnitRateIDdoesn't resolve to an enabled rate in the policy, andreject()-ed (cleared) when it does.Data flow on the buggy move:
customUnitOutOfPolicy(rate invalid for its workspace).changeTransactionsReport→getChangeTransactionsReportOnyxData.Transaction.ts:1221-1224:isGroupPolicy(policy) && isDistanceRequest(transaction)is true and the current rate is invalid → enters the block. There is nooldReport.policyID !== policy.idcheck here.getDefaultMileageRate(policy), recalculates amount/merchant/currency, and recordstransactionIDToUpdatedCustomUnitRateID— which is also sent to the backend, so the change persists on success (not just optimistically).Transaction.ts:1319-1341recomputes violations with the now-valid rate →customUnitOutOfPolicyis rejected → violation disappears.Alternative explanation considered: that the backend independently drops the violation on move. Ruled out as the trigger — the client both swaps the rate and tells the backend to do so, so the disappearance originates in App's optimistic path. (Backend behavior wasn't inspected but the client change is sufficient to explain the symptom.)
Confidence: High — root cause pinned to exact code, both the buggy path and the correct "change workspace" contrast path verified.
Possibly related issues (same "invalid rate" feature cluster)
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/98341#issuecomment-5256823744)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
melvin-bot commentedon Aug 11, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (
External)melvin-bot commentedon Aug 11, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022087235223820572902
melvin-bot commentedon Aug 14, 2026
@abdulrahuman5196 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
melvin-bot commentedon Aug 18, 2026
@abdulrahuman5196 Still overdue 6 days?! Let's take care of this!
melvin-bot commentedon Aug 20, 2026
@abdulrahuman5196 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!
abdulrahuman5196 commentedon Aug 24, 2026
Checking now
6 remaining items
abdulrahuman5196 commentedon Aug 25, 2026
I don't have access to the thread linked above
melvin-bot commentedon Aug 25, 2026
@neil-marcellini @abdulrahuman5196 this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
neil-marcellini commentedon Aug 26, 2026
In that thread, we decided that whenever an expense is moved to a different policy (either by changing a report's workspace or changing the expense report to a report on a different workspace), we should automatically select a matching rate from that policy or the default rate. The default rate should use the rate that has the narrowest and most recent date range, but I believe we already have that default rate date range logic implemented. For an existing expense, there should be a system message from Concierge explaining that we automatically selected a new distance rate when the workspace was updated, directly or via changing the report. Exact copy TBD. This will need frontend and backend changes.
neil-marcellini commentedon Sep 1, 2026
I have been focused on higher priorities
[-]Expense-Rate violation disappears after moving expense to another report[/-][+][HOLD App 100555] Expense-Rate violation disappears after moving expense to another report[/+]neil-marcellini commentedon Sep 7, 2026
On HOLD until this project is complete, which should solve this completely.
neil-marcellini commentedon Oct 7, 2026
Still on hold
neil-marcellini commentedon Nov 10, 2026
Still holding but upstream is progressing well