Skip to content

"no longer valid" appears on 1st level tag when 2nd level tag is applied with expense rule #82464

Closed

Description

@nlemma

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.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.
  1. Go to staging.new.expensify.com
  2. Go to Account > Expense rules.
  3. Click New rule.
  4. Create a new rule where if merchant contains Apple, Region (second level tag) will change to South.
  5. Go to workspace chat.
  6. Create an expense with Apple as merchant.
  7. 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.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7077233_1771010647068.5.mp4

Bug7077233_1771010647073!Dependent_-_Multi_Level_tags_NEWW.csv

View all open jobs on GitHub

Activity

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

    @melvin-bot

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

  3. melvin-bot commented on Feb 13, 2026

    @melvin-bot

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

  4. melvin-bot commented on Feb 13, 2026

    @melvin-bot

    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.

  5. github-actions commented on Feb 13, 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. OSBotify commented on Feb 13, 2026

    @OSBotify
    Contributor

    🔍 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), 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:

    1. User creates a rule: "If merchant contains Apple, set Region = South"
    2. Rule is applied, setting tag to something like :South (first level empty, second level set)
    3. Validation logic in ViolationsUtils.ts (specifically getTagViolationForIndependentTags at lines 142-158) checks each tag level independently
    4. First-level tag ("State") is found to be missing/invalid
    5. 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?

    1. This affects a core workflow (expense rules with dependent tags)
    2. The fix requires understanding the complex interplay between:
      • Tag dependency validation
      • Rule application logic
      • Multi-level tag parsing
    3. 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
    4. Rolling forward would require significant testing with dependent vs independent tag systems
  7. situchan commented on Feb 13, 2026

    @situchan
    Contributor

    checking

  8. 4 remaining items

  9. IuliiaHerets commented on Feb 16, 2026

    @IuliiaHerets

    @mountiny issue is still repro, Chrome / v9.3.19-4

    Screen.Recording.2026-02-16.at.14.16.35.mp4
  10. mountiny commented on Feb 16, 2026

    @mountiny
    Contributor

    Testing the revert

  11. m-natarajan commented on Feb 16, 2026

    @m-natarajan

    Not repro but the tag set in rules is also not displayed and no violation appears, Windows 11 / Chrome

    applee.mp4
  12. situchan commented on Feb 16, 2026

    @situchan
    Contributor

    @mountiny issue is still repro, Chrome / v9.3.19-4

    Screen.Recording.2026-02-16.at.14.16.35.mp4

    Looks like you tested with the account set with wrong rule before the fix PR.

  13. added and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Feb 16, 2026
  14. m-natarajan commented on Feb 16, 2026

    @m-natarajan

    Not repro, No multilevel tag option in Expense rules (Reverted). Wim 11/Chrome, 9.3.19-5

    Recording.2398.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions