Repository navigation
Description
Summary
Admins at REDACTED (and likely other domains) can no longer delete imported company card (SVB feed) expenses, even though their feed's Liability Type is set to Personal. This is a regression — the behavior worked previously.
Affected accounts: REDACTED — both domain admins on REDACTED, SVB card feed.
Root Cause Analysis
The gate today (src/libs/ReportUtils.ts)
function canDeleteCardTransactionByLiabilityType(transaction): boolean {
const isCardTransaction = isCardTransactionTransactionUtils(transaction);
if (!isCardTransaction) {
return true; // non-card → always deletable
}
return transaction?.comment?.liabilityType === CONST.TRANSACTION.LIABILITY_TYPE.ALLOW;
}This returns true only when liabilityType === "allow". If liabilityType is "restrict" (corporate) or empty/undefined, Delete is hidden.
The regression: PR #69630 (merged 2025-09-17)
#69630 — "Hide delete button for unreported card expense imported with deleting disabled" broadened the restriction in a breaking way:
Before #69630, the expense-report path used a narrow block:
isSingleTransaction && isCardTransaction(t) && t.comment.liabilityType === LIABILITY_TYPE.RESTRICT→ "block deletion only if liabilityType is explicitly RESTRICT"
After #69630, it uses the general gate:
!canDeleteCardTransactionByLiabilityType(t)→ "allow deletion only if liabilityType is explicitly ALLOW"
Two consequences:
- Semantic flip: Any transaction with an empty/undefined
liabilityTypeflipped from deletable → not deletable. - Removed the
isSingleTransactionguard, so multi-transaction expense reports are now gated too. Also extended the gate to unreported and track-expense card transactions.
Why REDACTED is affected
Log investigation over the last 90 days (back to ~2026-03-18) shows:
- Zero
Domain_SetCompanyCardSettingswrites forREDACTED— the feed's liability type was never changed. - Zero
POLICYCHANGELOG_UPDATE_CARD_FEED_LIABILITYentries for the domain.
The feed setting didn't move. The code reading it got stricter. If REDACTED'S SVB-imported transactions carry an empty/missing comment.liabilityType (rather than "allow"), post-#69630 the Delete button is hidden even though the admin's feed is configured as Personal liability.
Hypothesis / Next Step
The backend may not be stamping liabilityType: "allow" on SVB/upload-feed imported transactions when the feed is set to Personal liability. If that value is missing at import time, the App-side gate (post-#69630) treats it as non-deletable.
Recommended investigation:
- Pull
comment.liabilityTypeon a few of REDACTED'S SVB-imported transactions (Onyx/transaction logs) to confirm the value is empty/undefined rather than"allow". - If confirmed missing: fix the backend to stamp
liabilityType: "allow"on imported transactions for Personal-liability feeds, and/or updatecanDeleteCardTransactionByLiabilityTypeto treat a missingliabilityTypeasALLOWwhen the feed is configured as Personal.
Activity
lydiabarclay commentedon Jun 5, 2026
I asked Melv to make me a GH to investigate a customer issue, and they made it in the App repo and included customer info 😅 I have since redacted the info, and I'm going to close this.
MelvinBot commentedon Jun 5, 2026
Proposal
What is the root cause of that problem?
A breaking semantic flip in PR #69630 (merged 2025-09-17). It replaced a deny-list ("block deletion only when the card's liability is explicitly corporate") with an allow-list ("allow deletion only when liability is explicitly personal").
The gate is
canDeleteCardTransactionByLiabilityType:Because
LIABILITY_TYPE.ALLOWis the string'personal'(CONST), the Delete button now shows only when the transaction'scomment.liabilityTypeis exactly'personal'. Any card transaction whoseliabilityTypeis empty/undefined flipped from deletable → not deletable, regardless of how the feed is configured.comment.liabilityTypeis a backend-stamped field — the App only ever reads it; nothing in App writes it onto a transaction. So if SVB-imported transactions arrive withoutliabilityTypestamped, the post-#69630 allow-list hides Delete even though the feed's liability is Personal.Code evidence — exactly what #69630 changed
Before #69630 the expense-report path blocked only on explicit corporate liability:
After #69630 the same path uses the new allow-list gate (ReportUtils.ts:3058-3061):
The check was additionally extended to the unreported and track-expense card paths. #69630 implemented the goal of #66724 ("hide Delete for corporate-liability card expenses"), but an allow-list was stricter than that goal required and caught the empty/undefined case as collateral.
The helper is the single source of truth for four call sites —
canDeleteMoneyRequestReport,canDeleteReportAction,DynamicReportDetailsPage, anduseSelectedTransactionsActions— so all four inherited the flip.What changes do you think we should make in order to solve the problem?
Restore the original deny-list semantics in the one gate so a card transaction is deletable unless it is explicitly corporate-liability:
This still satisfies #66724 (corporate-liability feeds keep Delete hidden) while restoring deletion for Personal and empty/undefined
liabilityType, fixing the regression for every affected user — not just one domain. It's a single-line change inherited by all four call sites.What alternative solutions did you explore? (Optional)
liabilityType: 'personal'on transactions imported into Personal-liability feeds. This is the correct data fix but lives inAuth/Web-Expensify, not App, so a contributor cannot make it here.liabilityType, the App-side change above fully resolves it. If they instead store'corporate'despite a Personal feed, that is a backend stamping bug and the App change won't help. Next verification step: readcomment.liabilityTypeon a sample of the affected SVB transactions. The existing investigation already confirmed the feed setting never changed (noDomain_SetCompanyCardSettings/ liability-changelog writes in 90 days), so a stale/missing per-transaction stamp is the most likely culprit.Confidence & related
Confidence: Medium-High. The regression mechanism and its source PR are confirmed in code. What's unconfirmed is the exact stored
liabilityTypeon the affected transactions, which determines whether the App-side fix alone is sufficient.Related PRs/issues: #56877 (original feature), #62434 (neutral refactor), #69630 (regression source), #66724 (the issue #69630 was solving).
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/92784)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.