Skip to content

[Due for payment 2026-09-01] Rules - Vendor name changes after disconnecting accounting #98602

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.4.53-4
Reproducible in staging?: Yes
Reproducible in production?: Unable to validate in Prod - Provide reasoning.
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #97811
Email or phone of affected tester (no customers): applausetester+ssndjois2jd1@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5 / Chrome
App Component: Workspace Settings

Action Performed:

Precondition:

  • Enable Accounting and Rules.
  • Connect workspace to Sage Intacct.
  • Run Onyx.merge('betas', ['vendorMatching']); in console.
  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Rules.
  3. Click Add merchant rule.
  4. Click Merchant.
  5. Enter merchant and save it.
  6. Click Vendor.
  7. Select a vendor.
  8. Create the rule.
  9. Go to Accounting and disconnect Sage Intacct.
  10. Go to Rules.
  11. Scroll down to the created rule.

Expected Result:

Vendor name will not change after disconnecting accounting.

Actual Result:

Vendor name changes after disconnecting accounting.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7232764_1786633390889.16.1.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7232764

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. applause-bot commented on Aug 13, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/d68765185cde2a037f4d74ff3edd7364a955e4fdf0ec92b260c9b1baab817729

  2. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 13, 2026
  3. melvin-bot commented on Aug 13, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #97811

  4. melvin-bot commented on Aug 13, 2026

    @melvin-bot

    @mollfpr @abzokhattab you have been assigned to this deploy blocker because you reviewed the offending PR: #97811

  5. melvin-bot commented on Aug 13, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  6. github-actions commented on Aug 13, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  7. abzokhattab commented on Aug 13, 2026

    @abzokhattab
    Contributor

    is that a backend issue @Beamanator

  8. MelvinBot commented on Aug 13, 2026

    @MelvinBot
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug (App)
    Causing PR: #97811 - "Add vendorID action field to merchant coding rules (vendor matching R5, Phase B)" by @MelvinBot, approved by @abzokhattab and @mollfpr (High confidence)
    Related Issues: none

    Recommendation: DEMOTE (fix, don't revert — see below)

    This is not a backend issue — the vendor name is resolved entirely client-side at render time from the policy's connection data, so when Sage Intacct is disconnected the App can no longer resolve the name and falls back to the raw external vendor ID. It is fully gated behind the vendorMatching beta (which requires a manual Onyx.merge('betas', ['vendorMatching']) console command), is not reachable by any production or normal staging user, and is not reproducible in production — so it does not warrant blocking the deploy. Keep the feature; address with a small roll-forward fix rather than reverting the whole PR.

    Assigned: @abzokhattab and @mollfpr (approving reviewers of the causing PR) are already assigned. The PR author is an automation account (@MelvinBot), so not assigned.
    Labels: No changes. This is a Frontend bug, so DeployBlockerCash is kept (per the decision tree, an App PR caused it). No DeployBlocker (Web) label is present.

    📋 Detailed Analysis

    Evidence

    • PR [Payment due @abzokhattab] Add vendorID action field to merchant coding rules (vendor matching R5, Phase B) #97811 is the App-side of vendor matching R5 Phase B and is on the current staging deploy checklist (#98463). It merged 2026-08-12, matching the v9.4.53 staging build where the bug reproduces.
    • The PR introduces the vendorID action field, src/libs/MerchantTypeRulesUtils.ts, AddVendorPage.tsx, and the render-time name resolution. Its own description states the design explicitly: "Only the external vendor ID is stored; the display name is resolved at render time from the policy's active vendor list." Test step 11 even documents the fallback to "vendor unavailable"/raw ID when the vendor list isn't present.
    • Reproduces on staging only; not reproducible in production. The feature requires the vendorMatching beta enabled via a console command, so no real user can reach it.

    Verification

    • Affected file: src/libs/MerchantTypeRulesUtils.ts — the vendor branch in getMerchantCodingRulesTableData:
      if (rule.vendorID) {
      // Resolve the display name in three tiers so each case renders correctly:
      // 1. Active-source hit — the vendor is in the active vendor-matching integration's list; render its name.
      // 2. Active-source miss with a loaded list — the ID doesn't exist in that active list; render "unavailable"
      // so a rule targeting a stale/inactive-connection vendor never surfaces a misleading name.
      // 3. No active vendor-matching source (e.g. admin switched the non-reimbursable export mode away from
      // vendor-matching) — fall back to `findVendorByID`'s permissive search across every connection's data
      // so the historical vendor name still renders instead of a raw external ID; otherwise the raw ID
      // as a last resort while the connection data hasn't loaded yet.
      const activeVendorName = getMatchingVendorByID(policy, rule.vendorID)?.name;
      let vendorValue: string;
      if (activeVendorName) {
      vendorValue = activeVendorName;
      } else if (isMatchingVendorListLoaded(policy)) {
      vendorValue = translate(isOnXero ? 'workspace.rules.merchantRules.supplierUnavailable' : 'workspace.rules.merchantRules.vendorUnavailable');
      } else {
      vendorValue = findVendorByID(policy, rule.vendorID)?.name ?? rule.vendorID;
      }
      actions.push(translate('workspace.rules.merchantRules.ruleSummarySubtitleUpdateField', fieldLabels.vendor, vendorValue));
    • Helper logic in src/libs/PolicyUtils.ts: getActiveVendorMatchingVendors

      App/src/libs/PolicyUtils.ts

      Lines 2489 to 2516 in 837ca8c

      function getActiveVendorMatchingVendors(policy: OnyxEntry<Policy>): Vendor[] | undefined {
      if (!policy) {
      return undefined;
      }
      if (isQBOVendorMatchingActive(policy)) {
      return policy.connections?.[CONST.POLICY.CONNECTIONS.NAME.QBO]?.data?.vendors;
      }
      if (isIntacctVendorMatchingActive(policy)) {
      const intacctVendors = policy.connections?.[CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT]?.data?.vendors;
      if (intacctVendors === undefined) {
      return undefined;
      }
      return intacctVendors.map((vendor) => ({
      id: vendor.id,
      name: vendor.value,
      currency: '',
      email: '',
      }));
      }
      if (isXeroVendorMatchingActive(policy)) {
      const xeroContacts = policy.connections?.[CONST.POLICY.CONNECTIONS.NAME.XERO]?.data?.contacts;
      if (!xeroContacts) {
      return undefined;
      }
      return Object.values(xeroContacts).map((contact) => ({id: contact.id, name: contact.name, currency: '', email: contact.email}));
      }
      return undefined;
      }
      , isMatchingVendorListLoaded

      App/src/libs/PolicyUtils.ts

      Lines 2534 to 2536 in 837ca8c

      function isMatchingVendorListLoaded(policy: OnyxEntry<Policy>): boolean {
      return getActiveVendorMatchingVendors(policy) !== undefined;
      }
      , getMatchingVendorByID

      App/src/libs/PolicyUtils.ts

      Lines 2543 to 2548 in 837ca8c

      function getMatchingVendorByID(policy: OnyxEntry<Policy>, vendorID: string | undefined): Vendor | undefined {
      if (!vendorID) {
      return undefined;
      }
      return getMatchingVendors(policy).find((vendor) => vendor.id === vendorID);
      }
      , and findVendorByID

      App/src/libs/PolicyUtils.ts

      Lines 2561 to 2577 in 837ca8c

      function findVendorByID(policy: OnyxEntry<Policy>, vendorID: string | undefined): Vendor | undefined {
      if (!policy || !vendorID) {
      return undefined;
      }
      const activeMatch = getMatchingVendors(policy).find((vendor) => vendor.id === vendorID);
      if (activeMatch) {
      return activeMatch;
      }
      const qboVendor = policy.connections?.[CONST.POLICY.CONNECTIONS.NAME.QBO]?.data?.vendors?.find((vendor) => vendor.id === vendorID);
      if (qboVendor) {
      return qboVendor;
      }
      const intacctVendor = policy.connections?.[CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT]?.data?.vendors?.find((vendor) => vendor.id === vendorID);
      if (intacctVendor) {
      return {
      id: intacctVendor.id,
      name: intacctVendor.value,
    • Confirmed PR [Payment due @abzokhattab] Add vendorID action field to merchant coding rules (vendor matching R5, Phase B) #97811's file list includes src/libs/MerchantTypeRulesUtils.ts, src/types/onyx/Policy.ts (adds vendorID), src/pages/workspace/rules/MerchantRules/AddVendorPage.tsx, and src/pages/workspace/rules/MerchantRulesSection.tsx — all in the affected code path.

    Root Cause

    The coding rule persists only the external vendorID. The display name is recomputed on every render in getMerchantCodingRulesTableData via a three-tier lookup:

    1. getMatchingVendorByID(policy, rule.vendorID) — the active vendor-matching integration's list.
    2. If that misses but the list is loaded → show "vendor/supplier unavailable".
    3. Otherwise findVendorByID(policy, rule.vendorID)?.name ?? rule.vendorID — permissive search across QBO/Intacct connection data, falling back to the raw vendor ID.

    When Sage Intacct is disconnected, its connection (and vendor list) is removed from policy.connections in Onyx. getActiveVendorMatchingVendors then returns undefined (no active source), so tier 1 misses and isMatchingVendorListLoaded is false, dropping to tier 3. findVendorByID also finds nothing (the Intacct connection data is gone), so it falls back to rule.vendorID. The result: a rule that displayed the vendor's name now displays the raw external ID — the reported "vendor name changes after disconnecting accounting."

    This is purely App render logic. The backend correctly stores only the ID and correctly drops the connection's vendor data on disconnect; there is no backend defect. A fix belongs in App — e.g. cache the resolved vendor name on the rule at save time (so it survives disconnection), or render a stable "unavailable" state instead of the raw ID when no source is connected.

  9. 34 remaining items

  10. Beamanator commented on Aug 31, 2026

    @Beamanator
    Contributor

    has been in prod for a week!

  11. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Aug 31, 2026
  12. melvin-bot commented on Aug 31, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  13. melvin-bot commented on Aug 31, 2026

    @melvin-bot

    Payment Summary

    Resolving PRs:

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
    • [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon
  14. abzokhattab commented on Sep 3, 2026

    @abzokhattab
    Contributor

    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: new feature: we are updating the vendor name after disconnect

    • [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 — not critical, behind the vendorMatching beta.

    • [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.

    Regression Test Proposal

    Precondition:

    • A workspace with Accounting and Rules enabled, connected to Sage Intacct (or another vendor-matching integration).
    • The vendorMatching beta enabled via Onyx.merge('betas', ['vendorMatching']).
    • A merchant rule created with a vendor selected from the integration.

    Test:

    1. Verify the merchant rule summary shows the vendor's name (e.g. "Update vendor to "Acme Corp"").
    2. Disconnect the accounting integration from Workspace settings > Accounting.
    3. Navigate to Workspace settings > Rules.
    4. Verify the merchant rule summary shows "Update vendor to "Vendor unavailable"" — not a raw external vendor ID.
    5. Reconnect the integration and verify the vendor's name renders again correctly.

    Do we agree 👍 or 👎

  15. mallenexpensify commented on Sep 3, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @abzokhattab due $250 via NewDot

  16. quinthar commented on Sep 25, 2026

    @quinthar
    Contributor

    Approved $250 to @abzokhattab

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2Engineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions