Reuse existing Plaid feed on reconnect instead of creating a duplicate#96349
Reuse existing Plaid feed on reconnect instead of creating a duplicate#96349MelvinBot wants to merge 1 commit into
Conversation
…licate Co-authored-by: Maxence Coulibaly <madmax330@users.noreply.github.com>
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
I looked into the failing checks — there's nothing to fix in code. Every automated check passes (typecheck, ESLint, all 8 The one red check is
That's a human-only check — it verifies the author has ticked the boxes in the PR Author Checklist and filled out the
I intentionally don't fill these out on an author's behalf. To turn this check green, |
Explanation of Change
The NewDot "fix broken connection" flow for Plaid company-card feeds created a duplicate feed instead of repairing the existing one. On reconnect,
PlaidConnectionStepderived a fresh feed from the Plaid Link metadata — a bare, unprefixed institution ID (e.g.ins_123456) — and passed that toimportPlaidAccounts, discarding the existingfeedprop it already held.Server-side,
ImportPlaidAccountsdecides repair-vs-create purely on whether the incomingfeedstarts with theplaid.prefix. A bare institution ID misses the prefix, so the server took its create-new-feed branch and minted a duplicate.This change makes the reconnect branch pass the existing
feed(which keeps itsplaid.prefix and originating#domainID) toimportPlaidAccountsinstead of the freshly-derived bare institution ID.importPlaidAccountsrunsgetCompanyCardFeed(feed), which strips only the#domainIDsuffix and preserves theplaid.prefix — so the server now sees a prefixed feed and repairs the existing feed in place rather than creating a second one. The new public token still refreshes the credentials.It also forwards the feed's originating
domainID(parsed from theCompanyCardFeedWithDomainID) to the server as a newdomainAccountIDparam when repairing an existing feed. This is the Plaid analog of the Chase reconnect fix (#95214): for a Classic domain-level feed surfaced into a workspace via "preferred workspace", it lets the server refresh credentials on the domain the broken cards actually belong to instead of the synthetic workspace-policy domain. The paired server change lives in Web-Expensify PR https://github.com/Expensify/Web-Expensify/pull/54605.When no feed is being repaired (adding a new feed), behavior is unchanged.
Fixed Issues
$ https://github.com/Expensify/Expensify/issues/653959
PROPOSAL: https://github.com/Expensify/Expensify/issues/653959#issuecomment-4935721846
Tests
// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review". At minimum, verify that reconnecting a broken Plaid company-card feed repairs the existing feed instead of creating a duplicate.
Offline tests
QA Steps
// TODO: The human co-author must fill out the QA tests you ran before marking this PR as "ready for review", or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari