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
[Due for payment 2026-10-02] Distance Rate - Rate out of policy violation shown briefly after employee change distance #97838
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 contributor
changed the title [-]Distance Rate - Rate out of policy violation shown briefly after employee change distance[/-][+][$250] Distance Rate - Rate out of policy violation shown briefly after employee change distance[/+]on Aug 4, 2026
Primary Root Cause:src/libs/actions/IOU/UpdateMoneyRequest.ts, inside getUpdateMoneyRequestParams, the optimistic-violation recompute block. When the employee edits distance/waypoints, the code strips a fixed allow‑list of distance violations and then hands the remaining set to ViolationsUtils.getViolationsOnyxData:
if(hasModifiedDistanceRate||hasModifiedDistance||hasPendingWaypoints){// Clear stale distance-related violations while the server reprocesses.// The server will re-evaluate and re-add any that legitimately apply.optimisticViolations=optimisticViolations.filter((violation)=>!(violation.name===CONST.VIOLATIONS.MODIFIED_AMOUNT&&violation.data?.type===CONST.MODIFIED_AMOUNT_VIOLATION_DATA.DISTANCE)&&violation.name!==CONST.VIOLATIONS.INCREASED_DISTANCE,);}
...
constviolationsOnyxData=ViolationsUtils.getViolationsOnyxData({
updatedTransaction,transactionViolations: optimisticViolations,
policy,
...
distanceOriginalPolicy,});optimisticData.push(violationsOnyxData);
Why: the filter only clears MODIFIED_AMOUNT (distance) and INCREASED_DISTANCE. It does not clear the "rate out of policy" violation for a disabled/out-of-date-range custom-unit rate. getViolationsOnyxData is then called with the employee's stale local copy of the policy, in which the admin's just-disabled "Old rate" is still enabled. Because the local policy still shows the rate as valid, the recompute produces a violation set that momentarily re-derives the out-of-policy flag before the server response arrives and reconciles — producing the "shown briefly then disappears" flash.
Secondary Root Cause:src/libs/actions/IOU/UpdateMoneyRequest.ts, getUpdateTrackExpenseParams — the same class of bug on the track-expense path. It calls syncCustomUnitRateOutOfDateRangeViolation(...)only when hasModifiedDistanceRate || hasModifiedCreated || hasModifiedDate, never on a pure distance/waypoint edit:
Bug Category: Model-vs-reality divergence + incomplete optimistic-clear allow-list (stale-cache race). The employee's local policy is stale (rate still enabled) while the server has it disabled; the optimistic recompute trusts the stale model and the clear-list omits the rate violation.
Mechanism:
Admin disables "Old rate" server-side; the employee's Onyx policy copy is not yet updated (still enabled).
Employee edits distance → updateMoneyRequestDistance → getUpdateMoneyRequestParams with distance/waypoints in transactionChanges.
hasModifiedDistance/hasPendingWaypoints is true, so the optimisticViolations filter runs — but it removes only MODIFIED_AMOUNT(distance) and INCREASED_DISTANCE, not the rate-out-of-policy violation.
ViolationsUtils.getViolationsOnyxData recomputes against the stale local policy and pushes an optimistic violations write; because the local rate still validates against a now-different amount, the out-of-policy flag flashes.
optimisticData.push(violationsOnyxData) writes it → MoneyRequestView renders the banner briefly.
Server success/Pusher push delivers the authoritative (correct) violation set → banner disappears.
What changes do you think we should make in order to solve the problem?
provide code snippet
Fix Option 1 (Recommended):src/libs/actions/IOU/UpdateMoneyRequest.ts, inside the if (hasModifiedDistanceRate || hasModifiedDistance || hasPendingWaypoints) block of getUpdateMoneyRequestParams. Add the rate-out-of-policy / custom-unit-out-of-date-range violation to the optimistic clear-list so a distance edit stops re-flagging a rate the server is already reprocessing.
Why best: it's the exact deepest point where the stale violation is passed forward, it mirrors the pattern the file already uses for the rate-change path (optimisticViolations.filter((v) => v.name !== CONST.VIOLATIONS.CUSTOM_UNIT_RATE_OUT_OF_DATE_RANGE)), and it lets the server remain the source of truth. It solves the flash because the recompute no longer carries the stale rate violation into getViolationsOnyxData.
Fix Option 2 (Alternative):src/libs/actions/IOU/UpdateMoneyRequest.ts, in getUpdateTrackExpenseParams, broaden the sync condition to also cover distance edits:
Before: hasModifiedDistanceRate || hasModifiedCreated || hasModifiedDate gates the syncCustomUnitRateOutOfDateRangeViolation call.
After: also include a hasModifiedDistance/hasPendingWaypoints term so the track-expense path re-syncs the rate violation on a pure distance edit.
Trade-off: covers the self-DM/track path (needed for completeness) but is secondary — the reported repro is a workspace expense, which flows through Option 1's path.
Alternate fix (rejected): Force-refresh the employee's policy before recompute. Rejected: heavy, racy, and the server already re-evaluates violations — the front end only needs to stop optimistically re-adding the stale one.
Fix
Description
Files to Change
Effort
Risk
Status
1
Add CUSTOM_UNIT_RATE_OUT_OF_DATE_RANGE to the optimistic clear-list in getUpdateMoneyRequestParams distance-edit branch
src/libs/actions/IOU/UpdateMoneyRequest.ts
Low
Low
Recommended
2
Extend getUpdateTrackExpenseParams sync condition to cover distance/waypoint edits
What alternative solutions did you explore? (Optional)
Add only the m flag — matches the line but still erases the title (rejected above).
Move the subtitle to its own label on the server — leaves old charts broken and keeps the App brittle.
Revert the localizer — restores the original wrong behavior.
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.
changed the title [-][$250] Distance Rate - Rate out of policy violation shown briefly after employee change distance[/-][+]Distance Rate - Rate out of policy violation shown briefly after employee change distance[/+]on Aug 4, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-08-04 23:10:26 UTC.
Proposal
What is the root cause of that problem?
When an employee edits distance or waypoints on an existing workspace distance expense whose selected rate was later disabled by an admin, the UI briefly shows "Rate out of policy", then the banner disappears after the server responds. The amount correctly recalculates using the still-selected Old rate. The flash is an optimistic client bug, not a wrong final server state.
Editing distance goes through getUpdateMoneyRequestParams, which rebuilds optimistic violations via ViolationsUtils.getViolationsOnyxData before the API returns:
// If the amount, currency or date have been modified, we remove the duplicate violations since they would be out of date as the transaction has changed
Inside getViolationsOnyxData, a selected rate that is still on the policy but enabled: false falls into the else branch and newly pushes CUSTOM_UNIT_OUT_OF_POLICY:
The server then returns a violation set that keeps Old rate and does not keep that optimistic flag, so the banner clears. Filtering the input violation list in getUpdateMoneyRequestParams cannot stop this, because the producer re-derives CUSTOM_UNIT_OUT_OF_POLICY from policy state regardless of what was filtered out. The employee did not change customUnitRateID; the selected rate should stay Old rate for the amount recalculation.
What changes do you think we should make in order to solve the problem?
In ViolationsUtils.getViolationsOnyxData, add an optional shouldGrandfatherDisabledCustomUnitRate flag. When it is true and the selected rate is present on the policy but disabled, do not newly push CUSTOM_UNIT_OUT_OF_POLICY. Leave any already-present violation untouched. If the rate is absent or deleted, keep today's behavior and still flag it.
In getUpdateMoneyRequestParams, pass shouldGrandfatherDisabledCustomUnitRate: !hasModifiedDistanceRate into getViolationsOnyxData. That covers distance, waypoint, and other non-rate edits that recompute optimistic violations while the employee keeps the previously selected rate. When customUnitRateID itself changes, keep validating against the disabled/absent rate.
Leave setPolicyDistanceRatesEnabled, deletePolicyDistanceRates, create/move flows, and self-DM track-expense behavior unchanged. Admin disable/delete should not be weakened; only optimistic recomputes for edits that do not change the rate should grandfather a present-but-disabled selection.
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.
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 contributor
Activity
[-]Distance Rate - Rate out of policy violation shown briefly after employee change distance[/-][+][$250] Distance Rate - Rate out of policy violation shown briefly after employee change distance[/+]melvin-bot commentedon Aug 4, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022084773229660950997
melvin-bot commentedon Aug 4, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @FitseTLT (
External)Dip-G-Git commentedon Aug 4, 2026
Proposal
What is the root cause of that problem?
src/libs/actions/IOU/UpdateMoneyRequest.ts, insidegetUpdateMoneyRequestParams, the optimistic-violation recompute block. When the employee edits distance/waypoints, the code strips a fixed allow‑list of distance violations and then hands the remaining set toViolationsUtils.getViolationsOnyxData:Why: the filter only clears
MODIFIED_AMOUNT (distance)andINCREASED_DISTANCE. It does not clear the "rate out of policy" violation for a disabled/out-of-date-range custom-unit rate.getViolationsOnyxDatais then called with the employee's stale local copy of the policy, in which the admin's just-disabled "Old rate" is stillenabled. Because the local policy still shows the rate as valid, the recompute produces a violation set that momentarily re-derives the out-of-policy flag before the server response arrives and reconciles — producing the "shown briefly then disappears" flash.src/libs/actions/IOU/UpdateMoneyRequest.ts,getUpdateTrackExpenseParams— the same class of bug on the track-expense path. It callssyncCustomUnitRateOutOfDateRangeViolation(...)only whenhasModifiedDistanceRate || hasModifiedCreated || hasModifiedDate, never on a pure distance/waypoint edit:Why: distance edits skip the rate-out-of-range re-sync entirely, so a stale rate violation survives locally until server reconciliation.
src/libs/actions/IOU/UpdateMoneyRequest.ts(theoptimisticViolationsfilter block insidegetUpdateMoneyRequestParams; theoptimisticViolationsderivation insidegetUpdateTrackExpenseParams).getUpdateMoneyRequestParams/getUpdateTrackExpenseParamsoptimistic-violation pipeline →MoneyRequestViewviolation banner render.policycopy is not yet updated (stillenabled).updateMoneyRequestDistance→getUpdateMoneyRequestParamswithdistance/waypointsintransactionChanges.hasModifiedDistance/hasPendingWaypointsis true, so theoptimisticViolationsfilter runs — but it removes onlyMODIFIED_AMOUNT(distance)andINCREASED_DISTANCE, not the rate-out-of-policy violation.ViolationsUtils.getViolationsOnyxDatarecomputes against the stale local policy and pushes an optimistic violations write; because the local rate still validates against a now-different amount, the out-of-policy flag flashes.optimisticData.push(violationsOnyxData)writes it →MoneyRequestViewrenders the banner briefly.What changes do you think we should make in order to solve the problem?
provide code snippet
Fix Option 1 (Recommended):
src/libs/actions/IOU/UpdateMoneyRequest.ts, inside theif (hasModifiedDistanceRate || hasModifiedDistance || hasPendingWaypoints)block ofgetUpdateMoneyRequestParams. Add the rate-out-of-policy / custom-unit-out-of-date-range violation to the optimistic clear-list so a distance edit stops re-flagging a rate the server is already reprocessing.Before:
After (concept — clear the rate violation too, matching the existing
hasModifiedDistanceRatebranch already used above):Why best: it's the exact deepest point where the stale violation is passed forward, it mirrors the pattern the file already uses for the rate-change path (
optimisticViolations.filter((v) => v.name !== CONST.VIOLATIONS.CUSTOM_UNIT_RATE_OUT_OF_DATE_RANGE)), and it lets the server remain the source of truth. It solves the flash because the recompute no longer carries the stale rate violation intogetViolationsOnyxData.Fix Option 2 (Alternative):
src/libs/actions/IOU/UpdateMoneyRequest.ts, ingetUpdateTrackExpenseParams, broaden the sync condition to also cover distance edits:Before:
hasModifiedDistanceRate || hasModifiedCreated || hasModifiedDategates thesyncCustomUnitRateOutOfDateRangeViolationcall.After: also include a
hasModifiedDistance/hasPendingWaypointsterm so the track-expense path re-syncs the rate violation on a pure distance edit.Trade-off: covers the self-DM/track path (needed for completeness) but is secondary — the reported repro is a workspace expense, which flows through Option 1's path.
Revert Option: Revert Web-Expensify PR mWeb - Back button on workspace chat returns to workspace list instead of workspace settings #54303 (the linked rate/violation change). Not ideal: it would remove the intended server behavior and reintroduce whatever it was fixing; the flash is a front-end optimistic issue, not a server one.
Alternate fix (rejected): Force-refresh the employee's
policybefore recompute. Rejected: heavy, racy, and the server already re-evaluates violations — the front end only needs to stop optimistically re-adding the stale one.CUSTOM_UNIT_RATE_OUT_OF_DATE_RANGEto the optimistic clear-list ingetUpdateMoneyRequestParamsdistance-edit branchsrc/libs/actions/IOU/UpdateMoneyRequest.tsgetUpdateTrackExpenseParamssync condition to cover distance/waypoint editssrc/libs/actions/IOU/UpdateMoneyRequest.tsWhat alternative solutions did you explore? (Optional)
mflag — matches the line but still erases the title (rejected above).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.
[-][$250] Distance Rate - Rate out of policy violation shown briefly after employee change distance[/-][+]Distance Rate - Rate out of policy violation shown briefly after employee change distance[/+]melvin-bot commentedon Aug 4, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022084773250870245287
samranahm commentedon Aug 4, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-08-04 23:10:26 UTC.
Proposal
What is the root cause of that problem?
When an employee edits distance or waypoints on an existing workspace distance expense whose selected rate was later disabled by an admin, the UI briefly shows "Rate out of policy", then the banner disappears after the server responds. The amount correctly recalculates using the still-selected Old rate. The flash is an optimistic client bug, not a wrong final server state.
Editing distance goes through
getUpdateMoneyRequestParams, which rebuilds optimistic violations viaViolationsUtils.getViolationsOnyxDatabefore the API returns:App/src/libs/actions/IOU/UpdateMoneyRequest.ts
Lines 2024 to 2089 in 4331690
Inside
getViolationsOnyxData, a selected rate that is still on the policy butenabled: falsefalls into theelsebranch and newly pushesCUSTOM_UNIT_OUT_OF_POLICY:App/src/libs/Violations/ViolationsUtils.ts
Lines 663 to 677 in 4331690
That violation name maps to the "Rate out of policy" label:
App/src/CONST/index.ts
Line 6418 in 4331690
App/src/languages/en.ts
Line 487 in 4331690
The server then returns a violation set that keeps Old rate and does not keep that optimistic flag, so the banner clears. Filtering the input violation list in
getUpdateMoneyRequestParamscannot stop this, because the producer re-derivesCUSTOM_UNIT_OUT_OF_POLICYfrom policy state regardless of what was filtered out. The employee did not changecustomUnitRateID; the selected rate should stay Old rate for the amount recalculation.What changes do you think we should make in order to solve the problem?
ViolationsUtils.getViolationsOnyxData, add an optionalshouldGrandfatherDisabledCustomUnitRateflag. When it is true and the selected rate is present on the policy but disabled, do not newly pushCUSTOM_UNIT_OUT_OF_POLICY. Leave any already-present violation untouched. If the rate is absent or deleted, keep today's behavior and still flag it.App/src/libs/Violations/ViolationsUtils.ts
Lines 670 to 677 in 4331690
getUpdateMoneyRequestParams, passshouldGrandfatherDisabledCustomUnitRate: !hasModifiedDistanceRateintogetViolationsOnyxData. That covers distance, waypoint, and other non-rate edits that recompute optimistic violations while the employee keeps the previously selected rate. WhencustomUnitRateIDitself changes, keep validating against the disabled/absent rate.App/src/libs/actions/IOU/UpdateMoneyRequest.ts
Lines 2056 to 2089 in 4331690
setPolicyDistanceRatesEnabled,deletePolicyDistanceRates, create/move flows, and self-DM track-expense behavior unchanged. Admin disable/delete should not be weakened; only optimistic recomputes for edits that do not change the rate should grandfather a present-but-disabled selection.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.
92 remaining items
melvin-bot commentedon Oct 1, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Oct 1, 2026
Payment Summary
Resolving PRs:
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Oct 5, 2026
Payment Summary
Contributor: @dilshodmackbook-sketch paid $250 via Upwork
Contributor+: @FitseTLT due $250 via NewDot
@dilshodmackbook-sketch can you please accept the job below? Please reply here and tag me once you have.
https://www.upwork.com/jobs/~022107097382793959173
David-2002065 commentedon Oct 5, 2026
@mallenexpensify accepted thank you
mallenexpensify commentedon Oct 5, 2026
@dilshodmackbook-sketch paid, summary updated above. Thx.
flaviadefaria commentedon Oct 9, 2026
Approved: @FitseTLT due $250 via NewDot
m-natarajan commentedon Nov 4, 2026
@FitseTLT @neil-marcellini This is regrading the Regression test proposal
Disabled-rate behavior was reversed by Show rate out-of-policy violation for disabled Track distance rates, Can I close the Test proposal?
Recording.3776.mp4
mallenexpensify commentedon Nov 4, 2026
cc @flaviadefaria since you were the product reviewer for PR