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
Expensify Card - Expensify Cards with a $0 limit do not appear in New Expensify #101103
Version Number: v9.4.77-2 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from TestRail:https://github.com/Expensify/Expensify/issues/642930 Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team
Action Performed:
Preconditions:
logged in to expensifail account that being a domain admin, create a workspace and enabled the expensify card to that account
Assign an expensify card to any member
Steps:
Navigate to OD, navigate to Settings -> Domain -> Workspace -> Expensify Card -> Card list
Setting a $0 limit in Expensify Classic moves the card to STATE_DEACTIVATED (5). New Expensify's workspace card list unconditionally drops every state-5 card, so the card disappears.
The filter is isActiveCard in src/libs/CardUtils.ts:1274-1279. The includeDeactivated flag only widens the STATE_SUSPENDED branch — the fall-through return excludes STATE_DEACTIVATED no matter what the flag says.
This is a regression of #82466, not a new bug.PR #86420 (merged 2026-05-12) fixed #82466 by keeping admin-zeroed deactivated cards. PR #90540 (merged 2026-05-19, seven days later) removed that carve-out to fix #90487, where editing such a card's limit returned a 403. Its test step 7 — "Verify that deactivated cards (STATE_DEACTIVATED) do NOT appear" — asserts the exact opposite of what this issue asks for.
Evidence chain
Where the card is dropped. The page reads cards through an Onyx selector at WorkspaceExpensifyCardPage.tsx:40 → filterInactiveCardsForWorkspace → filterAllInactiveCards(list, true, true) → isActiveCard(card, true). Anything this selector removes can never render.
Nothing filters on the limit value. I checked the whole list path — no !limit, limit > 0, or falsy check on unapprovedExpenseLimit. The $0 limit only matters because it triggers the backend state change. The limit is a display field only.
Why state 5 and not 7. Suspended (7) cards are kept unconditionally on this page today. If Classic set a $0 card to 7, it would still be visible. It isn't, so it is 5. The in-repo doc comment at CardUtils.ts:1281-1286 still describes the deleted #86420 behavior and confirms the backend "transitions to deactivated/suspended".
Why CI stays green.tests/unit/CardUtilsTest.ts:3860-3862 asserts result.adminZeroedDeactivated is undefined — a fixture that is literally this issue's scenario (Expensify bank, hasCustomUnapprovedExpenseLimit: true, unapprovedExpenseLimit: 0). The broken behavior is locked in by tests.
Alternatives I ruled out. The cardholder-membership filter at WorkspaceExpensifyCardListPage.tsx:110-113 also drops cards, but it is limit-agnostic and the card here is assigned to a member. A missing-from-payload backend cause is unlikely: #90487's QA confirmed the card did appear in New Expensify while the carve-out existed, so the API does return it. PR #95272 only extracted isActiveCard and preserved #90540's semantics — not the cause.
What changes do you think we should make in order to solve the problem?
Restore #86420's narrow carve-out rather than reverting #90540 wholesale. In isActiveCard, keep a STATE_DEACTIVATED card when includeDeactivated is set and it is an Expensify Card with an admin-set $0 limit. The predicate already exists and is unused by this path: isCardWithCustomZeroLimit at CardUtils.ts:1713-1715. This satisfies this issue while keeping genuinely deactivated cards (the #90487 complaint) out of the list.
⚠️ One thing to settle before implementing.#90540's stated reason for the removal was that the server returns 403 on a limit update for a deactivated card. I could not verify that claim — it lives in Auth, which I can't read. If it still holds, simply showing the card re-opens #90487, because the limit row on DynamicWorkspaceExpensifyCardDetailsPage.tsx stays editable for deactivated cards. An internal engineer should confirm whether Auth still 403s UpdateExpensifyCardLimit for state 5. If it does, the fix needs a backend change too, or the card should surface with a reactivate affordance instead of a limit edit that is guaranteed to fail.
What alternative solutions did you explore? (Optional)
A straight revert of #90540 — rejected, because it also brings back non-zeroed deactivated cards and re-opens #90487. Gating the carve-out on isCardWithCustomZeroLimit is the narrower option that satisfies both issues.
I did not attempt a live reproduction: the flow needs a Classic domain admin with an issued Expensify Card and a verified settlement account, which the test account doesn't have.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/101103) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Please re-state the problem that we are trying to solve in this issue.
Expensify Cards (physical or virtual) that have their Smart Limit set to $0 via Expensify Classic do not appear in the New Expensify workspace card management view.
What is the root cause of that problem?
This is a pure frontend logic flaw, not a backend limitation.
When an admin sets a card's limit to $0, the backend transitions the card state to STATE_DEACTIVATED (5). The WorkspaceExpensifyCardPage relies on the Onyx selector filterInactiveCardsForWorkspace to get the list of cards.
If we look at the JSDoc comment for filterAllInactiveCards in src/libs/CardUtils.ts, the original developer's intent is explicitly documented:
"When includeDeactivated is true (workspace card management views), admin-zeroed Expensify Cards are also kept - these are cards an admin set to a $0 limit, which the backend then transitions to deactivated/suspended. Admins still need to be able to find and manage them."
However, the implementation of isActiveCard() fails to honor this rule for deactivated states. It currently looks like this:
Because of the unconditional check at the end (&& card.state !== CONST.EXPENSIFY_CARD.STATE.STATE_DEACTIVATED), a $0 limit card is always filtered out, even when the workspace table passes includeDeactivated = true.
What changes do you think we should make in order to solve the problem?
We must fix isActiveCard in src/libs/CardUtils.ts so that it properly respects the includeDeactivated flag for STATE_DEACTIVATED, exactly as it already does for STATE_SUSPENDED.
This single-line structural fix aligns the code with its documented business logic. The $0 limit cards (STATE_DEACTIVATED) will now correctly render in the Workspace Card list where includeDeactivated is true, while remaining hidden in standard user views where it is false.
Alternative solutions:
None. Modifying the backend to stop sending STATE_DEACTIVATED when a limit is $0 would break the integration and state machine used by Expensify Classic. This frontend filter fix is the exact intended mechanism.
Please re-state the problem that we are trying to solve in this issue.
When a workspace admin sets an Expensify Card's Smart Limit to $0 (or sets the card limit to $0 in Expensify Classic), the backend transitions that card to STATE_DEACTIVATED (5), causing the card to disappear from the Workspace > Expensify Card management list in New Expensify so admins can no longer view or manage it.
WorkspaceExpensifyCardPage selects workspace cards via filterInactiveCardsForWorkspace (src/libs/CardUtils.ts:1591-1593), which calls filterAllInactiveCards(cardsList, true, true) -> isActiveCard(card, true).
The JSDoc directly above filterAllInactiveCards (src/libs/CardUtils.ts:1554-1558) explicitly documents the intended contract:
"When includeDeactivated is true (workspace card management views), admin-zeroed Expensify Cards are also kept — these are cards an admin set to a $0 limit, which the backend then transitions to deactivated/suspended. Admins still need to be able to find and manage them."
However, isActiveCard at lines 1546–1551 currently only checks includeDeactivated when card.state === CONST.EXPENSIFY_CARD.STATE.STATE_SUSPENDED (7):
What changes do you think we should make in order to solve the problem?
Rather than blindly keeping everySTATE_DEACTIVATED card (which would re-introduce the #90487 regression for genuinely deactivated cards that cannot be edited), we should gate the STATE_DEACTIVATED inclusion in isActiveCard on includeDeactivated && isCardWithCustomZeroLimit(card) (for Expensify Cards):
Activity
MelvinBot commentedon Sep 14, 2026
Proposal
What is the root cause of that problem?
Setting a $0 limit in Expensify Classic moves the card to
STATE_DEACTIVATED(5). New Expensify's workspace card list unconditionally drops every state-5 card, so the card disappears.The filter is
isActiveCardinsrc/libs/CardUtils.ts:1274-1279. TheincludeDeactivatedflag only widens theSTATE_SUSPENDEDbranch — the fall-through return excludesSTATE_DEACTIVATEDno matter what the flag says.This is a regression of #82466, not a new bug. PR #86420 (merged 2026-05-12) fixed #82466 by keeping admin-zeroed deactivated cards. PR #90540 (merged 2026-05-19, seven days later) removed that carve-out to fix #90487, where editing such a card's limit returned a 403. Its test step 7 — "Verify that deactivated cards (STATE_DEACTIVATED) do NOT appear" — asserts the exact opposite of what this issue asks for.
Evidence chain
Where the card is dropped. The page reads cards through an Onyx selector at
WorkspaceExpensifyCardPage.tsx:40→filterInactiveCardsForWorkspace→filterAllInactiveCards(list, true, true)→isActiveCard(card, true). Anything this selector removes can never render.Nothing filters on the limit value. I checked the whole list path — no
!limit,limit > 0, or falsy check onunapprovedExpenseLimit. The $0 limit only matters because it triggers the backend state change. The limit is a display field only.Why state 5 and not 7. Suspended (7) cards are kept unconditionally on this page today. If Classic set a $0 card to 7, it would still be visible. It isn't, so it is 5. The in-repo doc comment at
CardUtils.ts:1281-1286still describes the deleted #86420 behavior and confirms the backend "transitions to deactivated/suspended".Why CI stays green.
tests/unit/CardUtilsTest.ts:3860-3862assertsresult.adminZeroedDeactivatedisundefined— a fixture that is literally this issue's scenario (Expensify bank,hasCustomUnapprovedExpenseLimit: true,unapprovedExpenseLimit: 0). The broken behavior is locked in by tests.Alternatives I ruled out. The cardholder-membership filter at
WorkspaceExpensifyCardListPage.tsx:110-113also drops cards, but it is limit-agnostic and the card here is assigned to a member. A missing-from-payload backend cause is unlikely: #90487's QA confirmed the card did appear in New Expensify while the carve-out existed, so the API does return it. PR #95272 only extractedisActiveCardand preserved #90540's semantics — not the cause.What changes do you think we should make in order to solve the problem?
Restore #86420's narrow carve-out rather than reverting #90540 wholesale. In
isActiveCard, keep aSTATE_DEACTIVATEDcard whenincludeDeactivatedis set and it is an Expensify Card with an admin-set $0 limit. The predicate already exists and is unused by this path:isCardWithCustomZeroLimitatCardUtils.ts:1713-1715. This satisfies this issue while keeping genuinely deactivated cards (the #90487 complaint) out of the list.Also update the assertions at
CardUtilsTest.ts:3803and:3860, which currently enshrine the bug.DynamicWorkspaceExpensifyCardDetailsPage.tsxstays editable for deactivated cards. An internal engineer should confirm whether Auth still 403sUpdateExpensifyCardLimitfor state 5. If it does, the fix needs a backend change too, or the card should surface with a reactivate affordance instead of a limit edit that is guaranteed to fail.What alternative solutions did you explore? (Optional)
A straight revert of #90540 — rejected, because it also brings back non-zeroed deactivated cards and re-opens #90487. Gating the carve-out on
isCardWithCustomZeroLimitis the narrower option that satisfies both issues.Related issues
I did not attempt a live reproduction: the flow needs a Classic domain admin with an issued Expensify Card and a verified settlement account, which the test account doesn't have.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/101103)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run · no recording available
melvin-bot commentedon Sep 14, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (
External)melvin-bot commentedon Sep 14, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
Mister124x commentedon Sep 14, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Expensify Cards (physical or virtual) that have their Smart Limit set to
$0via Expensify Classic do not appear in the New Expensify workspace card management view.What is the root cause of that problem?
This is a pure frontend logic flaw, not a backend limitation.
When an admin sets a card's limit to
$0, the backend transitions the card state toSTATE_DEACTIVATED(5). TheWorkspaceExpensifyCardPagerelies on the Onyx selectorfilterInactiveCardsForWorkspaceto get the list of cards.If we look at the JSDoc comment for
filterAllInactiveCardsinsrc/libs/CardUtils.ts, the original developer's intent is explicitly documented:However, the implementation of
isActiveCard()fails to honor this rule for deactivated states. It currently looks like this:Because of the unconditional check at the end (
&& card.state !== CONST.EXPENSIFY_CARD.STATE.STATE_DEACTIVATED), a $0 limit card is always filtered out, even when the workspace table passesincludeDeactivated = true.What changes do you think we should make in order to solve the problem?
We must fix
isActiveCardinsrc/libs/CardUtils.tsso that it properly respects theincludeDeactivatedflag forSTATE_DEACTIVATED, exactly as it already does forSTATE_SUSPENDED.Change
isActiveCard(approx line 1275) to:This single-line structural fix aligns the code with its documented business logic. The $0 limit cards (
STATE_DEACTIVATED) will now correctly render in the Workspace Card list whereincludeDeactivatedistrue, while remaining hidden in standard user views where it isfalse.Alternative solutions:
None. Modifying the backend to stop sending
STATE_DEACTIVATEDwhen a limit is $0 would break the integration and state machine used by Expensify Classic. This frontend filter fix is the exact intended mechanism.fix: allow deactivated state for $0 limit cards when includeDeactivat…
Mister124x commentedon Sep 17, 2026
Verification Update
I verified this fix locally against the latest main branch:
$0inSTATE_DEACTIVATEDare retained infilterAllInactiveCardswhenincludeDeactivated: true.STATE_CLOSED) and standard inactive cards continue to be filtered out as expected.Branch and commit ready for review on fork:
Mister124x@036d173
melvin-bot commentedon Sep 17, 2026
@abdulrahuman5196 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
melvin-bot commentedon Sep 21, 2026
@abdulrahuman5196 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
melvin-bot commentedon Sep 23, 2026
@abdulrahuman5196 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!
abdulrahuman5196 commentedon Sep 24, 2026
Hi, Will check and update here once done
16 remaining items
melvin-bot commentedon Oct 22, 2026
This issue has not been updated in over 14 days. @abdulrahuman5196 eroding to Weekly issue.
melvin-bot commentedon Nov 3, 2026
@abdulrahuman5196 Eep! 4 days overdue now. Issues have feelings too...
melvin-bot commentedon Nov 3, 2026
@abdulrahuman5196 Eep! 4 days overdue now. Issues have feelings too...
melvin-bot commentedon Nov 3, 2026
@abdulrahuman5196 Huh... This is 4 days overdue. Who can take care of this?
melvin-bot commentedon Nov 4, 2026
@abdulrahuman5196 Eep! 4 days overdue now. Issues have feelings too...
melvin-bot commentedon Nov 5, 2026
@abdulrahuman5196 Still overdue 6 days?! Let's take care of this!
jeffrey-graham commentedon Nov 7, 2026
melvin-bot commentedon Nov 7, 2026
melvin-bot commentedon Nov 9, 2026
@abdulrahuman5196 10 days overdue. Is anyone even seeing these? Hello?
melvin-bot commentedon Nov 11, 2026
@abdulrahuman5196 12 days overdue now... This issue's end is nigh!
cocvn157 commentedon Nov 14, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a workspace admin sets an Expensify Card's Smart Limit to
$0(or sets the card limit to$0in Expensify Classic), the backend transitions that card toSTATE_DEACTIVATED(5), causing the card to disappear from the Workspace > Expensify Card management list in New Expensify so admins can no longer view or manage it.What is the root cause of that problem?
isActiveCardinsrc/libs/CardUtils.ts:1546-1551drops admin-zeroed$0-limit Expensify Cards:WorkspaceExpensifyCardPageselects workspace cards viafilterInactiveCardsForWorkspace(src/libs/CardUtils.ts:1591-1593), which callsfilterAllInactiveCards(cardsList, true, true)->isActiveCard(card, true).filterAllInactiveCards(src/libs/CardUtils.ts:1554-1558) explicitly documents the intended contract:isActiveCardat lines 1546–1551 currently only checksincludeDeactivatedwhencard.state === CONST.EXPENSIFY_CARD.STATE.STATE_SUSPENDED(7):isCardWithCustomZeroLimit(card)already exists insrc/libs/CardUtils.ts:2123-2125:STATE_DEACTIVATEDcheck fromisActiveCardto prevent genuinely terminated/deactivated cards (Issue [Due for payment 2026-05-28] [$250] Expensify Card - Error when try to edit the limit of the first assigned card #90487) from showing up,isActiveCardnow unconditionally rejects allSTATE_DEACTIVATED(5) cards—even whenincludeDeactivatedistrueandisCardWithCustomZeroLimit(card)istrue.What changes do you think we should make in order to solve the problem?
Rather than blindly keeping every
STATE_DEACTIVATEDcard (which would re-introduce the #90487 regression for genuinely deactivated cards that cannot be edited), we should gate theSTATE_DEACTIVATEDinclusion inisActiveCardonincludeDeactivated && isCardWithCustomZeroLimit(card)(for Expensify Cards):Update
isActiveCardinsrc/libs/CardUtils.ts:1546-1551:includeDeactivatedisfalse(personal Wallet / non-admin views),STATE_DEACTIVATEDcards remain hidden.includeDeactivatedistrue(filterInactiveCardsForWorkspace/ workspace management views), admin-zeroed Expensify Cards (hasCustomUnapprovedExpenseLimit: true, unapprovedExpenseLimit: 0) remain visible and manageable, while genuinely terminated/deactivated cards without a custom$0limit remain excluded (preserving [Due for payment 2026-05-28] [$250] Expensify Card - Error when try to edit the limit of the first assigned card #90487).Update Unit Tests in
tests/unit/CardUtilsTest.ts:adminZeroedDeactivatedtest cases intests/unit/CardUtilsTest.tsso that:filterInactiveCards(cards)(includeDeactivated = false) excludesadminZeroedDeactivated.filterInactiveCardsForWorkspace(cards)/filterAllInactiveCards(cards, true)(includeDeactivated = true) retainsadminZeroedDeactivatedwhile still excluding non-zero-limitSTATE_DEACTIVATEDcards andCLOSEDcards.What alternative solutions did you explore? (Optional)
includeDeactivatedfor allSTATE_DEACTIVATEDcards regardless ofisCardWithCustomZeroLimit(card): Rejected because PR Allow $0 as valid card limit when editing Expensify Card #90540 proved that showing genuinely deactivated cards (whereunapprovedExpenseLimitwas not zeroed by an admin) causesUpdateExpensifyCardLimitto fail with403(Issue [Due for payment 2026-05-28] [$250] Expensify Card - Error when try to edit the limit of the first assigned card #90487). Restricting theSTATE_DEACTIVATEDcarve-out toincludeDeactivated && isExpensifyCard(card) && isCardWithCustomZeroLimit(card)satisfies both [$250] Expensify Cards with a $0 limit in Expensify Classic do not appear in New Expensify #82466/Expensify Card - Expensify Cards with a $0 limit do not appear in New Expensify #101103 and [Due for payment 2026-05-28] [$250] Expensify Card - Error when try to edit the limit of the first assigned card #90487.