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 - Card is not marked as selected in Card list after spend rule is created #91899
Version Number: 9.3.84-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:#89205 Email or phone of affected tester (no customers):applausetester+ssndjois2jd1@applause.expensifail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.5 / Chrome App Component: Workspace Settings
Action Performed:
Precondition:
Log in with Expensifail account.
Set up workspace with bank account and set up Expensify Card.
Enable Rules.
Go to staging.new.expensify.com
Go to workspace settings > Expensify Card.
Click Issue card.
Proceed to Step 4 of Issue card flow.
Enable Add spend rule.
Click Create new.
Enter the new rule info.
Continue issuing card.
After issuing card, go to Rules settings.
Open the created spend rule.
Click Choose cards.
Expected Result:
The card will be marked as selected in Card list after spend rule is created.
Actual Result:
The card is not marked as selected in Card list after spend rule is created.
👋 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.
When issuing a new card with a "Create new" spend rule, the frontend calls buildSpendRuleAST(spendRuleValue) at Card.ts:1489. However, spendRuleValue comes from IssueNewCardData.spendRuleValue which has no cardIDs field — the card doesn't exist yet at this point.
Later, when viewing the spend rule from Rules settings, SpendRulePageBase calls getSpendRuleFormValuesFromCardRule() which parses the rule's AST and extracts cardIDs: []. SpendRuleCardPage reads this empty array, so no cards appear selected.
The backend is expected to associate the newly created card with the rule and return the updated rule AST, but the frontend optimistic data never includes the card ID — and if the backend response doesn't properly update PRIVATE_EXPENSIFY_CARD_SETTINGS with the card ID in the rule's filter, the association remains missing.
What changes do you think we should make in order to solve the problem?
In issueExpensifyCard in Card.ts, when creating a new spend rule during card issuance:
Generate the optimistic card ID first (it's already generated as optimisticCardID earlier in the function).
Include this optimisticCardID in spendRuleValue.cardIDs before calling buildSpendRuleAST, so the optimistic rule AST contains the card_id filter node pointing to the new card.
This ensures the optimistic Onyx data for the rule includes the card association immediately, so the card appears selected when viewing the spend rule from Rules settings before the backend response arrives.
The same approach should be verified for the "copy existing" rule flow — when cardRuleID of an existing rule is sent, the frontend should optimistically add the new card ID to that existing rule's cardIDs filter as well.
What alternative solutions did you explore?
An alternative would be to add a success callback after card creation that refetches PRIVATE_EXPENSIFY_CARD_SETTINGS, but this adds latency and doesn't solve the optimistic UI gap. Including the card ID in the optimistic rule AST is more consistent with Expensify's offline-first architecture.
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.
Activity
applause-bot commentedon May 27, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/957d930ec3f870dd4c936f1b4af57884d77db3378bc0eb8b1460a1632fb8321f
melvin-bot commentedon May 27, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #89205
melvin-bot commentedon May 27, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon May 27, 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:
MelvinBot commentedon May 27, 2026
Proposal
What is the root cause of that problem?
When issuing a new card with a "Create new" spend rule, the frontend calls
buildSpendRuleAST(spendRuleValue)atCard.ts:1489. However,spendRuleValuecomes fromIssueNewCardData.spendRuleValuewhich has nocardIDsfield — the card doesn't exist yet at this point.Inside
buildSpendRuleAST,cardIDsdefaults to[], and since the array is empty, thecard_idfilter node is omitted entirely from the AST`. The optimistic Onyx data for the rule is stored without any card association.Later, when viewing the spend rule from Rules settings,
SpendRulePageBasecallsgetSpendRuleFormValuesFromCardRule()which parses the rule's AST and extractscardIDs: [].SpendRuleCardPagereads this empty array, so no cards appear selected.The backend is expected to associate the newly created card with the rule and return the updated rule AST, but the frontend optimistic data never includes the card ID — and if the backend response doesn't properly update
PRIVATE_EXPENSIFY_CARD_SETTINGSwith the card ID in the rule's filter, the association remains missing.What changes do you think we should make in order to solve the problem?
In
issueExpensifyCardinCard.ts, when creating a new spend rule during card issuance:optimisticCardIDearlier in the function).optimisticCardIDinspendRuleValue.cardIDsbefore callingbuildSpendRuleAST, so the optimistic rule AST contains thecard_idfilter node pointing to the new card.The same approach should be verified for the "copy existing" rule flow — when
cardRuleIDof an existing rule is sent, the frontend should optimistically add the new card ID to that existing rule'scardIDsfilter as well.What alternative solutions did you explore?
An alternative would be to add a success callback after card creation that refetches
PRIVATE_EXPENSIFY_CARD_SETTINGS, but this adds latency and doesn't solve the optimistic UI gap. Including the card ID in the optimistic rule AST is more consistent with Expensify's offline-first architecture.Next 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.luacmartins commentedon May 27, 2026
Feature is behind a beta. NAB
JS00001 commentedon Jun 1, 2026
PR open, was waiting on web-e
JS00001 commentedon Jun 4, 2026
This is fixed