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
Version Number: V9.3.40 Reproducible in staging?: Yes Reproducible in production?: Unable to validate in Prod - Provide reasoning. If this was caught during regression testing, add the test name, ID and link from BrowserStack:#78472 Email or phone of affected tester (no customers):dreamnitethedragon+yydyd373@gmail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Web App Component: Money Requests
Action Performed:
Launch app
Create workspace
Enable tax
Go to Workspace chat
Create an expense entering merchant and select tax rate 1 - 5%
Go to workspace settings
Delete tax rate 1 - 5%
Add a tax rate hj - 5%
Go to workspace chat
Note preview shows tax no longer valid
Open the transaction thread and note tax no longer valid briefly shown and disappeared
Open tax and note deleted tax is selected and greyed
Expected Result:
Deleted tax is selected and greyed so violation message must be shown and not disappeared.
Actual Result:
Deleted tax is selected and greyed but violation message briefly shown and disappeared.
Please re-state the problem that we are trying to solve in this issue.
When a tax rate used on an expense is deleted from workspace settings, the "Tax no longer valid" violation message appears briefly in the transaction thread and then disappears. The deleted tax remains selected and greyed out, but the violation message does not persist as expected.
What is the root cause of that problem?
The deletePolicyTaxes function (src/libs/actions/TaxRate.ts:285-411) only updates ONYXKEYS.COLLECTION.POLICY data — it does not recompute or update TRANSACTION_VIOLATIONS for any affected transactions.
The violation computation logic lives in ViolationsUtils.getViolationsOnyxData() (src/libs/Violations/ViolationsUtils.ts:643-649), which checks whether the transaction's taxCode exists in policy.taxRates.taxes:
However, this function is only called imperatively during transaction edit operations (create, edit, move) — there is no reactive mechanism that re-runs violation computation when policy data changes.
The "flash then disappear" behavior happens because:
When opening the transaction thread, the OpenReport API call may return TRANSACTION_VIOLATIONS from the server that include the taxOutOfPolicy violation — causing it to briefly appear
A subsequent server response or Pusher event overwrites the TRANSACTION_VIOLATIONS Onyx key with data that does not include this violation, causing it to disappear
During the optimistic DELETE phase, the tax key still exists in the policy object (marked with pendingAction: DELETE), so any client-side recomputation would incorrectly find isTaxInPolicy === true and not add the violation
What changes do you think we should make in order to solve the problem?
In deletePolicyTaxes (src/libs/actions/TaxRate.ts), after computing the policy optimistic/success/failure data, we should also find all transactions whose taxCode matches any of the deleted tax IDs and add optimistic TRANSACTION_VIOLATIONS updates that include the taxOutOfPolicy violation. This is similar to how other actions like changeTransactionsReport in Transaction.ts call ViolationsUtils.getViolationsOnyxData() for affected transactions.
Specifically:
Query Onyx for all transactions that reference the deleted tax codes
For each affected transaction, compute updated violations using ViolationsUtils.getViolationsOnyxData() (passing the policy with the tax already removed so isTaxInPolicy returns false)
Add these violation updates to the optimistic/failure data arrays in the deletePolicyTaxes API call
This ensures the taxOutOfPolicy violation is added immediately when the tax is deleted, rather than relying on the server to push it back asynchronously.
What alternative solutions did you explore? (Optional)
An alternative would be to introduce a reactive Onyx listener that watches for changes to policy.taxRates.taxes and re-runs getViolationsOnyxData for all transactions in the workspace. However, this would be a larger architectural change and could have performance implications. The targeted approach of updating violations within deletePolicyTaxes is more consistent with existing patterns in the codebase.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
changed the title [-]Expense - Tax violation message briefly shown and disappeared.[/-][+][$250] Expense - Tax violation message briefly shown and disappeared.[/+]on Mar 19, 2026
Please re-state the problem that we are trying to solve in this issue.
When a tax rate used by an expense is deleted from workspace settings, the transaction still shows that deleted tax selected (greyed out), but the Tax no longer valid violation appears briefly and then disappears.
The violation should stay visible until the user selects a valid tax.
What is the root cause of that problem?
Tax validity is currently treated as “tax code key exists in policy,” but that is not enough during delete flow.
In src/libs/Violations/ViolationsUtils.ts, tax checks consider a tax valid even when it is:
pendingAction: DELETE, or isDisabled: true.
Because of that, later violation recomputation incorrectly clears taxOutOfPolicy, causing the flash/disappear behavior.
What changes do you think we should make in order to solve the problem?
Update tax validity logic in src/libs/Violations/ViolationsUtils.ts so a tax is considered valid only if it is active.
Specifically:
In getViolationsOnyxData(...), replace key-existence-only tax check with an active-tax check:
tax entry exists
not disabled
not pending delete
[`${CONST.VIOLATIONS_PREFIX}${CONST.VIOLATIONS.TAX_OUT_OF_POLICY}`]: ()=>{if(!taxCode||!policyTaxRates){return!taxCode;}const matchingTaxRate =policyTaxRates[taxCode];constisActiveTax=!!matchingTaxRate&&!matchingTaxRate.isDisabled&&matchingTaxRate.pendingAction!==CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;if(!isActiveTax){returnfalse;}// If taxValue is provided, require value match. Otherwise active tax code is enough.returntaxValue!==undefined ? matchingTaxRate.value===taxValue : true;},
In getIsViolationFixed(...) for taxOutOfPolicy, apply the same active-tax criteria before deciding the violation is fixed.
This is the key optimal fix because it keeps taxOutOfPolicy when the selected tax is deleted/being deleted, including IOU flows that already use ViolationsUtils.getViolationsOnyxData(...).
What alternative solutions did you explore? (Optional)
Recomputing violations for all affected transactions inside deletePolicyTaxes.
I did not choose this as the primary fix because it is broader and heavier.
Adding UI-only persistence for the violation message.
I did not choose this because it masks stale logic instead of fixing the source-of-truth validation.
Please re-state the problem that we are trying to solve in this issue.
When a workspace tax rate used by an expense is deleted and a new tax rate is added, the expense preview in the workspace chat correctly shows "Tax no longer valid". However, upon opening the transaction thread, the violation message briefly appears and then disappears. The deleted tax is still shown as selected and greyed out in the tax field, but the violation message does not persist.
Expected: The "Tax no longer valid" violation message persists in the transaction thread since the deleted tax is still selected.
Actual: The violation message briefly flashes and disappears in the transaction thread.
What is the root cause of that problem?
When a tax rate is deleted via deletePolicyTaxes, the function does not call pushTransactionViolationsOnyxData to optimistically recalculate the TAX_OUT_OF_POLICY violation for affected transactions. This is inconsistent with how category and tag deletions are handled — both call pushTransactionViolationsOnyxData to ensure violations are computed immediately.
The TAX_OUT_OF_POLICY violation is computed client-side inside getViolationsOnyxData by checking whether the transaction's taxCode still exists in policy.taxRates.taxes:
Without the optimistic violation recalculation during tax deletion, the violation only arrives from the server response. When the transaction thread is subsequently opened, the OpenReport server response can overwrite the local violation data, causing the briefly-visible violation to disappear.
What changes do you think we should make in order to solve the problem?
Call pushTransactionViolationsOnyxData inside deletePolicyTaxes — the same pattern already used by category and tag operations — so that TAX_OUT_OF_POLICY violations are computed optimistically at delete time.
This requires three changes:
1. src/libs/actions/TaxRate.ts — Update deletePolicyTaxes to accept PolicyData (instead of just Policy) and call pushTransactionViolationsOnyxData with an optimistic policy that has the deleted taxes filtered out.
importusePolicyDatafrom'@hooks/usePolicyData';// inside the component:constpolicyData=usePolicyData(policyID);constdeleteTaxes=useCallback(()=>{if(!policy?.id){return;}deletePolicyTaxes(policyData,selectedTaxesIDs,localeCompare);setIsDeleteModalVisible(false);InteractionManager.runAfterInteractions(()=>{setSelectedTaxesIDs([]);});},[policy?.id,policyData,selectedTaxesIDs,localeCompare]);
3. src/pages/workspace/taxes/WorkspaceEditTaxPage.tsx — Same pattern, use usePolicyData and pass policyData.
importusePolicyDatafrom'@hooks/usePolicyData';// inside the component:constpolicyData=usePolicyData(policyID);constdeleteTaxRate=()=>{if(!policyID){return;}deletePolicyTaxes(policyData,[taxID],localeCompare);setIsDeleteModalVisible(false);Navigation.goBack();};
This ensures TAX_OUT_OF_POLICY is added to Onyx immediately when a tax is deleted, consistent with how TAG_OUT_OF_POLICY and CATEGORY_OUT_OF_POLICY violations are handled. The violation persists through any subsequent server syncs because the optimistic data is in place before the API call completes.
This is most likely a BE issue. The tax is indeed deleted and no longer available. Even if we create a new tax with the same value, the ID is different (the ID is based on the name).
This issue has not been updated in over 15 days. @bernhardoj, @c3024 eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
Activity
MelvinBot commentedon Mar 19, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a tax rate used on an expense is deleted from workspace settings, the "Tax no longer valid" violation message appears briefly in the transaction thread and then disappears. The deleted tax remains selected and greyed out, but the violation message does not persist as expected.
What is the root cause of that problem?
The
deletePolicyTaxesfunction (src/libs/actions/TaxRate.ts:285-411) only updatesONYXKEYS.COLLECTION.POLICYdata — it does not recompute or updateTRANSACTION_VIOLATIONSfor any affected transactions.The violation computation logic lives in
ViolationsUtils.getViolationsOnyxData()(src/libs/Violations/ViolationsUtils.ts:643-649), which checks whether the transaction'staxCodeexists inpolicy.taxRates.taxes:However, this function is only called imperatively during transaction edit operations (create, edit, move) — there is no reactive mechanism that re-runs violation computation when policy data changes.
The "flash then disappear" behavior happens because:
OpenReportAPI call may returnTRANSACTION_VIOLATIONSfrom the server that include thetaxOutOfPolicyviolation — causing it to briefly appearTRANSACTION_VIOLATIONSOnyx key with data that does not include this violation, causing it to disappearpendingAction: DELETE), so any client-side recomputation would incorrectly findisTaxInPolicy === trueand not add the violationWhat changes do you think we should make in order to solve the problem?
In
deletePolicyTaxes(src/libs/actions/TaxRate.ts), after computing the policy optimistic/success/failure data, we should also find all transactions whosetaxCodematches any of the deleted tax IDs and add optimisticTRANSACTION_VIOLATIONSupdates that include thetaxOutOfPolicyviolation. This is similar to how other actions likechangeTransactionsReportinTransaction.tscallViolationsUtils.getViolationsOnyxData()for affected transactions.Specifically:
ViolationsUtils.getViolationsOnyxData()(passing the policy with the tax already removed soisTaxInPolicyreturnsfalse)deletePolicyTaxesAPI callThis ensures the
taxOutOfPolicyviolation is added immediately when the tax is deleted, rather than relying on the server to push it back asynchronously.What alternative solutions did you explore? (Optional)
An alternative would be to introduce a reactive Onyx listener that watches for changes to
policy.taxRates.taxesand re-runsgetViolationsOnyxDatafor all transactions in the workspace. However, this would be a larger architectural change and could have performance implications. The targeted approach of updating violations withindeletePolicyTaxesis more consistent with existing patterns in the codebase.Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
melvin-bot commentedon Mar 19, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @bernhardoj (
External)[-]Expense - Tax violation message briefly shown and disappeared.[/-][+][$250] Expense - Tax violation message briefly shown and disappeared.[/+]melvin-bot commentedon Mar 19, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022034628906822029942
kgshriramm commentedon Mar 19, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a tax rate used by an expense is deleted from workspace settings, the transaction still shows that deleted tax selected (greyed out), but the
Tax no longer validviolation appears briefly and then disappears.The violation should stay visible until the user selects a valid tax.
What is the root cause of that problem?
Tax validity is currently treated as “tax code key exists in policy,” but that is not enough during delete flow.
In
src/libs/Violations/ViolationsUtils.ts, tax checks consider a tax valid even when it is:pendingAction: DELETE, orisDisabled: true.Because of that, later violation recomputation incorrectly clears
taxOutOfPolicy, causing the flash/disappear behavior.What changes do you think we should make in order to solve the problem?
Update tax validity logic in
src/libs/Violations/ViolationsUtils.tsso a tax is considered valid only if it is active.Specifically:
getViolationsOnyxData(...), replace key-existence-only tax check with an active-tax check:tax entry exists
not disabled
not pending delete
getIsViolationFixed(...)fortaxOutOfPolicy, apply the same active-tax criteria before deciding the violation is fixed.This is the key optimal fix because it keeps
taxOutOfPolicywhen the selected tax is deleted/being deleted, including IOU flows that already useViolationsUtils.getViolationsOnyxData(...).What alternative solutions did you explore? (Optional)
I did not choose this as the primary fix because it is broader and heavier.
I did not choose this because it masks stale logic instead of fixing the source-of-truth validation.
abbasifaizan70 commentedon Mar 19, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a workspace tax rate used by an expense is deleted and a new tax rate is added, the expense preview in the workspace chat correctly shows "Tax no longer valid". However, upon opening the transaction thread, the violation message briefly appears and then disappears. The deleted tax is still shown as selected and greyed out in the tax field, but the violation message does not persist.
Expected: The "Tax no longer valid" violation message persists in the transaction thread since the deleted tax is still selected.
Actual: The violation message briefly flashes and disappears in the transaction thread.
What is the root cause of that problem?
When a tax rate is deleted via
deletePolicyTaxes, the function does not callpushTransactionViolationsOnyxDatato optimistically recalculate theTAX_OUT_OF_POLICYviolation for affected transactions. This is inconsistent with how category and tag deletions are handled — both callpushTransactionViolationsOnyxDatato ensure violations are computed immediately.App/src/libs/actions/TaxRate.ts
Lines 285 to 411 in d05d2a0
For comparison,
deletePolicyTagsdoes callpushTransactionViolationsOnyxData:App/src/libs/actions/Policy/Tag.ts
Line 485 in d05d2a0
And
setWorkspaceCategoryEnabled/ category delete functions also call it:App/src/libs/actions/Policy/Category.ts
Line 449 in d05d2a0
The
TAX_OUT_OF_POLICYviolation is computed client-side insidegetViolationsOnyxDataby checking whether the transaction'staxCodestill exists inpolicy.taxRates.taxes:App/src/libs/Violations/ViolationsUtils.ts
Line 430 in d05d2a0
App/src/libs/Violations/ViolationsUtils.ts
Lines 643 to 649 in d05d2a0
Without the optimistic violation recalculation during tax deletion, the violation only arrives from the server response. When the transaction thread is subsequently opened, the
OpenReportserver response can overwrite the local violation data, causing the briefly-visible violation to disappear.What changes do you think we should make in order to solve the problem?
Call
pushTransactionViolationsOnyxDatainsidedeletePolicyTaxes— the same pattern already used by category and tag operations — so thatTAX_OUT_OF_POLICYviolations are computed optimistically at delete time.This requires three changes:
1.
src/libs/actions/TaxRate.ts— UpdatedeletePolicyTaxesto acceptPolicyData(instead of justPolicy) and callpushTransactionViolationsOnyxDatawith an optimistic policy that has the deleted taxes filtered out.App/src/libs/actions/TaxRate.ts
Lines 285 to 411 in d05d2a0
2.
src/pages/workspace/taxes/WorkspaceTaxesPage.tsx— UseusePolicyDatahook and passpolicyDatatodeletePolicyTaxes.App/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx
Lines 244 to 255 in d05d2a0
3.
src/pages/workspace/taxes/WorkspaceEditTaxPage.tsx— Same pattern, useusePolicyDataand passpolicyData.App/src/pages/workspace/taxes/WorkspaceEditTaxPage.tsx
Lines 60 to 67 in d05d2a0
This ensures
TAX_OUT_OF_POLICYis added to Onyx immediately when a tax is deleted, consistent with howTAG_OUT_OF_POLICYandCATEGORY_OUT_OF_POLICYviolations are handled. The violation persists through any subsequent server syncs because the optimistic data is in place before the API call completes.Test Branch
https://github.com/abbasifaizan70/Expensify/tree/85810
bernhardoj commentedon Mar 20, 2026
This is most likely a BE issue. The tax is indeed deleted and no longer available. Even if we create a new tax with the same value, the ID is different (the ID is based on the name).
@Expensify/contributor-plus-backend
46 remaining items
c3024 commentedon May 1, 2026
Asked for a clarification on Slack.
[-][$250] Expense - Tax violation message briefly shown and disappeared.[/-][+][HOLD Auth PR 20508] [$250] Expense - Tax violation message briefly shown and disappeared.[/+]c3024 commentedon May 22, 2026
The Auth PR on which this is held has been deployed. Requested QA to retest.
m-natarajan commentedon May 22, 2026
Chrome / app 9.3.79-2
Message disappeared
Deleted tax rate not shown
REC-20260522160757.mp4
melvin-bot commentedon Jun 15, 2026
This issue has not been updated in over 15 days. @bernhardoj, @c3024 eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
melvin-bot commentedon Aug 28, 2026
@bernhardoj, @c3024, this Monthly task hasn't been acted upon in 6 weeks; closing.
If you disagree, feel encouraged to reopen it -- but pick your least important issue to close instead.