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
"no longer valid" appears on 1st level tag when 2nd level tag is applied with expense rule #82464
Version Number: 9.3.19-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:#81454 Email or phone of affected tester (no customers):josdijosdjodniosnjd@gmail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.2 / Chrome App Component: Money Requests
Action Performed:
Precondition:
Default workspace has dependent multi level tags.
Go to staging.new.expensify.com
Go to Account > Expense rules.
Click New rule.
Create a new rule where if merchant contains Apple, Region (second level tag) will change to South.
Go to workspace chat.
Create an expense with Apple as merchant.
Open the expense report.
Expected Result:
"State no longer valid" violation will not appear on the first level tag.
Actual Result:
"State no longer valid" violation appears on the first level tag when second level tag is applied via expense rule.
👋 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:
Identify the pull request that introduced this issue and revert it.
Classification: Frontend bug Causing PR: #81454 - "feat: rule - support multilevel tags" by @situchan (High confidence) Related Issues: #81094 (original feature request)
Recommendation: REVERT
PR #81454 should be reverted from staging. The PR introduced support for multilevel tags in expense rules but has a critical bug with dependent tag validation.
Labels: Keeping DeployBlockerCash (App deploy blocked), removing DeployBlocker if present (not a backend issue)
📋 Detailed Analysis
Evidence
PR #81454 was merged on 2026-02-13 at 12:57:01Z and is included in the staging deploy checklist (9.3.19-1). The issue was reported shortly after on staging, confirming the timeline matches.
The PR changed how tags are handled in expense rules:
Before: Rules could only set a single tag value for all tag levels
After: Rules can now set individual values for each tag level independently
Verification
The PR modifies key files related to tag handling in rules:
src/pages/settings/Rules/Fields/AddTagPage.tsx - Changed to handle individual tag levels using orderWeight parameter
src/pages/workspace/rules/MerchantRules/AddTagPage.tsx - Same change for merchant rules
src/libs/TagUtils.ts - Added trimTag() function to handle colon-delimited multi-level tags
src/libs/TransactionUtils/index.ts - Uses getTagArrayFromName() to split tags by colons
Root Cause
The bug occurs when a rule applies only a second-level tag (e.g., "Region") in a dependent multi-level tag system:
User creates a rule: "If merchant contains Apple, set Region = South"
Rule is applied, setting tag to something like :South (first level empty, second level set)
Validation logic in ViolationsUtils.ts (specifically getTagViolationForIndependentTags at lines 142-158) checks each tag level independently
First-level tag ("State") is found to be missing/invalid
System creates TAG_OUT_OF_POLICY violation showing "State no longer valid"
The issue is that dependent tags require parent tags to be set first, but the rule allows setting child tags independently without validating the parent requirement. The PR correctly implemented multilevel tag selection in rules UI but did not account for dependent tag validation rules.
Why Revert?
This affects a core workflow (expense rules with dependent tags)
The fix requires understanding the complex interplay between:
Tag dependency validation
Rule application logic
Multi-level tag parsing
A proper fix needs to either:
Prevent rules from setting child tags without parents in dependent systems, OR
Skip violation checks for tags set by rules, OR
Apply parent tags automatically when child tags are set by rules
Rolling forward would require significant testing with dependent vs independent tag systems
Please re-state the problem that we are trying to solve in this issue.
When a workspace has dependent multi-level tags and an expense rule sets only a 2nd-level tag (e.g., Region = "South") without setting the 1st-level tag (e.g., State), the transaction displays a "State no longer valid" (tagOutOfPolicy) violation on the 1st-level tag. This is incorrect -- the expected behavior is either no violation or the more appropriate "All tags required" message.
What is the root cause of that problem?
There are two layers to this bug, both stemming from PR #81454 introducing partial multi-level tag support in expense rules:
Layer 1 -- How the rule stores partial tags:
When a user configures a rule to set only the 2nd-level tag, src/pages/settings/Rules/Fields/AddTagPage.tsx:47-50 builds the tag string by joining tag levels with colons and calling trimTag(). For a 2-level system where only the 2nd level (orderWeight=1) is set to "South":
Parses ':South' via getTagArrayFromName into ['', 'South']
Detects tags.includes('') is true (line 98)
Pushes ALL_TAG_LEVELS_REQUIRED ("All tags required") -- NOT TAG_OUT_OF_POLICY
The client code never generates TAG_OUT_OF_POLICY for dependent tags -- that logic only exists in getTagViolationForIndependentTags at lines 142-157, which is only reached when hasDependentTags = false.
However, the server computes its own violations and returns them via API response Onyx updates, which overwrite the client's correct optimistic violations. The server generates TAG_OUT_OF_POLICY with data.tagName = "State" for the empty first-level tag, which renders as "State no longer valid" (per src/languages/en.ts:7716).
Evidence this is server-generated:
Client's getTagViolationsForDependentTags (lines 85-108) only produces MISSING_TAG or ALL_TAG_LEVELS_REQUIRED, never TAG_OUT_OF_POLICY
getTagViolationsForMultiLevelTags at lines 177-183 strips all existing tag violations before re-computing, but the server response arrives after and overwrites
The violation message "State no longer valid" uses the tagOutOfPolicy translation, not allTagLevelsRequired ("All tags required")
What changes do you think we should make in order to solve the problem?
The fix should be server-side: the backend violation computation needs to properly distinguish dependent vs independent multi-level tags. For dependent tags with partial values like :South, the server should return ALL_TAG_LEVELS_REQUIRED instead of TAG_OUT_OF_POLICY with the first-level tag name.
If a server-side fix is not feasible in the short term, a client-side workaround can be applied: after receiving server violations via Onyx updates, re-run the client-side violation computation (which already handles this correctly) to normalize the violations. This could be done by ensuring getViolationsOnyxData is called after server violations are received, similar to how it's already called optimistically during expense creation at src/libs/actions/IOU/index.ts:2562-2570.
What alternative solutions did you explore? (Optional)
Alternative 1 -- Prevent rules from setting partial tags for dependent tag systems: In AddTagPage.tsx, when the policy has dependent tags, require all tag levels to be set when any level is set. This prevents the :South tag string from being stored, but limits the feature's functionality.
Alternative 2 -- Client-side post-processing of server violations: Add logic in the Onyx subscription for TRANSACTION_VIOLATIONS to detect and replace TAG_OUT_OF_POLICY violations with the correct violation type for dependent tag policies. This is a workaround rather than a root fix.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.
Activity
melvin-bot commentedon Feb 13, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #81454
melvin-bot commentedon Feb 13, 2026
💬 A slack conversation has been started in #expensify-open-source
melvin-bot commentedon Feb 13, 2026
Triggered auto assignment to @heyjennahay (
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.github-actions commentedon Feb 13, 2026
👋 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:
OSBotify commentedon Feb 13, 2026
🔍 Investigation Summary
Classification: Frontend bug
Causing PR: #81454 - "feat: rule - support multilevel tags" by @situchan (High confidence)
Related Issues: #81094 (original feature request)
Recommendation: REVERT
PR #81454 should be reverted from staging. The PR introduced support for multilevel tags in expense rules but has a critical bug with dependent tag validation.
Labels: Keeping
DeployBlockerCash(App deploy blocked), removingDeployBlockerif present (not a backend issue)📋 Detailed Analysis
Evidence
PR #81454 was merged on 2026-02-13 at 12:57:01Z and is included in the staging deploy checklist (9.3.19-1). The issue was reported shortly after on staging, confirming the timeline matches.
The PR changed how tags are handled in expense rules:
Verification
The PR modifies key files related to tag handling in rules:
src/pages/settings/Rules/Fields/AddTagPage.tsx- Changed to handle individual tag levels usingorderWeightparametersrc/pages/workspace/rules/MerchantRules/AddTagPage.tsx- Same change for merchant rulessrc/libs/TagUtils.ts- AddedtrimTag()function to handle colon-delimited multi-level tagssrc/libs/TransactionUtils/index.ts- UsesgetTagArrayFromName()to split tags by colonsRoot Cause
The bug occurs when a rule applies only a second-level tag (e.g., "Region") in a dependent multi-level tag system:
:South(first level empty, second level set)ViolationsUtils.ts(specificallygetTagViolationForIndependentTagsat lines 142-158) checks each tag level independentlyTAG_OUT_OF_POLICYviolation showing "State no longer valid"The issue is that dependent tags require parent tags to be set first, but the rule allows setting child tags independently without validating the parent requirement. The PR correctly implemented multilevel tag selection in rules UI but did not account for dependent tag validation rules.
Why Revert?
situchan commentedon Feb 13, 2026
checking
2 remaining items
MelvinBot commentedon Feb 13, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a workspace has dependent multi-level tags and an expense rule sets only a 2nd-level tag (e.g., Region = "South") without setting the 1st-level tag (e.g., State), the transaction displays a "State no longer valid" (
tagOutOfPolicy) violation on the 1st-level tag. This is incorrect -- the expected behavior is either no violation or the more appropriate "All tags required" message.What is the root cause of that problem?
There are two layers to this bug, both stemming from PR #81454 introducing partial multi-level tag support in expense rules:
Layer 1 -- How the rule stores partial tags:
When a user configures a rule to set only the 2nd-level tag,
src/pages/settings/Rules/Fields/AddTagPage.tsx:47-50builds the tag string by joining tag levels with colons and callingtrimTag(). For a 2-level system where only the 2nd level (orderWeight=1) is set to "South":newTags=['', 'South']newTags.join(':')=':South'trimTag(':South')=':South'(only trailing colons are stripped persrc/libs/TagUtils.ts:17-19)This
:Southstring (empty 1st level, "South" 2nd level) is stored as the rule's tag value and applied to transactions.Layer 2 -- Server-side violation computation generates the wrong violation type:
The client-side violation code correctly handles this case.
getTagViolationsForDependentTagsat line 97-104:':South'viagetTagArrayFromNameinto['', 'South']tags.includes('')is true (line 98)ALL_TAG_LEVELS_REQUIRED("All tags required") -- NOTTAG_OUT_OF_POLICYThe client code never generates
TAG_OUT_OF_POLICYfor dependent tags -- that logic only exists ingetTagViolationForIndependentTagsat lines 142-157, which is only reached whenhasDependentTags = false.However, the server computes its own violations and returns them via API response Onyx updates, which overwrite the client's correct optimistic violations. The server generates
TAG_OUT_OF_POLICYwithdata.tagName = "State"for the empty first-level tag, which renders as "State no longer valid" (persrc/languages/en.ts:7716).Evidence this is server-generated:
getTagViolationsForDependentTags(lines 85-108) only producesMISSING_TAGorALL_TAG_LEVELS_REQUIRED, neverTAG_OUT_OF_POLICYgetTagViolationsForMultiLevelTagsat lines 177-183 strips all existing tag violations before re-computing, but the server response arrives after and overwritestagOutOfPolicytranslation, notallTagLevelsRequired("All tags required")What changes do you think we should make in order to solve the problem?
The fix should be server-side: the backend violation computation needs to properly distinguish dependent vs independent multi-level tags. For dependent tags with partial values like
:South, the server should returnALL_TAG_LEVELS_REQUIREDinstead ofTAG_OUT_OF_POLICYwith the first-level tag name.If a server-side fix is not feasible in the short term, a client-side workaround can be applied: after receiving server violations via Onyx updates, re-run the client-side violation computation (which already handles this correctly) to normalize the violations. This could be done by ensuring
getViolationsOnyxDatais called after server violations are received, similar to how it's already called optimistically during expense creation atsrc/libs/actions/IOU/index.ts:2562-2570.What alternative solutions did you explore? (Optional)
Alternative 1 -- Prevent rules from setting partial tags for dependent tag systems: In
AddTagPage.tsx, when the policy has dependent tags, require all tag levels to be set when any level is set. This prevents the:Southtag string from being stored, but limits the feature's functionality.Alternative 2 -- Client-side post-processing of server violations: Add logic in the Onyx subscription for
TRANSACTION_VIOLATIONSto detect and replaceTAG_OUT_OF_POLICYviolations with the correct violation type for dependent tag policies. This is a workaround rather than a root fix.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.IuliiaHerets commentedon Feb 16, 2026
@mountiny issue is still repro, Chrome / v9.3.19-4
Screen.Recording.2026-02-16.at.14.16.35.mp4
mountiny commentedon Feb 16, 2026
Testing the revert
m-natarajan commentedon Feb 16, 2026
Not repro but the tag set in rules is also not displayed and no violation appears, Windows 11 / Chrome
applee.mp4
situchan commentedon Feb 16, 2026
Looks like you tested with the account set with wrong rule before the fix PR.
m-natarajan commentedon Feb 16, 2026
Not repro, No multilevel tag option in Expense rules (Reverted). Wim 11/Chrome, 9.3.19-5
Recording.2398.mp4