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-06-03] [$250] Feed Name for company card is incorrect when viewing from the Spend page #89619
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Version Number: 9.3.65-6 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:@abbagail Slack conversation (hyperlinked to channel name): #Expensify Bugs
Action Performed:
Two card feeds are connected two workspaces
Go to Spend
Click either "Card statements" or "Card accruals."
Adjust the date range if needed
See spend grouped by card
Expected Result:
Card feed shows the correct card feed name
Actual Result:
Card feed shows incorrect name
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
getCustomFeedNameFromFeeds iterates over all workspace card feeds and returns the first matching custom nickname for a given feed type (e.g., vcf). It has no concept of which workspace the card belongs to.
On the Spend page, getCardSections calls getFeedNameForDisplay with only cardGroup.bank (the feed type) and the full cardFeeds collection — no fundID or policyID is passed. So when two workspaces both have the same feed type with different custom nicknames, whichever nickname is encountered first wins, and the other workspace's cards show the wrong name.
What changes do you think we should make in order to solve the problem?
The SearchCardGroup type (SearchResults.ts:122-149) already includes cardID. We can use this to look up the card's domain/workspace from the existing cardList Onyx data, then scope the nickname lookup to the correct workspace's cardFeeds entry instead of iterating all of them.
Specifically:
In getCardSections, use the cardID from the card group to find the corresponding card in cardList, which contains fundID/domain info.
Pass the resolved domain key to getFeedNameForDisplay (or a new parameter) so it reads the nickname from the correct workspace's companyCardNicknames rather than returning the first match from any workspace.
This follows the same correct pattern already used by getCardFeedsForDisplay, which reads nicknames from the specific domain's cardFeeds object.
What alternative solutions did you explore? (Optional)
An alternative would be to have the backend include fundID or domainID directly in the SearchCardGroup response, eliminating the need for a client-side reverse lookup. However, this requires a backend change and the client-side approach using cardID → cardList lookup achieves the same result with data already available.
Investigation details
Data flow causing the bug:
Backend returns SearchCardGroup with bank (feed type like vcf) and cardID, but no workspace identifier
getCustomFeedNameFromFeeds iterates Object.values(cardFeeds) and returns the first matching nickname — wrong workspace's name may be returned
Possibly related issue:#87280 reports that the card column on reports shows a feed ID string instead of the proper card program name — may share the same underlying nickname resolution issue.
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 [-]Feed Name for company card is incorrect when viewing from the Spend page[/-][+][$250] Feed Name for company card is incorrect when viewing from the Spend page[/+]on May 5, 2026
Please re-state the problem that we are trying to solve in this issue.
When a user has two different company card feeds connected on two different workspaces and views the Spend page (Search grouped by card, e.g. "Card statements" or "Card accruals"), the card-feed name shown above each card group can render the wrong workspace's nickname. The cardholder, last‑four, and amounts are correct — only the human‑readable feed/nickname label is wrong, because it's resolved by scanning every workspace's nicknames and returning the first match instead of the nickname belonging to the workspace that actually owns the card in that group.
What is the root cause of that problem?
The "feed name" label rendered on every card‑grouped row in Search is produced by getFeedNameForDisplay and resolves the custom nickname via getCustomFeedNameFromFeeds, which iterates the entire cardFeeds Onyx collection and returns the first companyCardNicknames[feed] match it finds — with no awareness of which workspace owns the card in this group.
getCustomFeedNameFromFeeds in src/libs/CardUtils.ts:
for (const feedData of Object.values(cardFeeds)) {
const nickname = feedData?.settings?.companyCardNicknames?.[feed];
if (nickname) {
return nickname;
}
}
cardFeeds here is OnyxCollection<CardFeeds> keyed per workspace/domain (sharedNVP_private_domain_member_<id>), so when two workspaces each have a feed identified by the same feed key (e.g. both have a vcf Visa feed, or both have feeds where the bank string collides), Object.values(cardFeeds) returns them in arbitrary key order, and the first companyCardNicknames[feed] hit wins regardless of which workspace's card the user is actually looking at.
The call site in getCardSections only forwards the bank and the cardID's feedCountry; it never tells getFeedNameForDisplay which workspace this cardGroup belongs to:
So even though Onyx has enough information to resolve the right workspace (the cards_<fundID>_<bankName> Onyx keys in WORKSPACE_CARDS_LIST map every assigned card to the workspace that owns it), the current call discards that link and falls back to first‑match-wins. The previous fix at c293d2e ("Fix feed name on group search") added feedCountry to disambiguate Travel‑Invoicing vs the Expensify Card bank, but the cross‑workspace ambiguity for ordinary commercial feeds was not addressed.
What changes do you think we should make in order to solve the problem?
Resolve the nickname against the specific workspace that owns the card in the group, instead of the first nickname found across all workspaces.
In src/libs/CardUtils.ts, add a helper getNicknameForCardID(cardID, allWorkspaceCardsLists, cardFeeds, feed) that:
Walks the WORKSPACE_CARDS_LIST collection (cards_<workspaceAccountID>_<bankName>) and finds the entry whose values contain a card with cardID === cardID.
Parses the workspaceAccountID segment out of that Onyx key.
Looks up cardFeeds[<sharedNVP key for that workspaceAccountID/domain>]?.settings?.companyCardNicknames?.[feed] and returns it.
Returns undefined when the cardID cannot be located (signed‑out workspace, deleted feed, race during initial load), letting the existing default‑name fallback in getCustomOrFormattedFeedName apply.
Extend getFeedNameForDisplay (line 781) with an optional cardID?: number parameter. When cardID is provided and customFeedName was not, prefer the workspace‑scoped lookup (1) before falling back to the existing global getCustomFeedNameFromFeeds. Keep the global fallback so existing call sites (e.g. WorkspaceCompanyCardsTableHeaderButtons, useFilterCardValue) that have no per‑card context continue to behave unchanged.
In getCardSections (src/libs/SearchUIUtils.ts line 3010), pass cardGroup.cardID to getFeedNameForDisplay, and also subscribe to the WORKSPACE_CARDS_LIST Onyx collection in the getSections caller chain (it is already loaded elsewhere — pass it through GetSectionsParams alongside cardFeeds).
Keep getCustomFeedNameFromFeeds as the global fallback when a cardID is unavailable; do not delete it.
Scope boundaries: changes are confined to src/libs/CardUtils.ts (helper + signature), src/libs/SearchUIUtils.ts (getCardSections + getSections plumbing for the new collection prop) and the GetSectionsParams type. Behavior for groupBy=card rendering is the only user‑visible surface affected; getFeedNameForDisplay callers that don't pass cardID (workspace settings pages, advanced filters, feed selector) are unaffected because the workspace‑scoped branch is gated on cardID !== undefined. Cash cards, the Expensify Card bank, and Travel Invoicing keep their existing branches in getFeedNameForDisplay. No backend/API changes; this is presentation‑only. All platforms benefit (issue is reported on Web/Desktop but the same code renders on every platform).
What alternative solutions did you explore? (Optional)
Add policyID (or workspaceAccountID) directly to SearchCardGroup server‑side and use it to index cardFeeds directly. Cleanest long‑term shape, but requires a backend change to the search response and coordinating searchResults versioning, so it's out of scope for a client fix.
Make getCustomFeedNameFromFeeds return all matches and reconcile in getCardSections. Equivalent in effect to the proposed fix but pushes Search‑specific reconciliation into a generic CardUtils helper, which is the wrong layer.
Disambiguate by cardName + lastFourPAN only (no workspace lookup). Doesn't help: the bug is that the feed nickname (workspace‑scoped) is wrong, not the per‑card label, which is already rendered correctly by formattedCardName.
⚠️@wildan-m 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.
When the Spend page renders the by-card grouping for Card Statements / Card Accruals, the feed name is resolved by a lookup that does not scope by workspace/policy, so the first matching nickname across all workspaces wins.
Chain (single symptom, but reproduces for every card that lives in a workspace whose feed-key collides with another workspace's feed-key — e.g., two cdf, two oauth.americanexpressfdx.com, or anything stored at the same companyCardNicknames key in two different sharedNVP_private_domain_member_* Onyx records):
SearchUIUtils.ts:3026 — getCardSections() builds the row with formattedFeedName: getFeedNameForDisplay(translate, cardGroup.bank as OnyxTypes.CompanyCardFeed, cardFeeds). It passes only cardGroup.bank (the feed key) and the collection of feeds across all policies. SearchCardGroup (SearchResults.ts:122-146) carries no fundID/policyID to disambiguate.
CardUtils.ts:775 — getFeedNameForDisplay() calls getCustomFeedNameFromFeeds(cardFeeds, feed) with no policy context.
CardUtils.ts:738-751 — getCustomFeedNameFromFeeds() iterates Object.values(cardFeeds) (every workspace's CardFeeds record) and returns the firstfeedData.settings.companyCardNicknames[feed] it finds. Whichever workspace happens to be ordered first in the Onyx collection wins, so a card belonging to workspace B can render workspace A's nickname.
CardUtils.ts:715-733 — doesCardFeedExist() has the same un-scoped iteration, which is fine for the existence check but reinforces the pattern.
The Travel-Invoicing fix from c293d2e5080 added feedCountry to disambiguate Expensify Card programs, but it never addressed the broader two-workspace collision in getCustomFeedNameFromFeeds.
The correct, policy-aware lookup pattern already exists for the Workspaces page in CardFeedUtils.ts:535-567 (getCardFeedsForDisplayPerPolicy) — it keys nicknames by ${fundID}_${feed} derived from the Onyx key sharedNVP_private_domain_member_${fundID}. That disambiguator is what the Spend grouping is missing.
What changes do you think we should make in order to solve the problem?
Fix at the data-construction layer in getCardSections() so each row carries the correct nickname before it reaches the renderer. Two coordinated edits:
Carry fundID on the card group. In getCardSections() (SearchUIUtils.ts:2987-3030), resolve the card's fundID from the flat cardList Onyx key (ONYXKEYS.CARD_LIST → Record<cardID, Card>, where Card.fundID already exists per Card.ts:94). If the backend can also start emitting fundID on SearchCardGroup, prefer that and use the cardList lookup as a fallback for older payloads.
Scope the nickname lookup by fundID. Extend getCustomFeedNameFromFeeds(cardFeeds, feed, fundID?) in CardUtils.ts:738: when fundID is provided, read directly from cardFeeds[${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${fundID}]?.settings?.companyCardNicknames?.[feed]. Only fall back to the existing iterate-all behavior when fundID is unknown (e.g., card not yet in cardList because of partial sync). Thread the same fundID through getFeedNameForDisplay so it can be passed in from getCardSections.
Edge cases:
Expensify Card — keep the existing feed === CONST.EXPENSIFY_CARD.BANK short-circuit at CardUtils.ts:721 and the Travel-Invoicing branch from c293d2e5080; both run before the nickname resolution.
Card not yet hydrated in cardList (offline first-load / pagination) — falling back to the current iteration preserves today's behavior; the row will resolve to a deterministic name once cardList syncs and the selector recomputes.
Deleted feed — doesCardFeedExist is fine to leave un-scoped, since "exists in any workspace I can see" is the right semantic for the deleted-feed message; the wrong-name bug is purely about which nickname is returned, not whether one exists.
Card belongs to a workspace whose CardFeeds aren't loaded yet — the lookup returns undefined, the function falls through to the formatted bank name (e.g., "Amex Cards"), which is the same fallback as today and not a regression.
What alternative solutions did you explore? (Optional)
Disambiguate by appending the domain suffix to bank (e.g., always store oauth.americanexpressfdx.com 1234 instead of oauth.americanexpressfdx.com). Rejected: the suffix is optional in the type (CardFeeds.ts:10 — CompanyCardFeedWithNumber = CompanyCardFeed | ${CompanyCardFeed}${number}) and existing data already has un-suffixed keys in companyCardNicknames, so two workspaces with cdf (no number) would still collide.
Fix it in the renderer (CardListItemHeader.tsx) by re-resolving the name there. Rejected: the row is sorted/filtered by formattedFeedName (SearchUIUtils.ts:318), so the wrong value would already have polluted the sort/group keys before render.
Match getFeedInfo() from CardFeedUtils.ts:577 directly (which builds ${fundID}_${feed} IDs). Rejected as the primary fix because it requires the caller to already have built cardFeedsByPolicy; reusing the underlying scoping logic inside getCustomFeedNameFromFeeds is a smaller change and keeps a single source of truth for the nickname resolution.
Deferred: apply the same fundID scoping to other call sites of getCustomFeedNameFromFeeds / getFeedNameForDisplay (e.g., the search filter chip). Out of scope for this PR — the issue is specifically about the by-card grouping on Spend — but worth a follow-up audit, since the underlying helper is shared.
The Spend page groups transactions by card and renders a feed name for each group. When two workspaces both have a card feed of the same type (e.g. vcf) with different custom nicknames, every group on the page can render with the wrong workspace's nickname.
Root cause
getCardSections builds the formattedFeedName by calling getFeedNameForDisplay with only the feed type (cardGroup.bank) and the entire cardFeeds collection — there is no scoping to the workspace the card actually belongs to (src/libs/SearchUIUtils.ts:3052):
getFeedNameForDisplay then delegates the nickname resolution to getCustomFeedNameFromFeeds, which iterates everysharedNVP_private_domain_member_<fundID> entry in the collection and returns whichever nickname comes first (src/libs/CardUtils.ts:762-775):
Object.values(cardFeeds) ordering is not stable across the two workspaces' domain keys, so the function returns the nickname of the first workspace whose settings.companyCardNicknames[feed] is truthy — and that nickname is then applied to every card group of that bank, including cards that belong to the other workspace. That is exactly the behavior the reporter is seeing on the Spend page.
The correct way to look up a custom feed nickname is the one already used in getCardFeedsForDisplay (src/libs/CardFeedUtils.ts:548-568), which derives the workspace-specific fundID from the domain key and indexes that workspace's nicknames directly:
SearchCardGroup (src/types/onyx/SearchResults.ts:122-149) already carries cardID, and the Card model carries fundID (src/types/onyx/Card.ts:94). The merged nonPersonalAndWorkspaceCardList derived value (src/libs/actions/OnyxDerived/configs/nonPersonalAndWorkspaceCardList.ts) is keyed by cardID, so the workspace can be resolved from the card group with one O(1) lookup. Search/index.tsx:327 already loads it but never passes it down.
Proposed fix
1 — Make getCustomFeedNameFromFeeds and getFeedNameForDisplay workspace-aware. Add an optional fundID. When provided, scope the nickname lookup to the matching sharedNVP_private_domain_member_<fundID> entry; otherwise keep the existing fallback so unrelated callers are unaffected.
3 — Wire the merged card list in at the call sites.Search/index.tsx already has it on hand (src/components/Search/index.tsx:327), so just thread it into the getSections call (line 527) and the inner enrichment call (line 608):
// src/components/Search/index.tsx:527 and :608const[filteredData1,allLength,hasDeletedTransactionFromSections]=getSections({
...
cardFeeds,
customCardNames,allCards: nonPersonalAndWorkspaceCards,
...
});
Do the same in useSearchSections.ts:65 and useSpendOverTimeData.ts:91 (read ONYXKEYS.DERIVED.NON_PERSONAL_AND_WORKSPACE_CARD_LIST and pass it through). Mirror the change in any TransactionGroupListItem / SearchStaticList path (src/components/Search/SearchList/ListItem/TransactionGroupListItem.tsx:134, src/components/Search/SearchStaticList.tsx:91) so feed names stay consistent across the entry points.
Why this approach
It mirrors the precedent in getCardFeedsForDisplay (src/libs/CardFeedUtils.ts:563-568) and getCombinedCardFeedsFromAllFeeds (src/libs/CardFeedUtils.ts:657-670), both of which scope companyCardNicknames lookup to the card's specific domain key — so the codebase already considers domain scoping the canonical pattern; the Spend grouping path simply skipped it. Reusing cardGroup.cardID against the existing nonPersonalAndWorkspaceCardList derived value avoids a server-side change and keeps the lookup O(1) per group. Mutating the offending pure helper (getCustomFeedNameFromFeeds) keeps the public signature additive (fundID is optional) so the existing unit tests in tests/unit/CardUtilsTest.ts:1489-1513 and other call sites continue to behave as they do today; only the Spend / grouped-by-card path opts into the scoped behavior. An alternative — embedding fundID directly into SearchCardGroup from the server — was considered but rejected: it requires an API contract change for a bug that is already fully resolvable client-side from data the app already has cached.
When the Spend page groups expenses by card across two workspaces that each have their own connected feed, the feed-name lookup loses the workspace dimension entirely.
Only cardGroup.bank (e.g. "vcf", "amex") is passed — never a domain/policy hint, and SearchCardGroup itself doesn't carry one (SearchResults.ts#L122-L149). That string is forwarded to getCustomFeedNameFromFeeds:
cardFeeds is the SHARED_NVP_PRIVATE_DOMAIN_MEMBER collection — one entry per domain/workspace. The function flattens across every domain and returns the firstcompanyCardNicknames[bank] it hits. So if Workspace A has a Visa feed nicknamed "Marketing Visa" and Workspace B has a Visa feed nicknamed "Engineering Visa", every Visa card group on the Spend page gets whichever nickname appears first in Object.values(cardFeeds) iteration order — exactly the symptom in the report.
The same flat scan also affects doesCardFeedExist, but it returns the right answer because both workspaces share the same bank. The nickname is the only field that genuinely differs per workspace, which is why this is the only visible symptom today.
What changes do you think we should make in order to solve the problem?
The lookup needs to be scoped to the workspace that actually owns the card. The card's domainName is already on Card (Card.ts#L63-L64), and cardList is keyed by cardID, so we can resolve domain → feed entry directly from the cardID we already have on each group.
1. Make getCustomFeedNameFromFeeds accept a domain-scoped lookup.
- function getCustomFeedNameFromFeeds(cardFeeds: OnyxCollection<CardFeeds> | undefined, feed: CompanyCardFeed | undefined): string | undefined {- if (!feed || !cardFeeds) {- return undefined;- }- for (const feedData of Object.values(cardFeeds)) {- const nickname = feedData?.settings?.companyCardNicknames?.[feed];- if (nickname) {- return nickname;- }- }- return undefined;- }+ function getCustomFeedNameFromFeeds(+ cardFeeds: OnyxCollection<CardFeeds> | undefined,+ feed: CompanyCardFeed | undefined,+ domainName?: string,+ ): string | undefined {+ if (!feed || !cardFeeds) {+ return undefined;+ }+ if (domainName) {+ const domainKey = `${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${domainName}`;+ return cardFeeds[domainKey]?.settings?.companyCardNicknames?.[feed];+ }+ for (const feedData of Object.values(cardFeeds)) {+ const nickname = feedData?.settings?.companyCardNicknames?.[feed];+ if (nickname) {+ return nickname;+ }+ }+ return undefined;+ }
2. Plumb the owning domain through getFeedNameForDisplay and resolve it from the cardID at the Spend-page call site.
getFeedNameForDisplay gets a new optional domainName parameter that it forwards to getCustomFeedNameFromFeeds. In getCardSections we already have cardGroup.cardID and access to the card list, so the domain is one lookup away:
getCardSections already takes cardFeeds and customCardNames; adding cardList (or the existing nonPersonalAndWorkspaceCardList derived value) is a minor signature change. If we want to avoid plumbing cardList into SearchUIUtils, an equivalent path is to derive a cardID → domainName map once at the caller and pass that instead — same idea, smaller surface.
When the card isn't found in cardList (e.g. cards removed but with historical transactions), we fall back to the existing flat-scan behavior, so the fix is purely additive — no regression for single-workspace setups.
3. Tests
Unit test for getCustomFeedNameFromFeeds: two domains both have a vcf feed with different companyCardNicknames.vcf; passing domainName returns the matching nickname, no domainName falls back to first-match-wins (existing behavior).
Unit test for getCardSections: synthesize two card groups (different cardIDs, same bank) belonging to two domains with distinct nicknames in cardFeeds; assert each group's formattedFeedName matches its own workspace.
What alternative solutions did you explore? (Optional)
Add domainName/policyID to SearchCardGroup from the backend. Cleaner long-term — the group would carry its own provenance — but it's a server-side schema change requiring coordination, and the fix above is fully client-side using data we already cache.
Strip the domain off bank (e.g. vcf2_12345) and look it up directly. Doesn't apply — cardGroup.bank only carries the un-suffixed bank string ("vcf"), not the domain ID.
Always prefer getBankName(feed) and drop nicknames on the Spend page. Fixes the wrong-nickname symptom but regresses every single-workspace customer who relies on the nickname they configured, so it's a worse trade-off.
[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: this also wasn't implemented initially
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: regression wasn't critical
[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.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Activity
MelvinBot commentedon May 5, 2026
Proposal
What is the root cause of that problem?
getCustomFeedNameFromFeedsiterates over all workspace card feeds and returns the first matching custom nickname for a given feed type (e.g.,vcf). It has no concept of which workspace the card belongs to.On the Spend page,
getCardSectionscallsgetFeedNameForDisplaywith onlycardGroup.bank(the feed type) and the fullcardFeedscollection — nofundIDorpolicyIDis passed. So when two workspaces both have the same feed type with different custom nicknames, whichever nickname is encountered first wins, and the other workspace's cards show the wrong name.What changes do you think we should make in order to solve the problem?
The
SearchCardGrouptype (SearchResults.ts:122-149) already includescardID. We can use this to look up the card's domain/workspace from the existingcardListOnyx data, then scope the nickname lookup to the correct workspace'scardFeedsentry instead of iterating all of them.Specifically:
getCardSections, use thecardIDfrom the card group to find the corresponding card incardList, which containsfundID/domain info.getFeedNameForDisplay(or a new parameter) so it reads the nickname from the correct workspace'scompanyCardNicknamesrather than returning the first match from any workspace.This follows the same correct pattern already used by
getCardFeedsForDisplay, which reads nicknames from the specific domain'scardFeedsobject.What alternative solutions did you explore? (Optional)
An alternative would be to have the backend include
fundIDordomainIDdirectly in theSearchCardGroupresponse, eliminating the need for a client-side reverse lookup. However, this requires a backend change and the client-side approach usingcardID→cardListlookup achieves the same result with data already available.Investigation details
Data flow causing the bug:
SearchCardGroupwithbank(feed type likevcf) andcardID, but no workspace identifierSearchUIUtils.ts:3059callsgetFeedNameForDisplay(translate, cardGroup.bank, cardFeeds, undefined, ...)getFeedNameForDisplaycallsgetCustomFeedNameFromFeeds(cardFeeds, feed)getCustomFeedNameFromFeedsiteratesObject.values(cardFeeds)and returns the first matching nickname — wrong workspace's name may be returnedPossibly related issue: #87280 reports that the card column on reports shows a feed ID string instead of the proper card program name — may share the same underlying nickname resolution issue.
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.melvin-bot commentedon May 5, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak (
External)[-]Feed Name for company card is incorrect when viewing from the Spend page[/-][+][$250] Feed Name for company card is incorrect when viewing from the Spend page[/+]melvin-bot commentedon May 5, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022051709348182698418
KJ21-ENG commentedon May 5, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user has two different company card feeds connected on two different workspaces and views the Spend page (Search grouped by card, e.g. "Card statements" or "Card accruals"), the card-feed name shown above each card group can render the wrong workspace's nickname. The cardholder, last‑four, and amounts are correct — only the human‑readable feed/nickname label is wrong, because it's resolved by scanning every workspace's nicknames and returning the first match instead of the nickname belonging to the workspace that actually owns the card in that group.
What is the root cause of that problem?
The "feed name" label rendered on every card‑grouped row in Search is produced by
getFeedNameForDisplayand resolves the custom nickname viagetCustomFeedNameFromFeeds, which iterates the entirecardFeedsOnyx collection and returns the firstcompanyCardNicknames[feed]match it finds — with no awareness of which workspace owns the card in this group.getCustomFeedNameFromFeedsinsrc/libs/CardUtils.ts:App/src/libs/CardUtils.ts
Lines 762 to 775 in f156c62
cardFeedshere isOnyxCollection<CardFeeds>keyed per workspace/domain (sharedNVP_private_domain_member_<id>), so when two workspaces each have a feed identified by the samefeedkey (e.g. both have avcfVisa feed, or both have feeds where the bank string collides),Object.values(cardFeeds)returns them in arbitrary key order, and the firstcompanyCardNicknames[feed]hit wins regardless of which workspace's card the user is actually looking at.The call site in
getCardSectionsonly forwards the bank and the cardID'sfeedCountry; it never tellsgetFeedNameForDisplaywhich workspace thiscardGroupbelongs to:App/src/libs/SearchUIUtils.ts
Lines 3052 to 3061 in f156c62
SearchCardGroupitself carriescardIDandbankbut nopolicyID/domainID/workspaceAccountID:App/src/types/onyx/SearchResults.ts
Lines 121 to 149 in f156c62
So even though Onyx has enough information to resolve the right workspace (the
cards_<fundID>_<bankName>Onyx keys inWORKSPACE_CARDS_LISTmap every assigned card to the workspace that owns it), the current call discards that link and falls back to first‑match-wins. The previous fix at c293d2e ("Fix feed name on group search") addedfeedCountryto disambiguate Travel‑Invoicing vs the Expensify Card bank, but the cross‑workspace ambiguity for ordinary commercial feeds was not addressed.What changes do you think we should make in order to solve the problem?
Resolve the nickname against the specific workspace that owns the card in the group, instead of the first nickname found across all workspaces.
src/libs/CardUtils.ts, add a helpergetNicknameForCardID(cardID, allWorkspaceCardsLists, cardFeeds, feed)that:WORKSPACE_CARDS_LISTcollection (cards_<workspaceAccountID>_<bankName>) and finds the entry whose values contain a card withcardID === cardID.workspaceAccountIDsegment out of that Onyx key.cardFeeds[<sharedNVP key for that workspaceAccountID/domain>]?.settings?.companyCardNicknames?.[feed]and returns it.undefinedwhen the cardID cannot be located (signed‑out workspace, deleted feed, race during initial load), letting the existing default‑name fallback ingetCustomOrFormattedFeedNameapply.getFeedNameForDisplay(line 781) with an optionalcardID?: numberparameter. WhencardIDis provided andcustomFeedNamewas not, prefer the workspace‑scoped lookup (1) before falling back to the existing globalgetCustomFeedNameFromFeeds. Keep the global fallback so existing call sites (e.g.WorkspaceCompanyCardsTableHeaderButtons,useFilterCardValue) that have no per‑card context continue to behave unchanged.getCardSections(src/libs/SearchUIUtils.tsline 3010), passcardGroup.cardIDtogetFeedNameForDisplay, and also subscribe to theWORKSPACE_CARDS_LISTOnyx collection in thegetSectionscaller chain (it is already loaded elsewhere — pass it throughGetSectionsParamsalongsidecardFeeds).getCustomFeedNameFromFeedsas the global fallback when a cardID is unavailable; do not delete it.Scope boundaries: changes are confined to
src/libs/CardUtils.ts(helper + signature),src/libs/SearchUIUtils.ts(getCardSections+getSectionsplumbing for the new collection prop) and theGetSectionsParamstype. Behavior forgroupBy=cardrendering is the only user‑visible surface affected;getFeedNameForDisplaycallers that don't passcardID(workspace settings pages, advanced filters, feed selector) are unaffected because the workspace‑scoped branch is gated oncardID !== undefined. Cash cards, the Expensify Card bank, and Travel Invoicing keep their existing branches ingetFeedNameForDisplay. No backend/API changes; this is presentation‑only. All platforms benefit (issue is reported on Web/Desktop but the same code renders on every platform).What alternative solutions did you explore? (Optional)
policyID(orworkspaceAccountID) directly toSearchCardGroupserver‑side and use it to indexcardFeedsdirectly. Cleanest long‑term shape, but requires a backend change to the search response and coordinatingsearchResultsversioning, so it's out of scope for a client fix.getCustomFeedNameFromFeedsreturn all matches and reconcile ingetCardSections. Equivalent in effect to the proposed fix but pushes Search‑specific reconciliation into a generic CardUtils helper, which is the wrong layer.cardName+lastFourPANonly (no workspace lookup). Doesn't help: the bug is that the feed nickname (workspace‑scoped) is wrong, not the per‑card label, which is already rendered correctly byformattedCardName.wildan-m commentedon May 5, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
github-actions commentedon May 5, 2026
oqildev commentedon May 5, 2026
Proposal
What is the root cause of that problem?
When the Spend page renders the by-card grouping for Card Statements / Card Accruals, the feed name is resolved by a lookup that does not scope by workspace/policy, so the first matching nickname across all workspaces wins.
Chain (single symptom, but reproduces for every card that lives in a workspace whose feed-key collides with another workspace's feed-key — e.g., two
cdf, twooauth.americanexpressfdx.com, or anything stored at the samecompanyCardNicknameskey in two differentsharedNVP_private_domain_member_*Onyx records):getCardSections()builds the row withformattedFeedName: getFeedNameForDisplay(translate, cardGroup.bank as OnyxTypes.CompanyCardFeed, cardFeeds). It passes onlycardGroup.bank(the feed key) and the collection of feeds across all policies.SearchCardGroup(SearchResults.ts:122-146) carries nofundID/policyIDto disambiguate.getFeedNameForDisplay()callsgetCustomFeedNameFromFeeds(cardFeeds, feed)with no policy context.getCustomFeedNameFromFeeds()iteratesObject.values(cardFeeds)(every workspace'sCardFeedsrecord) and returns the firstfeedData.settings.companyCardNicknames[feed]it finds. Whichever workspace happens to be ordered first in the Onyx collection wins, so a card belonging to workspace B can render workspace A's nickname.doesCardFeedExist()has the same un-scoped iteration, which is fine for the existence check but reinforces the pattern.The Travel-Invoicing fix from c293d2e5080 added
feedCountryto disambiguate Expensify Card programs, but it never addressed the broader two-workspace collision ingetCustomFeedNameFromFeeds.The correct, policy-aware lookup pattern already exists for the Workspaces page in CardFeedUtils.ts:535-567 (
getCardFeedsForDisplayPerPolicy) — it keys nicknames by${fundID}_${feed}derived from the Onyx keysharedNVP_private_domain_member_${fundID}. That disambiguator is what the Spend grouping is missing.What changes do you think we should make in order to solve the problem?
Fix at the data-construction layer in
getCardSections()so each row carries the correct nickname before it reaches the renderer. Two coordinated edits:Carry
fundIDon the card group. IngetCardSections()(SearchUIUtils.ts:2987-3030), resolve the card'sfundIDfrom the flatcardListOnyx key (ONYXKEYS.CARD_LIST→Record<cardID, Card>, whereCard.fundIDalready exists per Card.ts:94). If the backend can also start emittingfundIDonSearchCardGroup, prefer that and use the cardList lookup as a fallback for older payloads.Scope the nickname lookup by
fundID. ExtendgetCustomFeedNameFromFeeds(cardFeeds, feed, fundID?)in CardUtils.ts:738: whenfundIDis provided, read directly fromcardFeeds[${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${fundID}]?.settings?.companyCardNicknames?.[feed]. Only fall back to the existing iterate-all behavior whenfundIDis unknown (e.g., card not yet incardListbecause of partial sync). Thread the samefundIDthroughgetFeedNameForDisplayso it can be passed in fromgetCardSections.Edge cases:
feed === CONST.EXPENSIFY_CARD.BANKshort-circuit at CardUtils.ts:721 and the Travel-Invoicing branch fromc293d2e5080; both run before the nickname resolution.cardList(offline first-load / pagination) — falling back to the current iteration preserves today's behavior; the row will resolve to a deterministic name oncecardListsyncs and the selector recomputes.doesCardFeedExistis fine to leave un-scoped, since "exists in any workspace I can see" is the right semantic for the deleted-feed message; the wrong-name bug is purely about which nickname is returned, not whether one exists.CardFeedsaren't loaded yet — the lookup returnsundefined, the function falls through to the formatted bank name (e.g., "Amex Cards"), which is the same fallback as today and not a regression.What alternative solutions did you explore? (Optional)
bank(e.g., always storeoauth.americanexpressfdx.com 1234instead ofoauth.americanexpressfdx.com). Rejected: the suffix is optional in the type (CardFeeds.ts:10 —CompanyCardFeedWithNumber = CompanyCardFeed | ${CompanyCardFeed}${number}) and existing data already has un-suffixed keys incompanyCardNicknames, so two workspaces withcdf(no number) would still collide.CardListItemHeader.tsx) by re-resolving the name there. Rejected: the row is sorted/filtered byformattedFeedName(SearchUIUtils.ts:318), so the wrong value would already have polluted the sort/group keys before render.getFeedInfo()fromCardFeedUtils.ts:577directly (which builds${fundID}_${feed}IDs). Rejected as the primary fix because it requires the caller to already have builtcardFeedsByPolicy; reusing the underlying scoping logic insidegetCustomFeedNameFromFeedsis a smaller change and keeps a single source of truth for the nickname resolution.fundIDscoping to other call sites ofgetCustomFeedNameFromFeeds/getFeedNameForDisplay(e.g., the search filter chip). Out of scope for this PR — the issue is specifically about the by-card grouping on Spend — but worth a follow-up audit, since the underlying helper is shared.trasnake87 commentedon May 5, 2026
Proposal
The Spend page groups transactions by card and renders a feed name for each group. When two workspaces both have a card feed of the same type (e.g.
vcf) with different custom nicknames, every group on the page can render with the wrong workspace's nickname.Root cause
getCardSectionsbuilds theformattedFeedNameby callinggetFeedNameForDisplaywith only the feed type (cardGroup.bank) and the entirecardFeedscollection — there is no scoping to the workspace the card actually belongs to (src/libs/SearchUIUtils.ts:3052):getFeedNameForDisplaythen delegates the nickname resolution togetCustomFeedNameFromFeeds, which iterates everysharedNVP_private_domain_member_<fundID>entry in the collection and returns whichever nickname comes first (src/libs/CardUtils.ts:762-775):Object.values(cardFeeds)ordering is not stable across the two workspaces' domain keys, so the function returns the nickname of the first workspace whosesettings.companyCardNicknames[feed]is truthy — and that nickname is then applied to every card group of that bank, including cards that belong to the other workspace. That is exactly the behavior the reporter is seeing on the Spend page.The correct way to look up a custom feed nickname is the one already used in
getCardFeedsForDisplay(src/libs/CardFeedUtils.ts:548-568), which derives the workspace-specificfundIDfrom the domain key and indexes that workspace's nicknames directly:SearchCardGroup(src/types/onyx/SearchResults.ts:122-149) already carriescardID, and theCardmodel carriesfundID(src/types/onyx/Card.ts:94). The mergednonPersonalAndWorkspaceCardListderived value (src/libs/actions/OnyxDerived/configs/nonPersonalAndWorkspaceCardList.ts) is keyed bycardID, so the workspace can be resolved from the card group with one O(1) lookup.Search/index.tsx:327already loads it but never passes it down.Proposed fix
1 — Make
getCustomFeedNameFromFeedsandgetFeedNameForDisplayworkspace-aware. Add an optionalfundID. When provided, scope the nickname lookup to the matchingsharedNVP_private_domain_member_<fundID>entry; otherwise keep the existing fallback so unrelated callers are unaffected.2 — Resolve the card's
fundIDinsidegetCardSectionsand pass it through. Accept the merged card list as a parameter and look upcardGroup.cardID:Then forward
allCardsfrom thegetSectionsswitch:3 — Wire the merged card list in at the call sites.
Search/index.tsxalready has it on hand (src/components/Search/index.tsx:327), so just thread it into thegetSectionscall (line 527) and the inner enrichment call (line 608):Do the same in
useSearchSections.ts:65anduseSpendOverTimeData.ts:91(readONYXKEYS.DERIVED.NON_PERSONAL_AND_WORKSPACE_CARD_LISTand pass it through). Mirror the change in anyTransactionGroupListItem/SearchStaticListpath (src/components/Search/SearchList/ListItem/TransactionGroupListItem.tsx:134,src/components/Search/SearchStaticList.tsx:91) so feed names stay consistent across the entry points.Why this approach
It mirrors the precedent in
getCardFeedsForDisplay(src/libs/CardFeedUtils.ts:563-568) andgetCombinedCardFeedsFromAllFeeds(src/libs/CardFeedUtils.ts:657-670), both of which scopecompanyCardNicknameslookup to the card's specific domain key — so the codebase already considers domain scoping the canonical pattern; the Spend grouping path simply skipped it. ReusingcardGroup.cardIDagainst the existingnonPersonalAndWorkspaceCardListderived value avoids a server-side change and keeps the lookup O(1) per group. Mutating the offending pure helper (getCustomFeedNameFromFeeds) keeps the public signature additive (fundIDis optional) so the existing unit tests intests/unit/CardUtilsTest.ts:1489-1513and other call sites continue to behave as they do today; only the Spend / grouped-by-card path opts into the scoped behavior. An alternative — embeddingfundIDdirectly intoSearchCardGroupfrom the server — was considered but rejected: it requires an API contract change for a bug that is already fully resolvable client-side from data the app already has cached.yusufdeveloper2903 commentedon May 5, 2026
Proposal
What is the root cause of that problem?
When the Spend page groups expenses by card across two workspaces that each have their own connected feed, the feed-name lookup loses the workspace dimension entirely.
In
SearchUIUtils.ts#L3045-L3054we resolveformattedFeedNamelike this:Only
cardGroup.bank(e.g."vcf","amex") is passed — never a domain/policy hint, andSearchCardGroupitself doesn't carry one (SearchResults.ts#L122-L149). That string is forwarded togetCustomFeedNameFromFeeds:cardFeedsis theSHARED_NVP_PRIVATE_DOMAIN_MEMBERcollection — one entry per domain/workspace. The function flattens across every domain and returns the firstcompanyCardNicknames[bank]it hits. So if Workspace A has a Visa feed nicknamed "Marketing Visa" and Workspace B has a Visa feed nicknamed "Engineering Visa", every Visa card group on the Spend page gets whichever nickname appears first inObject.values(cardFeeds)iteration order — exactly the symptom in the report.The same flat scan also affects
doesCardFeedExist, but it returns the right answer because both workspaces share the samebank. The nickname is the only field that genuinely differs per workspace, which is why this is the only visible symptom today.What changes do you think we should make in order to solve the problem?
The lookup needs to be scoped to the workspace that actually owns the card. The card's
domainNameis already onCard(Card.ts#L63-L64), andcardListis keyed bycardID, so we can resolve domain → feed entry directly from thecardIDwe already have on each group.1. Make
getCustomFeedNameFromFeedsaccept a domain-scoped lookup.2. Plumb the owning domain through
getFeedNameForDisplayand resolve it from the cardID at the Spend-page call site.getFeedNameForDisplaygets a new optionaldomainNameparameter that it forwards togetCustomFeedNameFromFeeds. IngetCardSectionswe already havecardGroup.cardIDand access to the card list, so the domain is one lookup away:getCardSectionsalready takescardFeedsandcustomCardNames; addingcardList(or the existingnonPersonalAndWorkspaceCardListderived value) is a minor signature change. If we want to avoid plumbingcardListintoSearchUIUtils, an equivalent path is to derive acardID → domainNamemap once at the caller and pass that instead — same idea, smaller surface.When the card isn't found in
cardList(e.g. cards removed but with historical transactions), we fall back to the existing flat-scan behavior, so the fix is purely additive — no regression for single-workspace setups.3. Tests
getCustomFeedNameFromFeeds: two domains both have avcffeed with differentcompanyCardNicknames.vcf; passingdomainNamereturns the matching nickname, nodomainNamefalls back to first-match-wins (existing behavior).getCardSections: synthesize two card groups (different cardIDs, same bank) belonging to two domains with distinct nicknames incardFeeds; assert each group'sformattedFeedNamematches its own workspace.What alternative solutions did you explore? (Optional)
domainName/policyIDtoSearchCardGroupfrom the backend. Cleaner long-term — the group would carry its own provenance — but it's a server-side schema change requiring coordination, and the fix above is fully client-side using data we already cache.bank(e.g.vcf2_12345) and look it up directly. Doesn't apply —cardGroup.bankonly carries the un-suffixed bank string ("vcf"), not the domain ID.getBankName(feed)and drop nicknames on the Spend page. Fixes the wrong-nickname symptom but regresses every single-workspace customer who relies on the nickname they configured, so it's a worse trade-off.35 remaining items
melvin-bot commentedon Jun 2, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Jun 2, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Jun 3, 2026
Payment Summary
Contributor+: @eVoloshchak due $250 via NewDot
@eVoloshchak plz complete the BZ checklist and tag me in a post once you have. Thx
eVoloshchak commentedon Jun 8, 2026
BugZero 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: this also wasn't implemented initially
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: regression wasn't critical
[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.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/646589
Regression Test Proposal
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-b952-a7c5-e361-fcd607f64924eVoloshchak commentedon Jun 8, 2026
@mallenexpensify, checklist above completed. Thx!
JmillsExpensify commentedon Aug 3, 2026
$250 approved for @eVoloshchak