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-21] [$250] Smart Limit option missing when editing or creating an existing Expensify Card #94072
Version Number: 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:@Leeckhart Slack conversation (hyperlinked to channel name): #Expensify Bugs
Action Performed:
Navigate to Workspaces > [Workspace Name] > Expensify Card.
Locate an existing virtual Expensify Card assigned to a user
Open the card settings and navigate to the limit type configuration.
Attempt to change the card's limit type.
Expected Result:
The Smart Limit option should be available as a limit type, alongside Monthly, Fixed amount, and Single-use, allowing the admin to switch the card to Smart Limit.
Actual Result:
The Smart Limit option is completely missing from the limit type selection. Only the following options are available:
Monthly
Fixed amount
Single-use
This occurs even though:
The card is an existing workspace-issued Expensify Card.
Other cards in the same workspace are already configured with Smart Limit.
Smart Limit is available in other workspaces/test accounts.
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
and only pushes the Smart Limit row if (areApprovalsConfigured) — see DynamicExpensifyCardLimitTypePage.tsx:54 and the conditional block at L144-L152. Monthly / Fixed / Single-use are pushed without that gate, which is why they remain. The create flow uses the identical gate at LimitTypeStep.tsx:45.
So when the workspace's approvalMode is optional (approvals turned off), Smart Limit is hidden by design — Smart Limit caps unapproved spend, so it's meaningless without approvers.
This explains the report cleanly: the affected workspace's approval mode is optional, so Smart Limit disappears for every card going forward, while the "other cards already configured with Smart Limit" simply retain a limitType: smart value set earlier (when approvals were still on). The gate is policy-level, not per-card.
There is a real UX defect inside this intended gate: if a card's current limit type is already smart but approvals are now optional, the edit page silently drops the option, so the admin can't even see/keep the card's existing setting.
Supporting evidence
getApprovalWorkflow falls back to ADVANCED when policy is missing, so a totally-absent policy would still show Smart Limit — meaning the hide only happens when approvalMode is explicitly optional (or policy.type === PERSONAL): PolicyUtils.ts:1432-1438.
The page only re-fetches card limit data on focus (openPolicyEditCardLimitTypePage); it does not refresh policy.approvalMode, so a stale/partially-loaded policy in Onyx is a secondary candidate for an intermittent disappearance.
Issue is marked "Unable to reproduce" — consistent with a state-dependent (approval-mode) gate rather than a deterministic rendering bug.
What changes do you think we should make in order to solve the problem?
First confirm intent: if the workspace is genuinely on Optional approvals, this is working as designed and the right fix is product/UX (e.g., explain why Smart Limit is unavailable) rather than always showing the option.
For the concrete defect, make the gate also allow Smart Limit when the card's current limit type is already Smart, so an existing Smart Limit card never loses the option:
To confirm which case applies, check the affected workspace's approvalMode in production (Slack thread #Expensify Bugs). If it is optional, this is expected behavior; if it is advanced/basic, then it's a stale-policy load race and the page should also refresh approvalMode on focus.
What alternative solutions did you explore? (Optional)
Refreshing policy.approvalMode when the edit page mounts (not just card limit data) to rule out a stale-Onyx race.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/94072) 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.
When editing (or issuing) an existing workspace Expensify Card, the Smart Limit option is missing from the limit‑type selector even though the workspace already has cards on Smart Limit.
What is the root cause of that problem?
NewDot answers the question "does this workspace support Smart Limit?" in two different places with two different signals, and for this workspace they disagree.
The Workflows and More Features pages answer it from the cards themselves — isSmartLimitEnabled(workspaceCards), i.e. does any active card already use Smart Limit:
and they trust that signal enough to lock the "Add approvals" toggle on when it is true (you literally cannot turn approvals off while a Smart‑Limit card exists):
So for a workspace whose approvalMode reads OPTIONAL while Smart‑Limit cards already exist (approvals managed in OldDot, or approvalMode not in sync with the actual approval setup), the result is self‑contradictory: the Workflows page treats the workspace as Smart‑Limit‑enabled and refuses to let approvals be disabled, yet the card screen — looking only at approvalMode — drops the Smart Limit option entirely. The fix is to make the card screens read the same workspace‑level signal the rest of NewDot already trusts.
What changes do you think we should make in order to solve the problem?
Decide Smart Limit visibility from the workspace's actual Smart‑Limit state in addition to approvalMode, by reusing the existing isSmartLimitEnabled helper — the same source of truth the Workflows/More Features pages use.
DynamicExpensifyCardLimitTypePage.tsx already loads cardsList, so:
then push the Smart Limit option when areApprovalsConfigured || isSmartLimitWorkspace.
This makes the three Expensify‑Card surfaces (Workflows, More Features, and the card limit‑type screens) agree on one definition of "this workspace uses Smart Limit", and it leaves brand‑new workspaces (no approvals, no Smart‑Limit cards) behaving exactly as today.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Render the limit‑type list for a policy with approvalMode === OPTIONAL and a cardsList containing at least one active card with limitType === SMART — assert the Smart Limit option is present in both the edit and issue‑new flows; and assert it stays hidden when approvals are optional and no card uses Smart Limit.
What alternative solutions did you explore? (Optional)
Always render Smart Limit but disabled with a "requires approvals" hint when neither signal is true — more discoverable, but it surfaces an unselectable row in genuinely unsupported workspaces; gating on the real workspace state keeps the picker honest. Widening getApprovalWorkflow/getDefaultExpensifyCardLimitType to consult the cards would also work, but those helpers are policy‑only by design, so reading the cards at the screen level (where cardsList is already available) is the smaller, more contained change.
changed the title [-]Smart Limit option missing when editing or creating an existing Expensify Card[/-][+][$250] Smart Limit option missing when editing or creating an existing Expensify Card[/+]on Jun 19, 2026
Please re-state the problem that we are trying to solve in this issue.
When editing (or creating) an existing Expensify Card, the Smart Limit option is missing from the limit-type selector - only Monthly, Fixed amount, and Single-use appear - even though Smart Limit is available for other cards in the same workspace and in other workspaces.
What is the root cause of that problem?
Smart Limit availability is keyed on whether the workspace has approvals configured (approvalMode !== OPTIONAL). The default limit-type helper computes this carefully, with a Smart-friendly fallback when approvalMode is missing:
But the options list in the limit-type selector decides Smart Limit visibility separately, with its own check on policy.approvalMode. When that check reads approvalMode directly (without the ?? ADVANCED fallback) - or reads the policy before approvalMode is hydrated in the edit flow - it concludes "approvals not configured" and drops Smart Limit, while getDefaultExpensifyCardLimitType (and other cards) still consider it available.
So there are two independent computations of "can this workspace use Smart Limit," with different fallbacks, and they disagree. That mismatch is exactly why Smart Limit can be the default yet be absent from the list, and why it appears for some cards/flows but not this one.
What changes do you think we should make in order to solve the problem?
Extract one canonical canUseSmartLimit(policy) predicate and use it everywhere - the options list, the default helper, and both create and edit flows - so availability is computed identically each time.
+// Single source of truth: a workspace can use Smart Limit when approvals are+// configured. Same PERSONAL handling and the same `?? ADVANCED` fallback as the+// default-type logic, so availability and default can never disagree.+function canUseSmartLimit(policy?: OnyxEntry<Policy>): boolean {+ let approvalMode = policy?.approvalMode ?? CONST.POLICY.APPROVAL_MODE.ADVANCED;+ if (policy?.type === CONST.POLICY.TYPE.PERSONAL) {+ approvalMode = CONST.POLICY.APPROVAL_MODE.OPTIONAL;+ }+ return approvalMode !== CONST.POLICY.APPROVAL_MODE.OPTIONAL;+}
function getDefaultExpensifyCardLimitType(policy?: OnyxEntry<Policy>) {
- let approvalMode = policy?.approvalMode ?? CONST.POLICY.APPROVAL_MODE.ADVANCED;- if (policy?.type === CONST.POLICY.TYPE.PERSONAL) {- approvalMode = CONST.POLICY.APPROVAL_MODE.OPTIONAL;- }- const areApprovalsConfigured = approvalMode !== CONST.POLICY.APPROVAL_MODE.OPTIONAL;- return areApprovalsConfigured ? CONST.EXPENSIFY_CARD.LIMIT_TYPES.SMART : CONST.EXPENSIFY_CARD.LIMIT_TYPES.MONTHLY;+ return canUseSmartLimit(policy) ? CONST.EXPENSIFY_CARD.LIMIT_TYPES.SMART : CONST.EXPENSIFY_CARD.LIMIT_TYPES.MONTHLY;
}
The selector then builds its options from the same predicate:
Fixes the mismatch at the source. Availability and default now derive from one function, so "Smart is the default but not in the list" becomes impossible.
Handles the unhydrated-policy case correctly. The shared ?? ADVANCED fallback means a not-yet-loaded approvalMode defaults to showing Smart (matching the default helper), instead of silently hiding it in the edit flow.
One place to reason about. Every current and future consumer (create card, edit card, default selection) asks the same question and gets the same answer.
In addition, the edit flow should ensure the policy (with approvalMode) is loaded before rendering the selector, so the predicate evaluates against real data rather than a partial policy.
What alternative solutions did you explore?
Add the ?? ADVANCED fallback only to the selector's check (rejected): fixes this one symptom but leaves two separate computations that can still drift the next time either is touched. Extracting one predicate removes the class of bug.
Always show Smart Limit and validate on save (rejected): would offer Smart Limit to workspaces without approvals, where it isn't valid, producing a confusing save-time failure. The predicate keeps it correctly gated while consistent.
Note: getDefaultExpensifyCardLimitType and the approvalMode/LIMIT_TYPES constants are verified in CardUtils. The selector's current options-list code and its exact Smart-Limit gating are illustrative (not fetched at draft time, and the issue is Needs Reproduction) - please confirm where the selector decides Smart-Limit visibility before implementing.
godzillaxbox19982014-lgtm commented on Jun 19, 2026
The local evidence matches this recurring failure shape: NewDot and OldDot read different default account/card fields. Here, src/pages/workspace/expensifyCard/issueNew/LimitTypeStep.tsx:61 and src/pages/workspace/expensifyCard/issueNew/LimitTypeStep.tsx:51 do not agree on the same workspace name value, so the user-visible path can show a missing or stale state even though nearby data already has the needed context.
What changes do you think we should make in order to solve the problem?
Update src/pages/workspace/expensifyCard/issueNew/LimitTypeStep.tsx:61 to derive workspace name from the card/accounting data source that owns this flow before the value is consumed.
Carry the same normalized value through src/pages/workspace/expensifyCard/issueNew/LimitTypeStep.tsx:51; that follows the safer family move to add fallback at the export/mapping layer, so the write/optimistic/read paths agree instead of only changing the visible component.
Keep the change inside the Payments, Wallet, Bank, Billing, Cards surface and avoid changing money movement, bank/card/account settings.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Add or update a regression in tests/unit/Payment*.ts for the exact issue flow: Smart Limit option missing when editing or creating an existing Expensify Card.
Cover the counter-case near src/pages/workspace/expensifyCard/issueNew/LimitTypeStep.tsx:61 so valid existing workspace name behavior still works.
Manually repeat the issue steps after the patch and confirm the visible state/action is no longer stale.
What alternative solutions did you explore? (Optional)
I would not add a broad new condition outside these referenced paths; the safer fix is to keep workspace name consistent at the first read/write boundary shown above.
Please re-state the problem that we are trying to solve in this issue.
When an admin opens an existing Expensify Card's limit type settings (Workspaces → [Workspace] → Expensify Card → card → limit type), the Smart Limit option is completely absent from the selection list — even when the card's current limit type is already Smart. Only Monthly, Fixed amount, and Single-use appear. This makes it impossible for the admin to retain or re-select Smart Limit.
What is the root cause of that problem?
In src/pages/workspace/expensifyCard/DynamicExpensifyCardLimitTypePage.tsx (the edit-card flow), line 54 computes:
If the workspace approval mode is OPTIONAL, areApprovalsConfigured is false and Smart Limit is omitted unconditionally — even when initialLimitType (the card's saved nameValuePairs.limitType) is already SMART. This occurs when:
A card was issued as Smart Limit and the workspace later switched to Optional approval mode, OR
The card is in a workspace configured for Optional approvals but Smart Limit was previously assigned via another path.
The same gate exists in src/pages/workspace/expensifyCard/issueNew/LimitTypeStep.tsx at the equivalent areApprovalsConfigured check (line ~87). This component's isEditing flag (issueNewCard?.isEditing) signals that the user navigated back mid-wizard to revise the limit type. If issueNewCard?.data?.limitType was already saved as SMART during an earlier wizard pass and the workspace approval mode subsequently changed to OPTIONAL, returning to this step hides Smart Limit — leaving the user unable to confirm or change away from an option that is no longer rendered.
What changes do you think we should make in order to solve the problem?
This guarantees that Smart Limit always appears as a selectable option when it is the card's currently saved limit type, regardless of the workspace's approval mode.
This handles the mid-wizard editing case: when a user navigates back to the limit type step (isEditing === true) and issueNewCard.data.limitType is already SMART (set during a prior wizard pass), Smart Limit remains visible and selectable even if the workspace approval mode has since changed to OPTIONAL. It does not allow a fresh wizard pass on an OPTIONAL-approval workspace to show Smart Limit for new selections, because on a fresh pass issueNewCard?.data?.limitType starts from defaultType (the policy default), not SMART.
Why NOT remove the gate entirely?
Removing areApprovalsConfigured entirely from either file would unconditionally expose Smart Limit to admins issuing brand-new cards on OPTIONAL-approval workspaces. Smart Limit requires approvals to reset the card balance; without them, the card would be non-functional. The targeted || <currentSavedValue> === SMART condition is precise: it surfaces the option only when it is already the saved state that needs to be preserved or acknowledged, not for fresh selections.
Working analog
The shouldShowFixedOption logic already in DynamicExpensifyCardLimitTypePage.tsx (lines ~127–137) follows the same pattern: an option's visibility is conditioned on the card's current runtime state (card.totalSpend, card.nameValuePairs.unapprovedExpenseLimit) rather than only on workspace configuration. The Smart Limit fix mirrors this existing pattern.
What alternative solutions did you explore? (Optional)
Remove the areApprovalsConfigured gate entirely from both files — this would unconditionally show Smart Limit even when issuing brand-new cards on OPTIONAL-approval workspaces, which is wrong because Smart Limit requires approvals to function.
Fix only DynamicExpensifyCardLimitTypePage.tsx and leave LimitTypeStep.tsx unchanged — this misses the mid-wizard editing scenario where a user navigates back to the limit type step after a workspace approval mode change and cannot see the Smart Limit option they previously selected.
Apply || issueNewCard?.data?.limitType === SMART unconditionally for all wizard states in LimitTypeStep.tsx — this would expose Smart Limit on fresh wizard passes whenever a prior draft with Smart Limit existed in Onyx, even after the admin intentionally cleared it. The isEditing flow is the only scenario where preserving a prior selection matters; the condition is already scoped to that because a fresh pass always initialises typeSelected from defaultType, not issueNewCard.data.limitType.
⚠️ @dilshodmackbook-sketch 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.
changed the title [-][$250] Smart Limit option missing when editing or creating an existing Expensify Card[/-][+][Due for payment 2026-08-21] [$250] Smart Limit option missing when editing or creating an existing Expensify Card[/+]on Aug 14, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.53-10 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2026-08-21. 🎊
The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]
[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:
Link to the comment on the Issue:
[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.
Regression Test Proposal
Precondition:
Test:
Precondition: You are an admin of a workspace that has the Expensify Card enabled.
A. Workspace with Optional approvals (Smart Limit disabled)
Open the workspace and go to More features and enable Workflows, then open Workflows and set Add approvals to Optional.
Go to Workspace settings > Expensify Card and start the Issue new card flow. Proceed to the Limit type step.
Verify the Smart Limit option is displayed in the limit type list.
Verify the Smart Limit option is disabled (greyed out and not pressable) and shows a description explaining that an approval workflow must be enabled to use it.
Verify tapping the disabled Smart Limit option does nothing and that Monthly is selected by default.
Open an existing workspace-issued Expensify Card > Limit type and repeat steps 3–5 for the edit-existing-card flow.
B. Workspace with approvals enabled (Smart Limit selectable)
7. Go back to Workflows and set Add approvals to Basic (or Advanced) so an approval workflow is configured.
8. Repeat step 2 (Issue new card) and step 6 (edit existing card).
9. Verify the Smart Limit option is displayed, enabled, and can be selected as the card's limit type.
Activity
MelvinBot commentedon Jun 19, 2026
Proposal
What is the root cause of that problem?
The Smart Limit option is only added to the limit-type list when the workspace has an approval workflow configured. The edit page computes:
and only pushes the Smart Limit row
if (areApprovalsConfigured)— seeDynamicExpensifyCardLimitTypePage.tsx:54and the conditional block atL144-L152. Monthly / Fixed / Single-use are pushed without that gate, which is why they remain. The create flow uses the identical gate atLimitTypeStep.tsx:45.So when the workspace's
approvalModeisoptional(approvals turned off), Smart Limit is hidden by design — Smart Limit caps unapproved spend, so it's meaningless without approvers.This explains the report cleanly: the affected workspace's approval mode is
optional, so Smart Limit disappears for every card going forward, while the "other cards already configured with Smart Limit" simply retain alimitType: smartvalue set earlier (when approvals were still on). The gate is policy-level, not per-card.There is a real UX defect inside this intended gate: if a card's current limit type is already
smartbut approvals are now optional, the edit page silently drops the option, so the admin can't even see/keep the card's existing setting.Supporting evidence
getApprovalWorkflowfalls back toADVANCEDwhenpolicyis missing, so a totally-absent policy would still show Smart Limit — meaning the hide only happens whenapprovalModeis explicitlyoptional(orpolicy.type === PERSONAL):PolicyUtils.ts:1432-1438.CardUtils.ts:444-450.openPolicyEditCardLimitTypePage); it does not refreshpolicy.approvalMode, so a stale/partially-loaded policy in Onyx is a secondary candidate for an intermittent disappearance.What changes do you think we should make in order to solve the problem?
First confirm intent: if the workspace is genuinely on Optional approvals, this is working as designed and the right fix is product/UX (e.g., explain why Smart Limit is unavailable) rather than always showing the option.
For the concrete defect, make the gate also allow Smart Limit when the card's current limit type is already Smart, so an existing Smart Limit card never loses the option:
DynamicExpensifyCardLimitTypePage.tsx:144, push the Smart Limit row whenareApprovalsConfigured || initialLimitType === CONST.EXPENSIFY_CARD.LIMIT_TYPES.SMART.To confirm which case applies, check the affected workspace's
approvalModein production (Slack thread #Expensify Bugs). If it isoptional, this is expected behavior; if it isadvanced/basic, then it's a stale-policy load race and the page should also refreshapprovalModeon focus.What alternative solutions did you explore? (Optional)
Refreshing
policy.approvalModewhen the edit page mounts (not just card limit data) to rule out a stale-Onyx race.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/94072)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
David-2002065 commentedon Jun 19, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When editing (or issuing) an existing workspace Expensify Card, the Smart Limit option is missing from the limit‑type selector even though the workspace already has cards on Smart Limit.
What is the root cause of that problem?
NewDot answers the question "does this workspace support Smart Limit?" in two different places with two different signals, and for this workspace they disagree.
The Workflows and More Features pages answer it from the cards themselves —
isSmartLimitEnabled(workspaceCards), i.e. does any active card already use Smart Limit:App/src/libs/CardUtils.ts
Lines 1158 to 1162 in a29ef01
and they trust that signal enough to lock the "Add approvals" toggle on when it is true (you literally cannot turn approvals off while a Smart‑Limit card exists):
App/src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx
Line 531 in a29ef01
But the card limit‑type screens answer the same question from
policy.approvalModeinstead:App/src/pages/workspace/expensifyCard/DynamicExpensifyCardLimitTypePage.tsx
Line 54 in a29ef01
App/src/pages/workspace/expensifyCard/DynamicExpensifyCardLimitTypePage.tsx
Lines 144 to 152 in a29ef01
The issue‑new step uses the identical
approvalModegate:App/src/pages/workspace/expensifyCard/issueNew/LimitTypeStep.tsx
Lines 93 to 101 in a29ef01
So for a workspace whose
approvalModereadsOPTIONALwhile Smart‑Limit cards already exist (approvals managed in OldDot, orapprovalModenot in sync with the actual approval setup), the result is self‑contradictory: the Workflows page treats the workspace as Smart‑Limit‑enabled and refuses to let approvals be disabled, yet the card screen — looking only atapprovalMode— drops the Smart Limit option entirely. The fix is to make the card screens read the same workspace‑level signal the rest of NewDot already trusts.What changes do you think we should make in order to solve the problem?
Decide Smart Limit visibility from the workspace's actual Smart‑Limit state in addition to
approvalMode, by reusing the existingisSmartLimitEnabledhelper — the same source of truth the Workflows/More Features pages use.DynamicExpensifyCardLimitTypePage.tsxalready loadscardsList, so:and guard the Smart Limit
data.push(...)withareApprovalsConfigured || isSmartLimitWorkspaceinstead ofareApprovalsConfiguredalone.LimitTypeStep.tsxreads the workspace cards the same way the edit screen does and applies the same condition:then push the Smart Limit option when
areApprovalsConfigured || isSmartLimitWorkspace.This makes the three Expensify‑Card surfaces (Workflows, More Features, and the card limit‑type screens) agree on one definition of "this workspace uses Smart Limit", and it leaves brand‑new workspaces (no approvals, no Smart‑Limit cards) behaving exactly as today.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Render the limit‑type list for a policy with
approvalMode === OPTIONALand acardsListcontaining at least one active card withlimitType === SMART— assert the Smart Limit option is present in both the edit and issue‑new flows; and assert it stays hidden when approvals are optional and no card uses Smart Limit.What alternative solutions did you explore? (Optional)
Always render Smart Limit but disabled with a "requires approvals" hint when neither signal is true — more discoverable, but it surfaces an unselectable row in genuinely unsupported workspaces; gating on the real workspace state keeps the picker honest. Widening
getApprovalWorkflow/getDefaultExpensifyCardLimitTypeto consult the cards would also work, but those helpers are policy‑only by design, so reading the cards at the screen level (wherecardsListis already available) is the smaller, more contained change.melvin-bot commentedon Jun 19, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ChavdaSachin (
External)[-]Smart Limit option missing when editing or creating an existing Expensify Card[/-][+][$250] Smart Limit option missing when editing or creating an existing Expensify Card[/+]melvin-bot commentedon Jun 19, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022068007151575424158
dostonbunyodov0006 commentedon Jun 19, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When editing (or creating) an existing Expensify Card, the Smart Limit option is missing from the limit-type selector - only Monthly, Fixed amount, and Single-use appear - even though Smart Limit is available for other cards in the same workspace and in other workspaces.
What is the root cause of that problem?
Smart Limit availability is keyed on whether the workspace has approvals configured (
approvalMode !== OPTIONAL). The default limit-type helper computes this carefully, with a Smart-friendly fallback whenapprovalModeis missing:But the options list in the limit-type selector decides Smart Limit visibility separately, with its own check on
policy.approvalMode. When that check readsapprovalModedirectly (without the?? ADVANCEDfallback) - or reads the policy beforeapprovalModeis hydrated in the edit flow - it concludes "approvals not configured" and drops Smart Limit, whilegetDefaultExpensifyCardLimitType(and other cards) still consider it available.So there are two independent computations of "can this workspace use Smart Limit," with different fallbacks, and they disagree. That mismatch is exactly why Smart Limit can be the default yet be absent from the list, and why it appears for some cards/flows but not this one.
What changes do you think we should make in order to solve the problem?
Extract one canonical
canUseSmartLimit(policy)predicate and use it everywhere - the options list, the default helper, and both create and edit flows - so availability is computed identically each time.The selector then builds its options from the same predicate:
Why this is optimal:
?? ADVANCEDfallback means a not-yet-loadedapprovalModedefaults to showing Smart (matching the default helper), instead of silently hiding it in the edit flow.In addition, the edit flow should ensure the
policy(withapprovalMode) is loaded before rendering the selector, so the predicate evaluates against real data rather than a partial policy.What alternative solutions did you explore?
Add the
?? ADVANCEDfallback only to the selector's check (rejected): fixes this one symptom but leaves two separate computations that can still drift the next time either is touched. Extracting one predicate removes the class of bug.Always show Smart Limit and validate on save (rejected): would offer Smart Limit to workspaces without approvals, where it isn't valid, producing a confusing save-time failure. The predicate keeps it correctly gated while consistent.
Note:
getDefaultExpensifyCardLimitTypeand theapprovalMode/LIMIT_TYPESconstants are verified inCardUtils. The selector's current options-list code and its exact Smart-Limit gating are illustrative (not fetched at draft time, and the issue is Needs Reproduction) - please confirm where the selector decides Smart-Limit visibility before implementing.godzillaxbox19982014-lgtm commentedon Jun 19, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Smart Limit option missing when editing or creating an existing Expensify Card
What is the root cause of that problem?
I traced this to the path that handles
workspace name:LimitTypeStep):}, [areSpendRulesAvailable, isEditing, issueNewCard?.data.cardType]);areSpendRulesAvailable):const areSpendRulesAvailable = isPolicyFeatureEnabled(policy, CONST.POLICY.MORE_FEATURES.ARE_RULES_ENABLED);if):if (areSpendRulesAvailable || issueNewCard?.data.cardType === CONST.EXPENSIFY_CARD.CARD_TYPE.VIRTUAL) {src/pages/workspace/expensifyCard/issueNew/LimitTypeStep.tsx:61andsrc/pages/workspace/expensifyCard/issueNew/LimitTypeStep.tsx:51do not agree on the sameworkspace namevalue, so the user-visible path can show a missing or stale state even though nearby data already has the needed context.What changes do you think we should make in order to solve the problem?
src/pages/workspace/expensifyCard/issueNew/LimitTypeStep.tsx:61to deriveworkspace namefrom the card/accounting data source that owns this flow before the value is consumed.src/pages/workspace/expensifyCard/issueNew/LimitTypeStep.tsx:51; that follows the safer family move to add fallback at the export/mapping layer, so the write/optimistic/read paths agree instead of only changing the visible component.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
tests/unit/Payment*.tsfor the exact issue flow: Smart Limit option missing when editing or creating an existing Expensify Card.src/pages/workspace/expensifyCard/issueNew/LimitTypeStep.tsx:61so valid existingworkspace namebehavior still works.What alternative solutions did you explore? (Optional)
workspace nameconsistent at the first read/write boundary shown above.aswin-s commentedon Jun 19, 2026
Please re-state the problem that we are trying to solve in this issue.
When an admin opens an existing Expensify Card's limit type settings (Workspaces → [Workspace] → Expensify Card → card → limit type), the Smart Limit option is completely absent from the selection list — even when the card's current limit type is already Smart. Only Monthly, Fixed amount, and Single-use appear. This makes it impossible for the admin to retain or re-select Smart Limit.
What is the root cause of that problem?
In
src/pages/workspace/expensifyCard/DynamicExpensifyCardLimitTypePage.tsx(the edit-card flow), line 54 computes:Then at line ~144, Smart Limit is only pushed into the options array when
areApprovalsConfiguredistrue:If the workspace approval mode is
OPTIONAL,areApprovalsConfiguredisfalseand Smart Limit is omitted unconditionally — even wheninitialLimitType(the card's savednameValuePairs.limitType) is alreadySMART. This occurs when:The same gate exists in
src/pages/workspace/expensifyCard/issueNew/LimitTypeStep.tsxat the equivalentareApprovalsConfiguredcheck (line ~87). This component'sisEditingflag (issueNewCard?.isEditing) signals that the user navigated back mid-wizard to revise the limit type. IfissueNewCard?.data?.limitTypewas already saved asSMARTduring an earlier wizard pass and the workspace approval mode subsequently changed toOPTIONAL, returning to this step hides Smart Limit — leaving the user unable to confirm or change away from an option that is no longer rendered.What changes do you think we should make in order to solve the problem?
File 1 —
src/pages/workspace/expensifyCard/DynamicExpensifyCardLimitTypePage.tsx:Change the condition at line ~144 from:
to:
This guarantees that Smart Limit always appears as a selectable option when it is the card's currently saved limit type, regardless of the workspace's approval mode.
File 2 —
src/pages/workspace/expensifyCard/issueNew/LimitTypeStep.tsx:Change the condition at line ~87 from:
to:
This handles the mid-wizard editing case: when a user navigates back to the limit type step (
isEditing === true) andissueNewCard.data.limitTypeis alreadySMART(set during a prior wizard pass), Smart Limit remains visible and selectable even if the workspace approval mode has since changed toOPTIONAL. It does not allow a fresh wizard pass on anOPTIONAL-approval workspace to show Smart Limit for new selections, because on a fresh passissueNewCard?.data?.limitTypestarts fromdefaultType(the policy default), notSMART.Why NOT remove the gate entirely?
Removing
areApprovalsConfiguredentirely from either file would unconditionally expose Smart Limit to admins issuing brand-new cards onOPTIONAL-approval workspaces. Smart Limit requires approvals to reset the card balance; without them, the card would be non-functional. The targeted|| <currentSavedValue> === SMARTcondition is precise: it surfaces the option only when it is already the saved state that needs to be preserved or acknowledged, not for fresh selections.Working analog
The
shouldShowFixedOptionlogic already inDynamicExpensifyCardLimitTypePage.tsx(lines ~127–137) follows the same pattern: an option's visibility is conditioned on the card's current runtime state (card.totalSpend,card.nameValuePairs.unapprovedExpenseLimit) rather than only on workspace configuration. The Smart Limit fix mirrors this existing pattern.What alternative solutions did you explore? (Optional)
areApprovalsConfiguredgate entirely from both files — this would unconditionally show Smart Limit even when issuing brand-new cards onOPTIONAL-approval workspaces, which is wrong because Smart Limit requires approvals to function.DynamicExpensifyCardLimitTypePage.tsxand leaveLimitTypeStep.tsxunchanged — this misses the mid-wizard editing scenario where a user navigates back to the limit type step after a workspace approval mode change and cannot see the Smart Limit option they previously selected.|| issueNewCard?.data?.limitType === SMARTunconditionally for all wizard states inLimitTypeStep.tsx— this would expose Smart Limit on fresh wizard passes whenever a prior draft with Smart Limit existed in Onyx, even after the admin intentionally cleared it. TheisEditingflow is the only scenario where preserving a prior selection matters; the condition is already scoped to that because a fresh pass always initialisestypeSelectedfromdefaultType, notissueNewCard.data.limitType.github-actions commentedon Jun 19, 2026
92 remaining items
[-][$250] Smart Limit option missing when editing or creating an existing Expensify Card[/-][+][Due for payment 2026-08-21] [$250] Smart Limit option missing when editing or creating an existing Expensify Card[/+]melvin-bot commentedon Aug 14, 2026
@ChavdaSachin / @truph01
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.53-10 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2026-08-21. 🎊
The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]
melvin-bot commentedon Aug 17, 2026
@ChavdaSachin Whoops! This issue is 2 days overdue. Let's get this updated quick!
truph01 commentedon Aug 19, 2026
Contributor+ 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:
Link to the comment on the Issue:
[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.
Regression Test Proposal
Precondition:
Test:
Precondition: You are an admin of a workspace that has the Expensify Card enabled.
A. Workspace with Optional approvals (Smart Limit disabled)
B. Workspace with approvals enabled (Smart Limit selectable)
7. Go back to Workflows and set Add approvals to Basic (or Advanced) so an approval workflow is configured.
8. Repeat step 2 (Issue new card) and step 6 (edit existing card).
9. Verify the Smart Limit option is displayed, enabled, and can be selected as the card's limit type.
Do we agree 👍 or 👎
melvin-bot commentedon Aug 19, 2026
@ChavdaSachin Huh... This is 4 days overdue. Who can take care of this?
melvin-bot commentedon Aug 20, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Aug 20, 2026
Payment Summary
Resolving PRs:
Show Smart Limit card option disabled when approvals are optional #96567
Reviewer: @ChavdaSachin owed $250 via NewDot
Reviewer: @truph01 owed $250 via NewDot
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Aug 21, 2026
Payment Summary
Contributor+: @truph01 due $250 via NewDot
garrettmknight commentedon Sep 3, 2026
$250 approved for @truph01