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-08-25] [$250] Expense Rules Without Reimbursable/Billable in Classic Default to “No” in New Expensify #89142
Version Number: 9.3.64-13 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@twisterdotcom Slack conversation (hyperlinked to channel name): #Expensify Bugs
Action Performed:
Create an Expense Rule in Expensify Classic
Enter Merchant Test
Amend the Category option ONLY
Save the Expense Rule
Open New Expensify
View the Expense Rule
See "Reimbursable" appears to be empty
Click/Tap into it
See it is set to No
Expected Result:
Reimbursable and Billable options should not be set at all
Actual Result:
Both are set in ND and both affect matching expenses accordingly.
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
The frontend display logic correctly distinguishes between "not set" (undefined) and "explicitly set to No" ('false'). However, the backend serializes reimbursable and billable as the string 'false' for rules created in Classic even when the user never touched those fields — instead of omitting them entirely.
In RulePageBase.tsx:207, the display check is form?.reimbursable ? translate(...) : ''. Since the string 'false' is truthy in JavaScript, any rule where the backend sends reimbursable: 'false' (instead of omitting it) will display "No" rather than being empty.
The same issue exists in ExpenseRuleUtils.ts:40-54 where if (rule.billable) and if (rule.reimbursable) are truthy for the string 'false', causing the rule summary to incorrectly include reimbursable/billable changes.
What changes do you think we should make in order to solve the problem?
The fix should be applied on the frontend since we can't easily change backend NVP serialization behavior for Classic-created rules. Both locations need to explicitly check for undefined instead of relying on truthiness:
In RulePageBase.tsx:207-213: Change the display condition from form?.reimbursable ? ... to form?.reimbursable !== undefined ? ... (same for billable).
In ExpenseRuleUtils.ts:40,53: Change if (rule.billable) to if (rule.billable !== undefined) and if (rule.reimbursable) to if (rule.reimbursable !== undefined).
This mirrors the pattern already used correctly in the workspace-level MerchantRulesSection.tsx:61-66 which checks rule.reimbursable !== undefined.
What alternative solutions did you explore? (Optional)
Backend fix: Have the backend omit reimbursable/billable from the NVP when they were never set in Classic. This is the more "correct" fix but harder to change since it involves Classic NVP serialization behavior and could affect other consumers of that data.
Frontend normalization at load time: Convert 'false' to undefined when loading rules in ExpenseRulesPage.tsx. This was rejected because we can't distinguish between "user explicitly set No" and "backend defaulted to false" without backend changes — the !== undefined check is the safer, more consistent approach.
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 Rules Without Reimbursable/Billable in Classic Default to “No” in New Expensify[/-][+][$250] Expense Rules Without Reimbursable/Billable in Classic Default to “No” in New Expensify[/+]on Apr 28, 2026
Please re-state the problem that we are trying to solve in this issue.
When a personal Expense Rule is created in Expensify Classic without reimbursable or billable configured, opening that rule in New Expensify preselects No for those fields instead of leaving them unset.
What is the root cause of that problem?
The edit flow for personal Expense Rules is hydrating EXPENSE_RULE_FORM with the persisted rule object as if the stored ExpenseRule shape already matched the draft form shape.
In src/pages/settings/Rules/ExpenseRulesPage.tsx, navigateToEditRulePage() currently does:
spread expenseRule directly into setDraftRule()
then patches only comment and tax
That is unsafe for this form. ExpenseRuleForm expects normalized draft values:
billable and reimbursable: 'true' | 'false' | undefined
comment: markdown
tax: tax external ID
But persisted personal rules can arrive with Classic-style boolean values at runtime, especially false as the legacy “not configured” sentinel. After that raw boolean is written into EXPENSE_RULE_FORM, src/components/Rule/RuleBooleanBase.tsx treats any defined value in the string-backed flow as a real selection and maps boolean false to the No option when useStringValues is enabled.
That is why the field page shows No, while the parent edit page still appears blank: src/pages/settings/Rules/RulePageBase.tsx uses a truthiness check for the title, so boolean false is treated as empty there.
So the real bug is not in the selector UI itself. The real bug is that the personal rule edit flow is deserializing stored rule data into form state by spreading the persisted object instead of explicitly converting it to the form contract.
What changes do you think we should make in order to solve the problem?
Normalize persisted personal rules before writing them into EXPENSE_RULE_FORM.
In src/pages/settings/Rules/ExpenseRulesPage.tsx, replace the raw ...expenseRule spread in navigateToEditRulePage() with an explicit mapping to the draft form shape, similar to how merchant rules are initialized in src/pages/workspace/rules/MerchantRules/MerchantRulePageBase.tsx.
Convert the boolean fields with runtime-shape awareness:
preserve 'true' and 'false' if the rule already came from New Expensify
convert boolean true to 'true'
convert boolean false to undefined, because that is the Classic “unset” case causing this bug
Keep the existing comment and tax normalization in the same mapping:
comment: HTML -> markdown
tax: field_id_TAX.externalID
A clean version of the fix would be to move this conversion into a helper in src/libs/ExpenseRuleUtils.ts so the app has a dedicated “stored rule -> draft form” path, which is the inverse of extractRuleFromForm().
What alternative solutions did you explore? (Optional)
Changing src/components/Rule/RuleBooleanBase.tsx to special-case boolean false in the string-backed flow would only mask the symptom.
That would still leave invalid runtime data inside EXPENSE_RULE_FORM, and if the user saved without touching those fields we could continue persisting the wrong shape back through the personal rule flow.
The better fix is to correct the deserialization boundary when the stored rule is loaded into the personal rule draft form.
⚠️@aswin-s Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
Personal expense rules are stored in NVP_EXPENSE_RULES, but the stored data can contain legacy Classic boolean values for billable and reimbursable even though New Expensify expects string values ('true' | 'false' | undefined) for those fields.
ExpenseRulesPage.tsx copies the persisted rule directly into EXPENSE_RULE_FORM with ...expenseRule.
That means a Classic rule where reimbursable/billable were never configured can put runtime false into the draft form. Then RuleBooleanBase.tsx treats any defined value as a real selection:
Since false !== undefined, the boolean field page considers the value selected. With useStringValues, only 'true' maps to Yes, so runtime boolean false maps to No.
The same legacy boolean values can also remain in NVP_EXPENSE_RULES, so matching expenses can treat those fields as explicitly set instead of unset.
What changes do you think we should make in order to solve the problem?
Normalize legacy personal expense rule booleans at the personal expense rules data boundary. This keeps the UI and save paths working with one schema:
true -> 'true'
false -> undefined
'true' -> 'true'
'false' -> 'false'
This preserves explicit New Expensify No selections while removing Classic's legacy unset sentinel.
In ExpenseRuleUtils.ts, add reusable normalization helpers and use them before formatting rule summaries.
This makes rule-summary rendering ignore legacy boolean false and prevents it from showing as an explicit update.
In ExpenseRulesPage.tsx, normalize the NVP values before using them for list rows and edit navigation, and trigger a cleanup write when legacy booleans are detected.
This prevents legacy boolean values from being re-saved when the user edits or deletes a rule, and it cleans existing Classic-created rules so matching expenses no longer see unset fields as explicit false updates.
What alternative solutions did you explore? (Optional)
I considered changing RuleBooleanBase.tsx to treat boolean false as unset when useStringValues is enabled. That only fixes the field page display and still leaves invalid legacy values in EXPENSE_RULE_FORM and NVP_EXPENSE_RULES.
I also considered normalizing only inside navigateToEditRulePage() before setDraftRule(). That fixes opening/editing a rule, but it does not clean the stored NVP or prevent unrelated save/delete operations from preserving the legacy boolean shape.
I considered changing truthiness checks in RulePageBase.tsx and formatExpenseRuleChanges(). That targets display symptoms, but the original problem is a mixed-schema stored value, so the fix should happen before the UI and write paths consume those rules.
⚠️@emkhalid Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
For OD created rules, when billable and reimbursable are not set, the form value is an empty string "" (not undefined)
Meanwhile for ND created rules, we don't get empty string billable and reimbursable if they are not set
Then in RuleBooleanBase, the check that determines the selected item only excludes undefined, so an empty string passes the check and gets evaluated as not-'true', which causes "No" to be selected by default
What alternative solutions did you explore? (Optional)
We could normalize the empty strings to undefined upstream in setDraftRule when loading a rule into the form, so the empty string never reaches RuleBooleanBase in the first place
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Activity
MelvinBot commentedon Apr 28, 2026
Proposal
What is the root cause of that problem?
The frontend display logic correctly distinguishes between "not set" (
undefined) and "explicitly set to No" ('false'). However, the backend serializesreimbursableandbillableas the string'false'for rules created in Classic even when the user never touched those fields — instead of omitting them entirely.In
RulePageBase.tsx:207, the display check isform?.reimbursable ? translate(...) : ''. Since the string'false'is truthy in JavaScript, any rule where the backend sendsreimbursable: 'false'(instead of omitting it) will display "No" rather than being empty.The same issue exists in
ExpenseRuleUtils.ts:40-54whereif (rule.billable)andif (rule.reimbursable)are truthy for the string'false', causing the rule summary to incorrectly include reimbursable/billable changes.What changes do you think we should make in order to solve the problem?
The fix should be applied on the frontend since we can't easily change backend NVP serialization behavior for Classic-created rules. Both locations need to explicitly check for
undefinedinstead of relying on truthiness:In
RulePageBase.tsx:207-213: Change the display condition fromform?.reimbursable ? ...toform?.reimbursable !== undefined ? ...(same for billable).In
ExpenseRuleUtils.ts:40,53: Changeif (rule.billable)toif (rule.billable !== undefined)andif (rule.reimbursable)toif (rule.reimbursable !== undefined).This mirrors the pattern already used correctly in the workspace-level
MerchantRulesSection.tsx:61-66which checksrule.reimbursable !== undefined.What alternative solutions did you explore? (Optional)
reimbursable/billablefrom the NVP when they were never set in Classic. This is the more "correct" fix but harder to change since it involves Classic NVP serialization behavior and could affect other consumers of that data.'false'toundefinedwhen loading rules inExpenseRulesPage.tsx. This was rejected because we can't distinguish between "user explicitly set No" and "backend defaulted to false" without backend changes — the!== undefinedcheck is the safer, more consistent approach.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.melvin-bot commentedon Apr 28, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (
External)[-]Expense Rules Without Reimbursable/Billable in Classic Default to “No” in New Expensify[/-][+][$250] Expense Rules Without Reimbursable/Billable in Classic Default to “No” in New Expensify[/+]melvin-bot commentedon Apr 28, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022049258164943265749
aswin-s commentedon Apr 28, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a personal Expense Rule is created in Expensify Classic without reimbursable or billable configured, opening that rule in New Expensify preselects
Nofor those fields instead of leaving them unset.What is the root cause of that problem?
The edit flow for personal Expense Rules is hydrating
EXPENSE_RULE_FORMwith the persisted rule object as if the storedExpenseRuleshape already matched the draft form shape.In
src/pages/settings/Rules/ExpenseRulesPage.tsx,navigateToEditRulePage()currently does:expenseRuledirectly intosetDraftRule()commentandtaxThat is unsafe for this form.
ExpenseRuleFormexpects normalized draft values:billableandreimbursable:'true' | 'false' | undefinedcomment: markdowntax: tax external IDBut persisted personal rules can arrive with Classic-style boolean values at runtime, especially
falseas the legacy “not configured” sentinel. After that raw boolean is written intoEXPENSE_RULE_FORM,src/components/Rule/RuleBooleanBase.tsxtreats any defined value in the string-backed flow as a real selection and maps booleanfalseto theNooption whenuseStringValuesis enabled.That is why the field page shows
No, while the parent edit page still appears blank:src/pages/settings/Rules/RulePageBase.tsxuses a truthiness check for the title, so booleanfalseis treated as empty there.So the real bug is not in the selector UI itself. The real bug is that the personal rule edit flow is deserializing stored rule data into form state by spreading the persisted object instead of explicitly converting it to the form contract.
What changes do you think we should make in order to solve the problem?
Normalize persisted personal rules before writing them into
EXPENSE_RULE_FORM.In
src/pages/settings/Rules/ExpenseRulesPage.tsx, replace the raw...expenseRulespread innavigateToEditRulePage()with an explicit mapping to the draft form shape, similar to how merchant rules are initialized insrc/pages/workspace/rules/MerchantRules/MerchantRulePageBase.tsx.Convert the boolean fields with runtime-shape awareness:
'true'and'false'if the rule already came from New Expensifytrueto'true'falsetoundefined, because that is the Classic “unset” case causing this bugKeep the existing
commentandtaxnormalization in the same mapping:comment: HTML -> markdowntax:field_id_TAX.externalIDA clean version of the fix would be to move this conversion into a helper in
src/libs/ExpenseRuleUtils.tsso the app has a dedicated “stored rule -> draft form” path, which is the inverse ofextractRuleFromForm().What alternative solutions did you explore? (Optional)
Changing
src/components/Rule/RuleBooleanBase.tsxto special-case booleanfalsein the string-backed flow would only mask the symptom.That would still leave invalid runtime data inside
EXPENSE_RULE_FORM, and if the user saved without touching those fields we could continue persisting the wrong shape back through the personal rule flow.The better fix is to correct the deserialization boundary when the stored rule is loaded into the personal rule draft form.
github-actions commentedon Apr 28, 2026
emkhalid commentedon Apr 29, 2026
Proposal
What is the root cause of that problem?
Personal expense rules are stored in
NVP_EXPENSE_RULES, but the stored data can contain legacy Classic boolean values forbillableandreimbursableeven though New Expensify expects string values ('true' | 'false' | undefined) for those fields.ExpenseRulesPage.tsxcopies the persisted rule directly intoEXPENSE_RULE_FORMwith...expenseRule.App/src/pages/settings/Rules/ExpenseRulesPage.tsx
Lines 139 to 144 in 79146fd
That means a Classic rule where reimbursable/billable were never configured can put runtime
falseinto the draft form. ThenRuleBooleanBase.tsxtreats any defined value as a real selection:App/src/components/Rule/RuleBooleanBase.tsx
Lines 53 to 58 in 79146fd
Since
false !== undefined, the boolean field page considers the value selected. WithuseStringValues, only'true'maps to Yes, so runtime booleanfalsemaps to No.The same legacy boolean values can also remain in
NVP_EXPENSE_RULES, so matching expenses can treat those fields as explicitly set instead of unset.What changes do you think we should make in order to solve the problem?
Normalize legacy personal expense rule booleans at the personal expense rules data boundary. This keeps the UI and save paths working with one schema:
true->'true'false->undefined'true'->'true''false'->'false'This preserves explicit New Expensify
Noselections while removing Classic's legacy unset sentinel.In
ExpenseRuleUtils.ts, add reusable normalization helpers and use them before formatting rule summaries.App/src/libs/ExpenseRuleUtils.ts
Lines 32 to 68 in 79146fd
This makes rule-summary rendering ignore legacy boolean
falseand prevents it from showing as an explicit update.In
ExpenseRulesPage.tsx, normalize the NVP values before using them for list rows and edit navigation, and trigger a cleanup write when legacy booleans are detected.App/src/pages/settings/Rules/ExpenseRulesPage.tsx
Lines 1 to 68 in 79146fd
This fixes the edit flow because
setDraftRule({...expenseRule})now receives normalized values, so an unset Classic field stays unset.In
User.ts, normalize rules before serializing save/delete writes and add a cleanup write for existing stored legacy values.App/src/libs/actions/User.ts
Lines 1697 to 1819 in 79146fd
This prevents legacy boolean values from being re-saved when the user edits or deletes a rule, and it cleans existing Classic-created rules so matching expenses no longer see unset fields as explicit
falseupdates.What alternative solutions did you explore? (Optional)
I considered changing
RuleBooleanBase.tsxto treat booleanfalseas unset whenuseStringValuesis enabled. That only fixes the field page display and still leaves invalid legacy values inEXPENSE_RULE_FORMandNVP_EXPENSE_RULES.I also considered normalizing only inside
navigateToEditRulePage()beforesetDraftRule(). That fixes opening/editing a rule, but it does not clean the stored NVP or prevent unrelated save/delete operations from preserving the legacy boolean shape.I considered changing truthiness checks in
RulePageBase.tsxandformatExpenseRuleChanges(). That targets display symptoms, but the original problem is a mixed-schema stored value, so the fix should happen before the UI and write paths consume those rules.github-actions commentedon Apr 29, 2026
ryntgh commentedon Apr 29, 2026
Proposal
What is the root cause of that problem?
For OD created rules, when
billableandreimbursableare not set, the form value is an empty string""(not undefined)Meanwhile for ND created rules, we don't get empty string
billableandreimbursableif they are not setThen in
RuleBooleanBase, the check that determines the selected item only excludesundefined, so an empty string passes the check and gets evaluated as not-'true', which causes "No" to be selected by defaultApp/src/components/Rule/RuleBooleanBase.tsx
Lines 54 to 59 in e489519
What changes do you think we should make in order to solve the problem?
We should only consider the value as "set" when it matches one of the valid expected states ('true'/'false' for string, or a boolean for boolean mode)
App/src/components/Rule/RuleBooleanBase.tsx
Lines 54 to 59 in e489519
What alternative solutions did you explore? (Optional)
We could normalize the empty strings to
undefinedupstream insetDraftRulewhen loading a rule into the form, so the empty string never reachesRuleBooleanBasein the first placeApp/src/pages/settings/Rules/ExpenseRulesPage.tsx
Lines 140 to 144 in e489519
We can do the same for
reportandtagfield if needed75 remaining items
parasharrajat commentedon Aug 18, 2026
BugZero Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: https://github.com/Expensify/App/pull/80545/files#r3802984106
Link to the comment on the Issue: [Release 1] [Sprint] [FE] Allow admins to create a rule with case-insensitive “contains” match (MVP), and updates to coding fields: category, tag, reimbursable, billable, merchant name, tax, description/comment. #80520
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/675778
Regression Test Proposal
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-d463-a760-cd70-986be286fa74melvin-bot commentedon Aug 24, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Aug 24, 2026
Payment Summary
Resolving PRs:
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Aug 26, 2026
Payment Summary
Contributor: @twilight2294 paid $250 via Upwork
Contributor+: @parasharrajat due $250 via NewDot