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 - Expense preview shows "Cash" label for time expense in Preview matches list #84196
Version Number: 9.3.31-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:#83005 Email or phone of affected tester (no customers):isodjnosidjiojiojiso@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:
Enable Time and Rules in workspace settings > More features.
Go to staging.new.expensify.com
Go to workspace chat.
Create a time expense.
Open the expense.
Click Merchant.
Enter Apple and save it.
Go to workspace settings > Rules.
Click Add merchant rule.
Click the first Merchant field, enter Apple and click Save.
Click Preview matches.
Expected Result:
Expense preview will show "Time" label for time expense.
Actual Result:
Expense preview shows "Time" label for time expense in Preview matches list.
This issue also happens with distance and per diem expense.
👋 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: Backend bug Causing PR: #83005 - "Enable merchant rules v3" by @luacmartins (High confidence) Related Issues: None
Recommendation: ROLL FORWARD
This requires a backend fix. The frontend code is working correctly - the issue is that the backend API GET_TRANSACTIONS_MATCHING_CODING_RULE does not return complete transaction data with the fields necessary to determine transaction types (time, distance, per diem). Rolling forward with a backend fix is more appropriate than reverting the frontend PR.
Labels: Removing DeployBlockerCash label as this requires a backend fix, not an App repository fix.
📋 Detailed Analysis
Evidence
PR #83005 simply removed the production gate for merchant rules (removed the if (isProduction) return null check), enabling the merchant rules feature including the "Preview matches" functionality.
When users now click "Preview matches" in the merchant rules flow, the PreviewMatchesPage component calls getTransactionsMatchingCodingRule() which makes a backend API call to GET_TRANSACTIONS_MATCHING_CODING_RULE. This API returns matching transactions, but appears to not include complete transaction data.
Verification
I examined the files involved:
src/pages/workspace/rules/MerchantRules/PreviewMatchesPage.tsx - Displays transactions in preview
src/components/TransactionItemRow/DataCells/TypeCell.tsx - Renders the type label
Falls back to checking card fields and defaults to "Cash"
Root Cause
The backend API GET_TRANSACTIONS_MATCHING_CODING_RULE is not returning the comment field (or not returning it with complete data) in the transaction objects. This causes the frontend to incorrectly classify time/distance/per diem transactions as "Cash" transactions because it cannot determine the actual transaction type.
This is a backend bug - the API needs to be updated to return complete transaction objects including the comment field with type and customUnit data.
Please re-state the problem that we are trying to solve in this issue.
When using "Preview matches" in workspace Rules for merchant rules, time expenses (and also distance and per diem expenses) incorrectly display the "Cash" type label instead of their correct type labels ("Time", "Distance", "Per diem").
What is the root cause of that problem?
The expense type label is determined by getTransactionType() in src/libs/TransactionUtils/index.ts:337-364. This function checks transaction.comment.type and transaction.comment.customUnit.name to identify time, distance, and per diem transactions:
Per diem: comment.type === 'customUnit' && comment.customUnit.name === 'Per Diem International'
If these fields are missing or undefined, all checks fail and the function falls through to return CASH as the default.
The PreviewMatchesPage (src/pages/workspace/rules/MerchantRules/PreviewMatchesPage.tsx) fetches matching transactions via getTransactionsMatchingCodingRule(), which calls the GetTransactionsMatchingCodingRule backend API. The response is stored directly in the CODING_RULE_MATCHING_TRANSACTION Onyx collection with no client-side field transformation (see src/libs/actions/Policy/Rules.ts:229-253). Each transaction is then rendered via UnreportedExpenseListItem → TransactionItemRow → TypeCell, where TypeCell calls getTransactionType().
The GetTransactionsMatchingCodingRule backend endpoint does not include the comment.type and comment.customUnit fields in the returned transaction objects. Because these fields are undefined, getTransactionType() defaults every transaction to "Cash" regardless of its actual type.
What changes do you think we should make in order to solve the problem?
The backend GetTransactionsMatchingCodingRule endpoint should include the comment field (specifically comment.type and comment.customUnit) in the transaction objects it returns. This will allow getTransactionType() to correctly identify time, distance, and per diem transactions and display the appropriate type label.
What alternative solutions did you explore? (Optional)
A frontend-only workaround could cross-reference matching transaction IDs with the main ONYXKEYS.COLLECTION.TRANSACTION collection (which should have complete data). However, this would only work for the current user's own transactions — matching transactions from other workspace members would not be in the current user's Transaction collection, so this approach would be incomplete.
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 Mar 4, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #83005
melvin-bot commentedon Mar 4, 2026
💬 A slack conversation has been started in #expensify-open-source
melvin-bot commentedon Mar 4, 2026
Triggered auto assignment to @bfitzexpensify (
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 Mar 4, 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 Mar 4, 2026
🔍 Investigation Summary
Classification: Backend bug
Causing PR: #83005 - "Enable merchant rules v3" by @luacmartins (High confidence)
Related Issues: None
Recommendation: ROLL FORWARD
This requires a backend fix. The frontend code is working correctly - the issue is that the backend API
GET_TRANSACTIONS_MATCHING_CODING_RULEdoes not return complete transaction data with the fields necessary to determine transaction types (time, distance, per diem). Rolling forward with a backend fix is more appropriate than reverting the frontend PR.Labels: Removing
DeployBlockerCashlabel as this requires a backend fix, not an App repository fix.📋 Detailed Analysis
Evidence
PR #83005 simply removed the production gate for merchant rules (removed the
if (isProduction) return nullcheck), enabling the merchant rules feature including the "Preview matches" functionality.When users now click "Preview matches" in the merchant rules flow, the
PreviewMatchesPagecomponent callsgetTransactionsMatchingCodingRule()which makes a backend API call toGET_TRANSACTIONS_MATCHING_CODING_RULE. This API returns matching transactions, but appears to not include complete transaction data.Verification
I examined the files involved:
src/pages/workspace/rules/MerchantRules/PreviewMatchesPage.tsx- Displays transactions in previewsrc/components/TransactionItemRow/DataCells/TypeCell.tsx- Renders the type labelsrc/libs/TransactionUtils/index.ts- ContainsgetTransactionType()logicThe
getTransactionType()function correctly checks:isTimeRequest()- checks iftransaction.comment.type === CONST.TRANSACTION.TYPE.TIMEisDistanceRequest()- checks iftransaction.comment.type === CONST.TRANSACTION.TYPE.CUSTOM_UNIT && transaction.comment.customUnit.name === CONST.CUSTOM_UNITS.NAME_DISTANCEisPerDiemRequest()- checks iftransaction.comment.type === CONST.TRANSACTION.TYPE.CUSTOM_UNIT && transaction.comment.customUnit.name === CONST.CUSTOM_UNITS.NAME_PER_DIEM_INTERNATIONALRoot Cause
The backend API
GET_TRANSACTIONS_MATCHING_CODING_RULEis not returning thecommentfield (or not returning it with complete data) in the transaction objects. This causes the frontend to incorrectly classify time/distance/per diem transactions as "Cash" transactions because it cannot determine the actual transaction type.This is a backend bug - the API needs to be updated to return complete transaction objects including the
commentfield withtypeandcustomUnitdata.MelvinBot commentedon Mar 4, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When using "Preview matches" in workspace Rules for merchant rules, time expenses (and also distance and per diem expenses) incorrectly display the "Cash" type label instead of their correct type labels ("Time", "Distance", "Per diem").
What is the root cause of that problem?
The expense type label is determined by
getTransactionType()insrc/libs/TransactionUtils/index.ts:337-364. This function checkstransaction.comment.typeandtransaction.comment.customUnit.nameto identify time, distance, and per diem transactions:comment.type === 'time'comment.type === 'customUnit'&&comment.customUnit.name === 'Distance'comment.type === 'customUnit'&&comment.customUnit.name === 'Per Diem International'If these fields are missing or undefined, all checks fail and the function falls through to return
CASHas the default.The PreviewMatchesPage (
src/pages/workspace/rules/MerchantRules/PreviewMatchesPage.tsx) fetches matching transactions viagetTransactionsMatchingCodingRule(), which calls theGetTransactionsMatchingCodingRulebackend API. The response is stored directly in theCODING_RULE_MATCHING_TRANSACTIONOnyx collection with no client-side field transformation (seesrc/libs/actions/Policy/Rules.ts:229-253). Each transaction is then rendered viaUnreportedExpenseListItem→TransactionItemRow→TypeCell, whereTypeCellcallsgetTransactionType().The
GetTransactionsMatchingCodingRulebackend endpoint does not include thecomment.typeandcomment.customUnitfields in the returned transaction objects. Because these fields are undefined,getTransactionType()defaults every transaction to "Cash" regardless of its actual type.What changes do you think we should make in order to solve the problem?
The backend
GetTransactionsMatchingCodingRuleendpoint should include thecommentfield (specificallycomment.typeandcomment.customUnit) in the transaction objects it returns. This will allowgetTransactionType()to correctly identify time, distance, and per diem transactions and display the appropriate type label.What alternative solutions did you explore? (Optional)
A frontend-only workaround could cross-reference matching transaction IDs with the main
ONYXKEYS.COLLECTION.TRANSACTIONcollection (which should have complete data). However, this would only work for the current user's own transactions — matching transactions from other workspace members would not be in the current user's Transaction collection, so this approach would be incomplete.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.JS00001 commentedon Mar 5, 2026
This is merged
luacmartins commentedon Mar 6, 2026
This is fixed