App icon indicating copy to clipboard operation
App copied to clipboard

[Due for payment 2026-11-19] [$175] Regression: Individual card error incorrectly triggers feed-wide broken connection warning

Open melvin-bot[bot] opened this issue 3 weeks ago • 24 comments

An individual card returning error 434 (“Account not found”) can trigger a feed-wide broken connection warning while other cards continue syncing.

Expected: Identify the affected card without labeling the entire feed as broken. Preserve feed-wide warnings for actual connection failures.

Reported regression: #84803 excluded 434 from feed-level warnings. #100277 reintroduced this behavior while improving inactive-card messaging.

Verification: Test a feed containing healthy cards and one card returning 434. Confirm that the warning identifies the affected card and that genuine feed-wide failures still display correctly.

Reported in slack

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mallenexpensify

melvin-bot[bot] avatar Nov 04 '26 16:11 melvin-bot[bot]

Triggered auto assignment to Contributor-plus team member for initial proposal review - @linhvovan29546 (External)

melvin-bot[bot] avatar Nov 04 '26 16:11 melvin-bot[bot]

Job added to Upwork: https://www.upwork.com/jobs/~022118022057213909128

melvin-bot[bot] avatar Nov 04 '26 16:11 melvin-bot[bot]

@MelvinBot please draft a proposal for this issue using Expensify's standard process.

joekaufmanexpensify avatar Nov 04 '26 16:11 joekaufmanexpensify

Proposal

What is the root cause of that problem?

The feed banner treats an individual card issue as a broken feed connection. Error 434 remains excluded from isFeedConnectionBroken, but the banner also checks hasFeedConnectionIssue, which includes 434.

Code evidence

CardUtils.ts:1702–1726 distinguishes the two classifications. cardFeedErrors.ts:153–161 aggregates them separately. getShouldShowBrokenConnectionError.ts:14–16 combines them again, causing the false warning.

What changes do you think we should make in order to solve the problem?

  • Show the banner for isFeedConnectionBroken on direct feeds, or explicit hasFeedErrors. Remove hasFeedConnectionIssue from this decision.
  • Preserve affected-card errors and Wallet inactive messaging. Leave the shared card-issue classifier unchanged.
  • Add regression coverage: healthy card plus 434 shows no feed banner but retains the affected card’s error. Genuine connection failures and explicit feed errors must still show the applicable warning.
Tests and scope

Update the existing test expecting the incorrect banner. Cover dismissed card errors and preserve direct/commercial-feed behavior. Card-row errors already render separately in WorkspaceCompanyCardsTable/index.tsx:281–328.

Code review only; no tests executed.


Next Steps for Contributor+ team: To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/105932) to create a draft PR. To refine: @MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.


view run

MelvinBot avatar Nov 04 '26 16:11 MelvinBot

Proposal

Please re-state the problem that we are trying to solve in this issue.

On a direct (OAuth/Plaid) company card feed, when one card returns scrape status 434 ("Account not found"), the Company Cards page shows the red banner "Card feed connection is broken. Please log into your bank…" even though the other cards keep syncing. The banner says the whole feed is broken, and it doesn't point at the affected card. Real feed-wide failures must keep their banner.

What is the root cause of that problem?

One yes/no check mixes two different situations, and the banner has only one message for both.

  1. One boolean for two signals. getShouldShowBrokenConnectionError computes isFeedConnectionBroken || hasFeedConnectionIssue. The first means the feed's connection is really broken. The second is true when any single card has an "actionable" status, and 434 is the only status in that list (actionableIgnoredScrapeStatuses in CONST).
  2. One message for both. WorkspaceCompanyCardsTableHeaderButtons.tsx always shows workspace.companyCards.brokenConnectionError ("Card feed connection is broken…") when that boolean is true. So a single 434 card labels the whole feed as broken.
  3. The 434 case was added on purpose. hasCardConnectionIssue adds 434 to the broken check so a 434 card doesn't read as "Active", and Wallet sends an admin to this page with "Fix connection in Company cards" (getCardConnectionStatusDisplay, shouldUseCompanyCardsLink). The existing test at lines 50-62 says "the page has to offer the fix". The banner's "log into your bank" link is the only place on this page that offers it.

So the regression is the wrong message and scope, not the fact that 434 shows something. Removing 434 from the banner entirely would leave an admin who followed Wallet's link with nothing to do.

What changes do you think we should make in order to solve the problem?

Keep the fix, but stop calling it a feed failure:

  1. In getShouldShowBrokenConnectionError.ts, return which kind of message to show, not just true or false. For example getBrokenConnectionErrorType(feedName, feedErrors):
    • 'feed' when the feed has errors, or a direct feed has isFeedConnectionBroken. This is today's behavior.
    • 'card' when a direct feed has only hasFeedConnectionIssue (for example 434).
    • undefined otherwise, including commercial and CSV feeds, same as today.
  2. In WorkspaceCompanyCardsTableHeaderButtons.tsx, keep the current message for 'feed'. For 'card', show a card-scoped message with the same "log into your bank" link and the same openBankConnection action. Suggested wording: "One or more cards need attention. Please log into your bank so we can update them." The exact copy is open to the reviewer. Add the new string to en.ts and the other language files, following the repo's translation process.
  3. The affected card is identified in its own row. The table already shows a card's own error on its row whenever the feed isn't prompting a broken connection, which is the case for 434. So the user sees which card, and the banner no longer says the feed is broken.

Nothing changes in hasCardConnectionIssue, isCardConnectionBroken, the derived cardFeedErrors value, Wallet, or personal cards.

What alternative solutions did you explore? (Optional)

  • Remove hasFeedConnectionIssue from the banner decision. This is the simplest change, and it stops the false "feed is broken" message. But it removes the only reconnect link for a 434 card, even though Wallet sends admins to this page to use it. It also means deleting a test that records intended behavior, so I'd rather not undo that choice silently.
  • Name the card inside the banner. This needs per-card data added to the derived cardFeedErrors value and its type. That is a heavier change, and the row error already identifies the card. It could follow up if reviewers want it.
  • Change which statuses count as an issue (hasCardConnectionIssue). This would bring back the "Active" label on a card that needs action.

Automated Tests

  • Unit tests in tests/unit/components/Tables/WorkspaceCompanyCardsTable/getShouldShowBrokenConnectionErrorTest.ts, updating the 434 cases:
    • A direct feed with only hasFeedConnectionIssue returns 'card', not 'feed'.
    • A broken direct feed returns 'feed', and so does a feed with one broken card and one 434 card.
    • A feed with hasFeedErrors returns 'feed' on any feed type.
    • A commercial or CSV feed with only 434 returns undefined, and no errors returns undefined.
  • UI test in tests/ui/WorkspaceCompanyCardsTableHeaderButtonsTest.tsx:
    • A feed with only a 434 card shows the card-scoped message and not "Card feed connection is broken", and its link still opens the bank connection.
    • A feed with isFeedConnectionBroken still shows the original message.

I did not run this against a real 434 card, because that needs a live bank feed. The analysis is from reading the code at commit 3c98f25.

Contributor details Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01b64b281fe1263953

Aschio12 avatar Nov 04 '26 17:11 Aschio12

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Nov 04 '26 17:11 melvin-bot[bot]

Proposal

Please re-state the problem that we are trying to solve in this issue.

A card returning error 434 (“Account not found”) can cause the workspace to display a broken connection warning for its entire feed while other cards continue syncing. The affected card must remain identifiable, and genuine feed connection failures must retain their warnings.

Audit verdict: refine MelvinBot’s proposal. Its diagnosis is plausible, but neither the supplied proposal nor this review provides executed regression evidence. This is a reported UI classification regression; no security impact is demonstrated.

What is the root cause of that problem?

According to the supplied proposal, error 434 is excluded from isFeedConnectionBroken but included in hasFeedConnectionIssue. The banner then accepts either classification, promoting a card issue into a feed warning.

The supplied references identify:

Verification limitation: these are supplied references, not independently verified source findings. GitHub retrieval failed, and the workspace contains no Expensify checkout. The attribution to #100277 and the exact current implementation therefore remain unverified.

What changes do you think we should make in order to solve the problem?

Subject to confirming the source, complement MelvinBot’s approach: remove hasFeedConnectionIssue from the banner decision while preserving the existing direct-feed restriction and independent hasFeedErrors branch.

The intended Boolean rule is:

(isDirectFeed && isFeedConnectionBroken) || hasFeedErrors

Here, isDirectFeed describes the existing direct-feed predicate; it is not a verified repository identifier. This is the proposed decision rule, not an apply-ready diff. Providing an exact TypeScript diff without retrieving the implementation would fabricate source context.

Keep the production change confined to the banner helper. Preserve shared classification, card-row error rendering, and Wallet inactive-card messaging.

Before accepting that change, verify two conditions:

  1. hasFeedErrors is not itself populated by the same card-level 434; otherwise its independent branch can preserve the false warning.
  2. Every genuine connection failure currently represented by hasFeedConnectionIssue is also represented by isFeedConnectionBroken or explicit feed errors; otherwise removing the broader flag can suppress legitimate warnings.

Neither condition is proven by the supplied text.

What alternative solutions did you explore? (Optional)

MelvinBot’s patch direction is reasonable; its validation is incomplete. There is no evidence supporting a claim that a competing implementation is uniquely safe.

The material gaps are:

  • Changing the existing banner expectation only tests the final decision. It does not prove that actual card data produces the correct derived flags.
  • Suppressing the banner does not prove that the affected card remains identifiable.
  • Removing an entire classification requires coverage of genuine failures represented by that classification.
  • Dismissal behavior needs explicit assertions; merely listing dismissed errors as coverage is insufficient.

Removing 434 from the shared issue classifier would broaden the change and could affect the inactive-card behavior described in the proposal. Filtering all feed errors whenever any card has 434 would also be incorrect: a card issue and a genuine feed failure can coexist.

What automated tests can you add to prevent this from re-occurring?

Update the supplied helper test location:

tests/unit/components/Tables/WorkspaceCompanyCardsTable/getShouldShowBrokenConnectionErrorTest.ts, lines 50–55.

Use explicit Jest cases covering:

Case Required assertion
Direct feed, issue flag only, no broken flag or explicit feed errors Banner absent
Direct feed with genuine broken connection Banner present
Direct feed with broken connection and issue flag Banner present
Explicit feed errors with either feed type Applicable feed warning remains
Commercial feed with only the direct-feed broken flag Existing direct-feed restriction remains
No errors Banner absent

Add a regression test using the real derived configuration and a feed containing one healthy card and one card with 434. Assert that the banner is absent, the affected card displays its applicable message, and the healthy card remains unaffected. Repeat with reversed card order and with a simultaneous genuine feed failure. Cover dismissal using the repository’s actual dismissal fields and established behavior.

The regression must fail against the original implementation and pass after the patch. Restoring the removed banner operand must make it fail again.

Execution status: no application tests were executed. Exact repository-compatible Jest code, a verified diff, and production readiness cannot honestly be certified without the helper signature, fixtures, and source checkout.

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~01b60d704ba377be83

camesenin avatar Nov 04 '26 18:11 camesenin

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Nov 04 '26 18:11 melvin-bot[bot]

Problem: On a direct (OAuth/Plaid) company card feed, one card returning scrape status 434 ("Account not found") makes the Company Cards page show the feed-wide red banner "Card feed connection is broken. Please log into your bank…", even though the other cards keep syncing. The issue asks for the affected card to be identified without labelling the whole feed as broken, and for genuine feed-wide failures to keep their warning.

Root cause: Two different signals are collapsed into one boolean in getShouldShowBrokenConnectionError.ts (isFeedConnectionBroken || hasFeedConnectionIssue). The first means the feed connection itself is broken; the second is true when any single card has an actionable status, and 434 is the only status in that list (ACTIONABLE_IGNORED_SCRAPE_STATUSES in CONST). PR #100277 wired that per-card signal into the feed-level derived state (cardFeedErrors.ts sets hasFeedConnectionIssue from hasCardConnectionIssue(card)), so a single 434 card flips the feed-wide banner. The 434 exclusion from #84803 still holds at the card level (isCardConnectionBroken returns false for 434), which is why the card row itself renders its own error correctly while the banner mislabels the feed.

Fix: Keep the two signals separate all the way to the banner, and make the card case name the card — this is the part the existing proposals leave out (Aschio12's proposal defers naming the card as a follow-up; the others drop the card case from the banner entirely, which also drops the only reconnect link Wallet sends admins here to use):

  1. In cardFeedErrors.ts, carry the affected cards alongside the flag: when aggregating a feed's errors, collect the cards whose hasCardConnectionIssue is true (their card names / last-4 identifiers) into the derived CardFeedErrorState, instead of reducing them to a bare boolean.
  2. In getShouldShowBrokenConnectionError.ts, return a result type, not a boolean: 'feed' when the feed has errors or a direct feed has isFeedConnectionBroken (today's behaviour, unchanged message), 'card' with the affected-card list when a direct feed has only hasFeedConnectionIssue (e.g. only 434 cards), and undefined otherwise (including commercial and CSV feeds, same as today).
  3. In WorkspaceCompanyCardsTableHeaderButtons.tsx, keep the current "Card feed connection is broken…" message for 'feed'. For 'card', render a card-scoped banner naming the affected card(s) — e.g. "Card ending in XXXX needs attention. Please log into your bank so we can update it." — with the same openBankConnection link, so an admin arriving from Wallet's "Fix connection in Company cards" link still has exactly one thing to do, and the banner itself identifies the card instead of relying only on the row error below it.
  4. Change nothing in hasCardConnectionIssue, isCardConnectionBroken, the Wallet inactive-card messaging, or personal cards, so a 434 card still reads as needing action (not "Active") everywhere else.

Verification: Feed with healthy cards plus one 434 card shows the named-card banner, not the feed-broken message, and the card row still shows its own error; a feed with a genuine connection failure still shows the original feed-broken banner; a feed with one broken card plus one 434 card still shows the feed banner. Update getShouldShowBrokenConnectionErrorTest.ts (434-only returns 'card' with the card list; broken-feed cases return 'feed'; commercial/CSV 434-only returns undefined) and add a header-buttons UI test for the named-card banner and its bank link. I could not reproduce against a live 434 bank card (needs a live bank feed); the analysis is from the code at commit 3c98f25 and the existing proposals on this issue.

khizzcr7 avatar Nov 04 '26 18:11 khizzcr7

MelvinBot's proposal LGTM!

🎀 👀 🎀 C+ reviewed

linhvovan29546 avatar Nov 05 '26 04:11 linhvovan29546

Triggered auto assignment to @JS00001, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] avatar Nov 05 '26 04:11 melvin-bot[bot]

Lets do it @linhvovan29546

JS00001 avatar Nov 05 '26 12:11 JS00001

@MelvinBot implement this

linhvovan29546 avatar Nov 05 '26 13:11 linhvovan29546

🤖 Web test steps verification results: ⚠️ partial

Blocked on dev NewDot web: the supplied account has no workspaces or company-card feed fixtures. No bank failure was simulated.

Workspaces empty state; company-card feed fixture unavailable
Step Status
Healthy cards plus one 434 card do not trigger a feed-wide broken connection bannerNot verified: Workspaces displays “No workspaces yet.” The required mixed-health feed is unavailable.
Workspaces empty state; company-card feed fixture unavailable
❌
Affected card retains card-specific error/inactive messagingNot verified: no card with error 434 is available.
❌
Genuine feed connection failures still show the warningNot verified: no genuine failed-connection feed is available.
❌

Implemented the approved fix in Keep individual card errors out of feed-wide connection warning, verified as a draft, assigned to linhvovan29546, with PullerBear review requested.

Automated checks: 680 targeted tests, lint, typecheck, spelling, and Storybook smoke checks passed. Restoring the old condition makes nine regression cases fail. Full Jest timed out after ten minutes; the formatting check was unavailable because the legacy script is missing and direct formatter commands were denied.

Please complete live-feed verification before marking the draft ready for review, or ask me to mark it ready once verification is complete.


view run · no recording available

MelvinBot avatar Nov 05 '26 14:11 MelvinBot

Proposal

Please re-state the problem that we are trying to solve in this issue.

On a direct (OAuth/Plaid) company card feed, when a single card returns scrape status 434 ("Account not found") while other cards on the same feed continue syncing normally, the Workspace Company Cards page displays a feed-wide red error banner ("Card feed connection is broken. Please log into your bank...") instead of scoping the warning to the affected card.

What is the root cause of that problem?

In src/libs/CardUtils.ts (lines 1702–1726), error 434 (CONST.COMPANY_CARD.ACTIONABLE_IGNORED_SCRAPE_STATUSES) is intentionally excluded from isFeedConnectionBroken (which represents a true feed-level connection failure) and is instead tracked via hasFeedConnectionIssue in src/libs/actions/OnyxDerived/configs/cardFeedErrors.ts (lines 153–161).

However, PR #100277 updated getShouldShowBrokenConnectionError in src/components/Tables/WorkspaceCompanyCardsTable/getShouldShowBrokenConnectionError.ts (lines 14–16) to return Boolean(feedErrors?.isFeedConnectionBroken || feedErrors?.hasFeedConnectionIssue). Because WorkspaceCompanyCardsFeedAddedEmptyPage and WorkspaceCompanyCardsTable use getShouldShowBrokenConnectionError to render the feed-wide "Card feed connection is broken" banner, a single card with status 434 sets hasFeedConnectionIssue: true on the feed and triggers the feed-wide broken connection warning even when isFeedConnectionBroken is false.

What changes do you think we should make in order to solve the problem?

  1. In src/components/Tables/WorkspaceCompanyCardsTable/getShouldShowBrokenConnectionError.ts (lines 14–16), only return true for the feed-wide broken connection banner when feedErrors?.isFeedConnectionBroken is true (do not conflate per-card hasFeedConnectionIssue with isFeedConnectionBroken).
  2. Ensure per-card status 434 continues to display its card-level indicator/message on the affected card row (WorkspaceCompanyCardsTableRow / card details page) and RBR indicator where appropriate without labeling the entire feed connection as broken.

What alternative solutions did you explore? (Optional)

We considered removing 434 from ACTIONABLE_IGNORED_SCRAPE_STATUSES, but 434 still needs to be surfaced on the specific affected card so admins know that individual card account was not found; separating the feed-wide banner check (isFeedConnectionBroken) from the per-card actionable status check (hasFeedConnectionIssue) preserves both requirements.

jeffrey-graham avatar Nov 07 '26 08:11 jeffrey-graham

📣 @jeffrey-graham! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

melvin-bot[bot] avatar Nov 07 '26 08:11 melvin-bot[bot]

The PR is under review and waiting to be merged.

linhvovan29546 avatar Nov 10 '26 07:11 linhvovan29546

@linhvovan29546

The solution for this issue has been :rocket: deployed to production :rocket: in version 9.5.36-0 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

  • https://github.com/Expensify/App/pull/106104

If no regressions arise, payment will be issued on 2026-11-19. :confetti_ball:

The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ 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[bot] avatar Nov 12 '26 08:11 melvin-bot[bot]

BugZero Checklist

  • [x] [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

    Link to comment: https://github.com/Expensify/App/pull/100277/changes#r4551359341

  • [x] [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: N/A

  • [x] [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:

Regression Test Proposal

A 434 card cannot be produced, so the steps use the mock data script from the PR.

  1. Create a workspace, enable Company cards in More features, and open Workspaces > the workspace > Company cards.

  2. In the browser console, run the script below. It adds a direct Chase feed with a healthy card (…1111) and a 434 card (…4340):

    const policyID = location.pathname.split('/')[2];
    const wsID = (await Onyx.get(`policy_${policyID}`)).policyAccountID;
    const {accountID} = await Onyx.get('session');
    const feed = 'oauth.chase.com';
    const cardsKey = `cards_${wsID}_${feed}`;
    const card = (id, last4, status, errors) => ({cardID: id, bank: feed, fundID: String(wsID), accountID, state: 3, cardName: `CARD...${last4}`, encryptedCardNumber: `CARD...${last4}`, lastFourPAN: last4, lastScrapeResult: status, errors});
    
    await Onyx.merge('network', {shouldForceOffline: true});
    await Onyx.merge(`sharedNVP_private_domain_member_${wsID}`, {settings: {companyCards: {[feed]: {pending: false}}, oAuthAccountDetails: {[feed]: {accountList: ['CARD...1111', 'CARD...4340']}}, cardFeedsStatus: null}});
    await Onyx.set(cardsKey, {1: card(1, '1111', 200), 2: card(2, '4340', 434, {connectionError: "There's an issue with this card's connection, which may result in you not seeing transactions. Log into your bank on your company cards page to restore card imports."})});
    await Onyx.merge(`lastSelectedFeed_${policyID}`, `${feed}#${wsID}`);
    
  3. Verify that there is no "Card feed connection is broken" banner.

  4. Verify that card …4340 shows its own row error: "There's an issue with this card's connection…".

  5. In the same console session, run Onyx.merge(cardsKey, {2: {lastScrapeResult: 403}}) to simulate a real feed failure.

  6. Verify that the "Card feed connection is broken" banner appears.

  7. Run Onyx.merge(cardsKey, {3: card(3, '5555', 434)}) to add a second 434 card alongside the 403 card.

  8. Verify that the banner still appears.

  9. Run Onyx.merge(cardsKey, {2: {lastScrapeResult: 200, errors: null}, 3: null}) so all cards are healthy.

  10. Verify that there is no banner and no row errors.

  11. Run Onyx.merge('network', {shouldForceOffline: false}) to restore the network. "Couldn't load this feed" is expected here because the feed is mock data.

  12. Verify that a feed with only a 434 card never shows the "Card feed connection is broken" banner (steps 3 and 4), which is where the bug showed it.

Do we agree 👍 or 👎.

linhvovan29546 avatar Nov 12 '26 13:11 linhvovan29546

Triggered auto assignment to @mallenexpensify (Awaiting Payment)