Skip to content

Fix duplicate broken company card feed time-sensitive tasks#93406

Merged
youssef-lr merged 4 commits into
mainfrom
fix/dedupe-broken-company-card-feed-tasks
Jun 16, 2026
Merged

Fix duplicate broken company card feed time-sensitive tasks#93406
youssef-lr merged 4 commits into
mainfrom
fix/dedupe-broken-company-card-feed-tasks

Conversation

@mountiny

@mountiny mountiny commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

The Home Time sensitive section was showing one Fix company card connection task per broken assigned card, producing duplicate identical rows for the same feed. It also surfaced tasks for commercial feeds (VCF/CDF), which are file-based and not user-fixable via bank login.

This change:

  • Deduplicates broken company card connections by feed (feedNameWithDomainID)
  • Limits tasks to direct OAuth/Plaid feeds only (isDirectFeed)
  • Extracts selection logic into getBrokenDirectCompanyCardFeedsForAdmin with unit tests

Fixed Issues

$ #93187
PROPOSAL:

Tests

  1. Run unit tests: npm run test -- --testPathPattern=getBrokenDirectCompanyCardFeedsForAdminTest
  2. Log in as a workspace admin with a broken direct OAuth/Plaid company card feed and multiple assigned cards with failed lastScrapeResult
  3. Open HomeTime sensitive
  4. Verify only one "Fix {feedName} company card connection" task appears for that feed
  5. Repeat with a broken commercial feed (e.g. VCF Visa) and verify no fix task appears
  • Verify that no errors appear in the JS console

Offline tests

Same as Tests — broken feed tasks should render from existing Onyx card data without requiring network.

QA Steps

  1. Log in as a workspace admin on an account with a broken direct company card feed (OAuth/Plaid) and multiple assigned cards on that feed
  2. Go to Home and check the Time sensitive section
  3. Confirm only one Fix company card connection task appears for that feed (not one per card)
  4. If available, verify a workspace with a broken commercial feed (VCF/CDF) does not show a fix task in Time sensitive
  5. Tap Fix and confirm navigation to Workspaces > Company cards works
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

Made with Cursor

Show at most one Fix company card connection task per broken direct OAuth/Plaid feed and exclude commercial feeds that are not user-fixable via bank login.

Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/pages/home/TimeSensitiveSection/index.tsx 75.32% <100.00%> (+4.39%) ⬆️
...n/hooks/useBrokenDirectCompanyCardFeedsForAdmin.ts 94.44% <94.44%> (ø)
... and 34 files with indirect coverage changes

mountiny and others added 3 commits June 12, 2026 12:27
Convert to a hook under TimeSensitiveSection/hooks and fix test lint/typing.

Co-authored-by: Cursor <cursoragent@cursor.com>
Reset submodule pointer to match main; unrelated to broken feed task fix.

Co-authored-by: Cursor <cursoragent@cursor.com>
…sForAdmin

Co-authored-by: Cursor <cursoragent@cursor.com>
@mountiny mountiny requested a review from Copilot June 12, 2026 11:33
@mountiny

Copy link
Copy Markdown
Contributor Author

@codex review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes duplicated “Fix company card connection” tasks in the Home Time sensitive section by grouping broken company card connections at the feed level (instead of per-card) and excluding non-fixable commercial feeds, aligning the UI behavior with the intended “one task per broken direct feed” experience for workspace admins.

Changes:

  • Deduplicates broken company card connection tasks by feedNameWithDomainID (feed key).
  • Filters to only show tasks for direct (OAuth/Plaid) feeds via isDirectFeed.
  • Extracts the selection logic into a dedicated hook and adds unit tests.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/pages/home/TimeSensitiveSection/index.tsx Uses the new hook and updates the rendered task keys to dedupe by feed.
src/pages/home/TimeSensitiveSection/hooks/useBrokenDirectCompanyCardFeedsForAdmin.ts New hook that filters to direct feeds, maps cards to admin policies, and dedupes by feed key.
tests/unit/hooks/useBrokenDirectCompanyCardFeedsForAdmin.test.ts Adds unit coverage for dedupe behavior, direct-vs-commercial filtering, and missing-policy cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/pages/home/TimeSensitiveSection/index.tsx
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: e455a6ab2b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@mountiny mountiny requested a review from ikevin127 June 12, 2026 11:52
@mountiny mountiny marked this pull request as ready for review June 12, 2026 12:31
@mountiny mountiny requested review from a team as code owners June 12, 2026 12:31
@melvin-bot melvin-bot Bot requested review from joekaufmanexpensify and youssef-lr and removed request for a team June 12, 2026 12:31
@melvin-bot

melvin-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown

@youssef-lr Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@joekaufmanexpensify joekaufmanexpensify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change is good for product 👍

@ikevin127

This comment was marked as resolved.

@ikevin127

ikevin127 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Screen.Recording.2026-06-15.at.18.43.09.mov

@ikevin127

Copy link
Copy Markdown
Contributor

@mountiny Mind triggering an web-only adhoc build here so @PedroEspinoza1999 can verify the fix ? Thanks!

@youssef-lr

Copy link
Copy Markdown
Contributor

Done @ikevin127

@github-actions

Copy link
Copy Markdown
Contributor

🚧 @youssef-lr has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

This comment has been minimized.

@ikevin127 ikevin127 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 LGTM

Since I cannot easily reproduce the BE error, I tested locally by modifying Onyx state in browser console with:

Onyx.merge('cardList', {
    'cardID': {
        lastScrapeResult: 403,
    }
});

did this for 2 different cards and verified that there's no duplicate error in Home > Time sensitive section.

I asked for others to verify using the above-generated adhoc build via Slack in case double-checking is needed before merging ✅

@youssef-lr youssef-lr merged commit df4b807 into main Jun 16, 2026
41 of 44 checks passed
@youssef-lr youssef-lr deleted the fix/dedupe-broken-company-card-feed-tasks branch June 16, 2026 19:46
@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

Copy link
Copy Markdown
Contributor

🚧 @youssef-lr has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/youssef-lr in version: 9.4.10-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@MelvinBot

Copy link
Copy Markdown
Contributor

Help site review — no changes required

I reviewed this PR against docs/articles and concluded no help site updates are required. I did not open a draft docs PR.

What this PR changes (user-facing):

  • Deduplicates broken company card tasks in Home → Time sensitive to one Fix company card connection task per feed (instead of one per assigned card).
  • Restricts those tasks to direct OAuth/Plaid feeds; commercial feeds (VCF/CDF) no longer surface a fix task there.

Why the docs already hold:

  • Fix-a-Broken-Company-Card-Feed-Connection.md describes the Time Sensitive alert and the bank-login reconnection flow. That flow only applies to direct feeds, so scoping the task to direct feeds makes the product match what this article already implies — commercial feeds were never fixable via this bank-login flow.
  • Set-up-a-Direct-Company-Card-Feed-Connection.md says a broken feed can be fixed "from the Time Sensitive section on Home" — this is in the direct-feed article and remains accurate.
  • Expensify-Home-Overview.md frames the Time-sensitive alert as a "broken bank or accounting connection due to expired or invalid credentials" — i.e. credential-based (direct) feeds, which still matches.

None of the articles document a one-task-per-card behavior, so the dedup change contradicts nothing. The feed-type scoping aligns the product with the existing (direct-feed-oriented) help content rather than introducing a new user-facing concept.

If you'd prefer an explicit clarification — e.g. a sentence in the broken-connection article stating the Time Sensitive fix task surfaces for direct (OAuth/Plaid) feeds only — I'm happy to open a draft docs PR for that. Just let me know.

@mountiny, please confirm whether you agree no help site changes are required, or reply if you'd like the explicit clarification above and I'll create the draft PR.

@mvtglobally

Copy link
Copy Markdown

@mountiny @youssef-lr Is there a specific account with a broken direct company card feed we can use for QA?

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/youssef-lr in version: 9.4.12-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 Help site review — docs update required

This PR changes user-facing behavior of the Time Sensitive section on Home, so a help site update is warranted:

  • Deduplication: The Fix company card connection task now shows once per broken feed instead of once per affected card.
  • Direct feeds only: The task now appears only for direct (OAuth/Plaid) card feeds. Commercial (file-based) feeds (VCF/CDF) are not reconnectable via bank login, so they no longer surface a Time Sensitive task.

The existing article Fix a Broken Company Card Feed Connection previously listed the Time Sensitive notification as a universal indicator for any broken company card feed, which is no longer accurate.

Draft help site PR: #93892

It clarifies that the Time Sensitive task is shown once per direct (bank-login) feed, and points admins of commercial feeds to the red dot indicator and the Concierge #admins message instead.

No other help articles required changes — the dedup itself is invisible to docs, and the Expensify Home Overview describes the section generically without per-feed detail.


@mountiny, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR Ready for review.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/youssef-lr in version: 9.4.14-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@mountiny

Copy link
Copy Markdown
Contributor Author

The customer who experienced this issue no longer experiences it, we could mock the data, but that is same as the unit tests so I think we can check it off and see if we can find any other bugs in these flows from FS

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/puneetlath in version: 9.4.14-1 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants