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
[$250] Cannot delete unreported expense in bulk from new dot #85484
BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributorsMonthlyKSv2Not a priorityReviewingHas a PR in review
Version Number: 9.3.37-10 Reproducible in staging?: Needs Reproduction (Unable to reproduce) Reproducible in production?: Needs Reproduction 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:@Tmjarnesk1 Slack conversation (hyperlinked to channel name): #Expensify Bugs
Action Performed:
Navigate to Reports > Expenses
Apply filters for unreported expense
Select more than 1 expense,
Cilck on the bulk select dropdown and observe the options
Expected Result:
Option to delete the expense displayed
Actual Result:
No option to delete the expense, but displayed in Classic for same expenses
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
Please re-state the problem that we are trying to solve in this issue.
When selecting multiple unreported expenses in Reports > Expenses and opening the bulk action dropdown, the "Delete" option is not shown. This option is available in Classic for the same expenses.
What is the root cause of that problem?
The root cause is in canDeleteMoneyRequestReport at App/src/libs/ReportUtils.ts:3102-3117. This function correctly identifies unreported transactions (isUnreported = true when transaction.reportID === '0'), but the ownership check always fails for them.
For unreported expenses (reportID = '0'), it looks up report_actions_0 in search results — which doesn't exist since report ID '0' is a synthetic placeholder
It calls canDeleteMoneyRequestReport(undefined, [transaction], []) with an empty report actions array
Inside canDeleteMoneyRequestReport, ownership is determined by: getIOUActionForTransactionID(reportActions, transactionID)?.actorAccountID === currentUserAccountID
With an empty array, getIOUActionForTransactionID returns undefined, so isOwner = false
The function returns isOwner && canCardTransactionBeDeleted → false
The fundamental problem: unreported transactions don't have IOU report actions (since they aren't on any report), but the ownership check requires one to determine who created the transaction. There's no fallback ownership mechanism for unreported expenses.
An existing unit test at SearchUIUtilsTest.ts:7109 passes by manually providing reportAction in mock data, which masks this real-world behavior where the search API doesn't include report actions for reportID '0'.
What changes do you think we should make in order to solve the problem?
In canDeleteMoneyRequestReport at ReportUtils.ts:3115-3116, add an alternative ownership check for unreported transactions. When isUnreported is true and no report action is available to determine ownership, fall back to checking the transaction's ownerAccountID (which is set from the report action's actorAccountID or the report's ownerAccountID during search result processing) against the current user's account ID. This ensures unreported expenses created by the current user can be deleted.
The same pattern should be mirrored in shouldShowDeleteOption in SearchUIUtils.ts where the parentReportAction fallback is constructed — ensuring that for unreported transactions, ownership can be established via selectedTransactions[id].ownerAccountID when no report action is available.
What alternative solutions did you explore? (Optional)
Backend fix: Have the search API include synthetic IOU report actions for unreported transactions keyed under report_actions_0. This was rejected as it would require backend changes for what is fundamentally a frontend ownership-check limitation, and adding fake report actions could have unintended side effects elsewhere.
Skip ownership check entirely for unreported expenses: Since unreported expenses are always owned by the current user (they haven't been submitted to anyone else), we could skip the isOwner check when isUnreported is true. However, this is less safe than explicitly verifying ownership via an alternative field.
Detailed Investigation
Key Code Locations
shouldShowDeleteOption — SearchUIUtils.ts:4608-4651: Gates whether the delete bulk action appears. For expense type queries, iterates selected transactions and calls canDeleteMoneyRequestReport.
canDeleteMoneyRequestReport — ReportUtils.ts:3102-3117: The ownership check (isOwner) relies on getIOUActionForTransactionID finding a matching IOU report action. For unreported expenses, no such action exists.
getIOUActionForTransactionID — ReportActionsUtils.ts:2523-2528: Searches an array of report actions for one matching the transaction ID. Returns undefined when called with an empty array.
useSearchBulkActions — useSearchBulkActions.ts:1130-1140: The hook that builds bulk action options. Delete is only added when shouldShowDeleteOption returns true.
createReportActionsLookupMaps — SearchUIUtils.ts:1579-1617: Builds the moneyRequestReportActionsByTransactionID map from search data. For unreported transactions, this map has no entries since no report_actions_0 key exists.
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 [-]Cannot delete unreported expense in bulk from new dot[/-][+][$250] Cannot delete unreported expense in bulk from new dot[/+]on Mar 16, 2026
Please re-state the problem that we are trying to solve in this issue.
When selecting multiple unreported expenses in Reports > Expenses and using the bulk action dropdown, the "Delete" option is missing. This option is available in Classic for the same expenses.
What is the root cause of that problem?
The bug is in canDeleteMoneyRequestReport at ReportUtils.ts:3104-3119. The ownership check at line 3107 always fails for unreported transactions because no IOU report actions exist for reportID = '0'.
At line 3115-3118, isUnreported = true (since transaction.reportID === '0'), and the function returns isOwner && canCardTransactionBeDeleted → false && true → false
Since shouldShowDeleteOption requires every() selected transaction to pass, a single unreported expense hides the Delete button for the entire selection
The fundamental issue: the ownership check relies exclusively on IOU report actions, which do not exist for unreported expenses (they have no parent report or report actions by definition).
What changes do you think we should make in order to solve the problem?
Why removing the isOwner guard is safe for unreported expenses:
Unreported expenses (reportID = '0') are personal — they have not been submitted to any report or approver
The search API only returns a user's own unreported expenses; there is no admin or delegate path that surfaces another user's unreported transactions
The canCardTransactionBeDeleted check already guards against deleting corporate card transactions with the wrong liability type, which is the meaningful safety check for unreported expenses
The existing ownership check via IOU report actions is designed for reported expenses where admin/delegate access makes ownership verification necessary — this invariant does not apply to unreported expenses
What alternative solutions did you explore? (Optional)
Add ownerAccountID fallback from Transaction type: Not viable — the Transaction type (src/types/onyx/Transaction.ts) does not have an ownerAccountID field. The SelectedTransactionInfo.ownerAccountID is populated from item.reportAction?.actorAccountID (Search/index.tsx:144, 773), which is undefined for unreported transactions (since reportAction itself is undefined). So any fallback to transaction.ownerAccountID would also resolve to undefined.
Construct synthetic report action in shouldShowDeleteOption: Creating a fake IOU action with actorAccountID = currentUserAccountID to pass to canDeleteMoneyRequestReport would work mechanically, but introduces a code smell — manufacturing test data to satisfy an ownership check that should not apply in the first place.
Pass ownerAccountID as additional parameter: Modifying canDeleteMoneyRequestReport's signature to accept a fallback ownerAccountID adds unnecessary complexity to a function used across many call sites, when the simpler approach of recognizing that unreported expenses are self-owned is both correct and complete.
📣 @shengxinzhe! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
This issue has not been updated in over 15 days. @truph01 eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributorsMonthlyKSv2Not a priorityReviewingHas a PR in review
Activity
MelvinBot commentedon Mar 16, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When selecting multiple unreported expenses in Reports > Expenses and opening the bulk action dropdown, the "Delete" option is not shown. This option is available in Classic for the same expenses.
What is the root cause of that problem?
The root cause is in
canDeleteMoneyRequestReportatApp/src/libs/ReportUtils.ts:3102-3117. This function correctly identifies unreported transactions (isUnreported = truewhentransaction.reportID === '0'), but the ownership check always fails for them.Here's the logic flow:
shouldShowDeleteOptioninSearchUIUtils.ts:4608-4651is called for each selected transactionreportID = '0'), it looks upreport_actions_0in search results — which doesn't exist since report ID'0'is a synthetic placeholdercanDeleteMoneyRequestReport(undefined, [transaction], [])with an empty report actions arraycanDeleteMoneyRequestReport, ownership is determined by:getIOUActionForTransactionID(reportActions, transactionID)?.actorAccountID === currentUserAccountIDgetIOUActionForTransactionIDreturnsundefined, soisOwner = falseisOwner && canCardTransactionBeDeleted→falseThe fundamental problem: unreported transactions don't have IOU report actions (since they aren't on any report), but the ownership check requires one to determine who created the transaction. There's no fallback ownership mechanism for unreported expenses.
An existing unit test at
SearchUIUtilsTest.ts:7109passes by manually providingreportActionin mock data, which masks this real-world behavior where the search API doesn't include report actions for reportID'0'.What changes do you think we should make in order to solve the problem?
In
canDeleteMoneyRequestReportatReportUtils.ts:3115-3116, add an alternative ownership check for unreported transactions. WhenisUnreportedis true and no report action is available to determine ownership, fall back to checking the transaction'sownerAccountID(which is set from the report action'sactorAccountIDor the report'sownerAccountIDduring search result processing) against the current user's account ID. This ensures unreported expenses created by the current user can be deleted.The same pattern should be mirrored in
shouldShowDeleteOptioninSearchUIUtils.tswhere theparentReportActionfallback is constructed — ensuring that for unreported transactions, ownership can be established viaselectedTransactions[id].ownerAccountIDwhen no report action is available.What alternative solutions did you explore? (Optional)
Backend fix: Have the search API include synthetic IOU report actions for unreported transactions keyed under
report_actions_0. This was rejected as it would require backend changes for what is fundamentally a frontend ownership-check limitation, and adding fake report actions could have unintended side effects elsewhere.Skip ownership check entirely for unreported expenses: Since unreported expenses are always owned by the current user (they haven't been submitted to anyone else), we could skip the
isOwnercheck whenisUnreportedis true. However, this is less safe than explicitly verifying ownership via an alternative field.Detailed Investigation
Key Code Locations
shouldShowDeleteOption—SearchUIUtils.ts:4608-4651: Gates whether the delete bulk action appears. For expense type queries, iterates selected transactions and callscanDeleteMoneyRequestReport.canDeleteMoneyRequestReport—ReportUtils.ts:3102-3117: The ownership check (isOwner) relies ongetIOUActionForTransactionIDfinding a matching IOU report action. For unreported expenses, no such action exists.getIOUActionForTransactionID—ReportActionsUtils.ts:2523-2528: Searches an array of report actions for one matching the transaction ID. Returnsundefinedwhen called with an empty array.useSearchBulkActions—useSearchBulkActions.ts:1130-1140: The hook that builds bulk action options. Delete is only added whenshouldShowDeleteOptionreturns true.createReportActionsLookupMaps—SearchUIUtils.ts:1579-1617: Builds themoneyRequestReportActionsByTransactionIDmap from search data. For unreported transactions, this map has no entries since noreport_actions_0key exists.Evidence Chain
Search API response →
createReportActionsLookupMaps(no entries for reportID '0') →TransactionListItemType.reportAction = undefined→selectedTransactions[id].reportAction = undefined→shouldShowDeleteOptionpasses empty array tocanDeleteMoneyRequestReport→getIOUActionForTransactionID([])returnsundefined→isOwner = false→canDeleteMoneyRequestReportreturnsfalse→ delete option hiddenNext 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 Mar 16, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @truph01 (
External)melvin-bot commentedon Mar 16, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022033684018846889884
[-]Cannot delete unreported expense in bulk from new dot[/-][+][$250] Cannot delete unreported expense in bulk from new dot[/+]shengxinzhe commentedon Mar 17, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When selecting multiple unreported expenses in Reports > Expenses and using the bulk action dropdown, the "Delete" option is missing. This option is available in Classic for the same expenses.
What is the root cause of that problem?
The bug is in
canDeleteMoneyRequestReportatReportUtils.ts:3104-3119. The ownership check at line 3107 always fails for unreported transactions because no IOU report actions exist forreportID = '0'.Here is the exact failure chain:
shouldShowDeleteOptioninSearchUIUtils.ts:4665-4678iterates each selected transactionparentReportID = transaction.reportIDis'0'(theUNREPORTED_REPORT_IDconstant)currentSearchResults?.["report_actions_0"]isundefined— the search API has no report actions for the synthetic report ID'0'parentReportActionresolves toundefined, socanDeleteMoneyRequestReportreceives an empty array[]forreportActionscanDeleteMoneyRequestReportat line 3107:getIOUActionForTransactionID([])returnsundefined, soisOwner = (undefined === currentUserAccountID)→falseisUnreported = true(sincetransaction.reportID === '0'), and the function returnsisOwner && canCardTransactionBeDeleted→false && true→falseshouldShowDeleteOptionrequiresevery()selected transaction to pass, a single unreported expense hides the Delete button for the entire selectionThe fundamental issue: the ownership check relies exclusively on IOU report actions, which do not exist for unreported expenses (they have no parent report or report actions by definition).
What changes do you think we should make in order to solve the problem?
Single-line fix in
canDeleteMoneyRequestReportatReportUtils.ts:3117-3118.Change:
To:
Why removing the
isOwnerguard is safe for unreported expenses:reportID = '0') are personal — they have not been submitted to any report or approvercanCardTransactionBeDeletedcheck already guards against deleting corporate card transactions with the wrong liability type, which is the meaningful safety check for unreported expensesWhat alternative solutions did you explore? (Optional)
Add
ownerAccountIDfallback from Transaction type: Not viable — theTransactiontype (src/types/onyx/Transaction.ts) does not have anownerAccountIDfield. TheSelectedTransactionInfo.ownerAccountIDis populated fromitem.reportAction?.actorAccountID(Search/index.tsx:144,773), which isundefinedfor unreported transactions (sincereportActionitself isundefined). So any fallback totransaction.ownerAccountIDwould also resolve toundefined.Construct synthetic report action in
shouldShowDeleteOption: Creating a fake IOU action withactorAccountID = currentUserAccountIDto pass tocanDeleteMoneyRequestReportwould work mechanically, but introduces a code smell — manufacturing test data to satisfy an ownership check that should not apply in the first place.Pass
ownerAccountIDas additional parameter: ModifyingcanDeleteMoneyRequestReport's signature to accept a fallbackownerAccountIDadds unnecessary complexity to a function used across many call sites, when the simpler approach of recognizing that unreported expenses are self-owned is both correct and complete.melvin-bot commentedon Mar 17, 2026
📣 @shengxinzhe! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
shengxinzhe commentedon Mar 17, 2026
Contributor details
Your Expensify account email: shengyu_0830@163.com
Upwork Profile Link: https://www.upwork.com/freelancers/~0173a64078113c2de8
melvin-bot commentedon Mar 17, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
fix: allow bulk delete of unreported expenses (Expensify#85484)
30 remaining items
melvin-bot commentedon Apr 15, 2026
@truph01 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
melvin-bot commentedon Apr 17, 2026
@truph01 Eep! 4 days overdue now. Issues have feelings too...
melvin-bot commentedon Apr 21, 2026
@truph01 Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!
melvin-bot commentedon Apr 23, 2026
@truph01 10 days overdue. Is anyone even seeing these? Hello?
melvin-bot commentedon Apr 28, 2026
This issue has not been updated in over 14 days. @truph01 eroding to Weekly issue.
melvin-bot commentedon May 21, 2026
This issue has not been updated in over 15 days. @truph01 eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
melvin-bot commentedon Jun 1, 2026
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.
melvin-bot commentedon Jul 20, 2026
@truph01, this Monthly task hasn't been acted upon in 6 weeks; closing.
If you disagree, feel encouraged to reopen it -- but pick your least important issue to close instead.