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
Rules - "Category" is not locked when there are no non default tax rates. #100536
Version Number: 9.4.73-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:#99420 Email or phone of affected tester (no customers):ibellicotest+2766@gmail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Motorola MotoG60 / Android 12 (Hybrid app) - Windows 11 / Chrome App Component: Workspace Settings
Action Performed:
Prerequisite: Use an expensifail account.
Prerequisite 2: Account has a workspace with "Rules" and "Taxes" enabled.
Open the staging.new.expensify.com website.
Navigate to "Workspaces" > Workspace > "Taxes"
Delete all non default taxes.
Navigate to "Rules".
Click on "Add Rule" > "Apply expense defaults" > "Category"
Note that "Category" option is not locked, despite not having any available tax.
Click on "Tax" field.
Note that only "No results found" message is visible.
Expected Result:
"Category" option in "Apply expense defaults" should be locked if "Tax" feature is disabled or if there aren´t taxes available.
Actual Result:
"Category" field is not locked in "Apply expense defaults" despite user not having any non default tax available, and opening "Tax" field leads to a RHP with "No results found" message in it.
👋 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: #99420 - "Add category tax defaults to Expense defaults" by @Krishna2323 (High confidence) Related Issues: None found
Recommendation: ROLL FORWARD
The guard that locks the "Category" card counts all tax rates, while the tax picker it leads to hides the workspace default rate for category rules — so a workspace whose only remaining rate is the default passes the guard and lands on an empty picker. Reverting would pull a 43-file feature PR for a one-line predicate gap, and the whole flow is gated behind the rulesRevamp beta (CONST.BETAS.RULES_REVAMP), so @situchan's "not a blocker" read is correct on the code: it is also a reasonable demote candidate for the BZ/deploy owner.
Assigned: @Krishna2323 (PR author), @JS00001 and @situchan (approving reviewers) — already assigned by Melvin Labels: No changes. DeployBlockerCash is kept — the cause is an Expensify/App PR, and the issue is not reproducible on production (new feature), so it is not eligible for automated removal. DeployBlocker was never applied. Demoting this is an internal judgement call given the beta gate; flagging it rather than doing it.
📋 Detailed Analysis
Evidence
Every file in the reported flow was created by Add category tax defaults to Expense defaults #99420 (merged 2026-09-04, item 40 in the deploy checklist): ExpenseDefaultTypePage.tsx, AddTaxPage.tsx, CategoryTaxRulesUtils.ts and RuleTaxesDisabledEmptyState.tsx are all additions in that PR's diff. There is no prior version of this screen, which matches "N/A - new feature, doesn't exist in prod".
The hasUsableTaxRates helper, the isLocked flag on the Category card, and the shouldHideTax filter in the tax picker are all introduced in the same diff — the guard and its consumer were written together and disagree with each other.
No other PR on the checklist touches these files.
Beta gating (re: "Not blocker. The feature is behind beta")
The picker, for a category rule, deliberately removes the workspace default rate (writing it would delete the rule rather than save it), plus disabled and pending-delete rates:
After step 3 of the repro (delete all non-default taxes), policy.taxRates.taxes still holds the workspace default rate, so hasUsableTaxRates returns true → isLocked: !areTaxesEnabled is false → the Category card is unlocked and showTurnOnTaxesFirstExplainer never fires. Tapping through then reaches AddTaxPage, where areTaxesEnabled is also true so the picker branch renders — but taxItems is empty because the only remaining rate is the default one shouldHideTax strips. Hence "No results found" instead of the RuleTaxesDisabledEmptyState that was written for exactly this situation.
The same gap exists for a workspace whose only rates are all isDisabled, or all pending deletion.
Suggested fix (roll forward): make hasUsableTaxRates count only rates a category rule can actually select — exclude isDisabled, pendingAction === DELETE, and (for the category flow) taxRates.defaultExternalID — and have ExpenseDefaultTypePage, AddTaxPage and MerchantRulePageBase all read that one predicate. The codebase already has this shape for categories and tags in hasEnabledOptions, which does filter on enabled and pendingAction.
💡 Suggested AI code review rule
This bug looks like a recurring, mechanically detectable pattern, so it may be worth a coding-standards rule so the AI reviewer catches the next one. Proposed for Expensify/App:
Rule:CONSISTENCY-19 — Gate an entry point on the same filtered set its destination renders
Condition: When a lock/disable/empty-state guard decides whether a screen or option is reachable based on the size of an Onyx collection (policy.taxRates.taxes, policyCategories, policyTags, cards, …), it must be derived from the same predicate the destination uses to build its list — not a raw Object.keys(...).length > 0. Extract one shared hasUsableX() helper and call it from both sides.
Why: A raw count includes entries the destination filters out (isDisabled, pendingAction === DELETE, the workspace default rate), so the guard reports "available" and the user is routed to a picker rendering "No results found" with no way forward. That is exactly this deploy blocker.
Search pattern:rg 'Object\.(keys|values)\([^)]*(taxRates\?\.taxes|policyCategories|policyTags|Categories|Tags)[^)]*\)(\s*\?\?\s*\{\})?\)?\.length' and flag any hit used as a boolean gate whose corresponding list builder filters on isDisabled, enabled, pendingAction, or defaultExternalID.
Fix (✅): the shape already used for categories and tags — hasEnabledOptions
The full rule file, with the ❌/✅ code inline in App's coding-standards format, would go in Expensify/App itself. If it's worth adding, a maintainer can open it there as a draft PR.
@JS00001@JmillsExpensify, what's the expected behavior here? If we lock category creation when only a default tax exists, what should we prompt the user with when we show the modal? We can't use the same "Category rules set a default tax rate. Turn on taxes in your workspace settings to use them." prompt since taxes are already enabled.
Activity
applause-bot commentedon Sep 7, 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/7b1a276872658febfead7acdb7a006e3763670b655735b54d37d91a45ca13122
melvin-bot commentedon Sep 7, 2026
@JS00001 recently merged #99420, but they are OOO right now, so I'll auto-assign someone else.
github-actions commentedon Sep 7, 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:
melvin-bot commentedon Sep 7, 2026
Triggered auto assignment to @blimpich (
DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.melvin-bot commentedon Sep 7, 2026
@JS00001 @situchan you have been assigned to this deploy blocker because you reviewed the offending PR: #99420
melvin-bot commentedon Sep 7, 2026
@Krishna2323 you have been assigned to this deploy blocker because you authored the offending PR: #99420
2 remaining items
MelvinBot commentedon Sep 7, 2026
🔍 Investigation Summary
Classification: Frontend bug
Causing PR: #99420 - "Add category tax defaults to Expense defaults" by @Krishna2323 (High confidence)
Related Issues: None found
Recommendation: ROLL FORWARD
The guard that locks the "Category" card counts all tax rates, while the tax picker it leads to hides the workspace default rate for category rules — so a workspace whose only remaining rate is the default passes the guard and lands on an empty picker. Reverting would pull a 43-file feature PR for a one-line predicate gap, and the whole flow is gated behind the
rulesRevampbeta (CONST.BETAS.RULES_REVAMP), so @situchan's "not a blocker" read is correct on the code: it is also a reasonable demote candidate for the BZ/deploy owner.Assigned: @Krishna2323 (PR author), @JS00001 and @situchan (approving reviewers) — already assigned by Melvin
Labels: No changes.
DeployBlockerCashis kept — the cause is anExpensify/AppPR, and the issue is not reproducible on production (new feature), so it is not eligible for automated removal.DeployBlockerwas never applied. Demoting this is an internal judgement call given the beta gate; flagging it rather than doing it.📋 Detailed Analysis
Evidence
ExpenseDefaultTypePage.tsx,AddTaxPage.tsx,CategoryTaxRulesUtils.tsandRuleTaxesDisabledEmptyState.tsxare all additions in that PR's diff. There is no prior version of this screen, which matches "N/A - new feature, doesn't exist in prod".hasUsableTaxRateshelper, theisLockedflag on the Category card, and theshouldHideTaxfilter in the tax picker are all introduced in the same diff — the guard and its consumer were written together and disagree with each other.Beta gating (re: "Not blocker. The feature is behind beta")
Confirmed in code. The beta is
rulesRevamp—CONST.BETAS.RULES_REVAMP: 'rulesRevamp'— and every screen on the reported path is blocked without it:PolicyRulesPageRevamp.tsx#L374→shouldBeBlocked={!isRulesRevampEnabled}RulesNewPage.tsx#L123(the "Apply expense defaults" entry is #L90-L98)ExpenseDefaultTypePage.tsx#L44and #L96So a user without the beta cannot reach step 5 of the repro at all. That supports demoting rather than reverting.
Verification
Affected files, all modified/created by #99420:
src/libs/CategoryTaxRulesUtils.ts#L31-L34hasUsableTaxRates— the guard that is wrongsrc/pages/workspace/rules/MerchantRules/ExpenseDefaultTypePage.tsx#L52, #L84-L86isLockedon the Category cardsrc/pages/workspace/rules/MerchantRules/AddTaxPage.tsx#L32-L43, #L66-L79src/pages/workspace/rules/MerchantRules/MerchantRulePageBase.tsx#L532-L540Root Cause
The availability guard and the option list it gates are computed from two different sets of tax rates.
The guard counts every entry in
policy.taxRates.taxes:The picker, for a category rule, deliberately removes the workspace default rate (writing it would delete the rule rather than save it), plus disabled and pending-delete rates:
After step 3 of the repro (delete all non-default taxes),
policy.taxRates.taxesstill holds the workspace default rate, sohasUsableTaxRatesreturnstrue→isLocked: !areTaxesEnabledisfalse→ the Category card is unlocked andshowTurnOnTaxesFirstExplainernever fires. Tapping through then reachesAddTaxPage, whereareTaxesEnabledis alsotrueso the picker branch renders — buttaxItemsis empty because the only remaining rate is the default oneshouldHideTaxstrips. Hence "No results found" instead of theRuleTaxesDisabledEmptyStatethat was written for exactly this situation.The same gap exists for a workspace whose only rates are all
isDisabled, or all pending deletion.Suggested fix (roll forward): make
hasUsableTaxRatescount only rates a category rule can actually select — excludeisDisabled,pendingAction === DELETE, and (for the category flow)taxRates.defaultExternalID— and haveExpenseDefaultTypePage,AddTaxPageandMerchantRulePageBaseall read that one predicate. The codebase already has this shape for categories and tags inhasEnabledOptions, which does filter onenabledandpendingAction.💡 Suggested AI code review rule
This bug looks like a recurring, mechanically detectable pattern, so it may be worth a coding-standards rule so the AI reviewer catches the next one. Proposed for
Expensify/App:CONSISTENCY-19— Gate an entry point on the same filtered set its destination renderspolicy.taxRates.taxes,policyCategories,policyTags, cards, …), it must be derived from the same predicate the destination uses to build its list — not a rawObject.keys(...).length > 0. Extract one sharedhasUsableX()helper and call it from both sides.isDisabled,pendingAction === DELETE, the workspace default rate), so the guard reports "available" and the user is routed to a picker rendering "No results found" with no way forward. That is exactly this deploy blocker.rg 'Object\.(keys|values)\([^)]*(taxRates\?\.taxes|policyCategories|policyTags|Categories|Tags)[^)]*\)(\s*\?\?\s*\{\})?\)?\.length'and flag any hit used as a boolean gate whose corresponding list builder filters onisDisabled,enabled,pendingAction, ordefaultExternalID.CategoryTaxRulesUtils.ts#L31-L34vs. its consumerAddTaxPage.tsx#L33-L43hasEnabledOptionsThe full rule file, with the ❌/✅ code inline in
App's coding-standards format, would go inExpensify/Appitself. If it's worth adding, a maintainer can open it there as a draft PR.blimpich commentedon Sep 7, 2026
Demoting based of this comment
Krishna2323 commentedon Sep 8, 2026
@JS00001 @JmillsExpensify, what's the expected behavior here? If we lock category creation when only a default tax exists, what should we prompt the user with when we show the modal? We can't use the same "Category rules set a default tax rate. Turn on taxes in your workspace settings to use them." prompt since taxes are already enabled.
JS00001 commentedon Sep 8, 2026
I think we'd use a similar one, saying they need to create a non default rate, or something similar?
JmillsExpensify commentedon Sep 9, 2026
I'm fine going with Krishna's suggestion above.
JS00001 commentedon Sep 23, 2026
This is merged and is a part of the rules revamp