Skip to content

[Due for payment 2026-08-28] Please enter a valid merchant violation remains when change to IOU #96593

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.4.41-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/65568255/folder/13177049/41237809/1585991522?sort=%2Bstatus_id
Email or phone of affected tester (no customers): gocemate+buzz1803@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: windows 10/chrome
App Component: Other

Action Performed:

Precondition: User have a workspace

  1. Go to FAB> Create expense> Enter amount> Create expense
  2. Verify "Please enter a valid merchant" violation is displayed
  3. Change the receiver to user email address> Click Create expense

Expected Result:

"Please enter a valid merchant" should not persist when user does not submit expense to workspace chat

Actual Result:

"Please enter a valid merchant" persist when user creates IOU expense

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7213182_1784613560644.Recording__1224.mp4

View all open jobs on GitHub

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

Issue OwnerCurrent Issue Owner: @ikevin127

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jul 21, 2026
  2. applause-bot commented on Jul 21, 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/9530d2233b97866efb89951b8498261dafb50654248b15b8b9a9248183d7766d

  3. melvin-bot commented on Jul 21, 2026

    @melvin-bot

    Triggered auto assignment to @jasperhuangg (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  4. melvin-bot commented on Jul 21, 2026

    @melvin-bot

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

  5. github-actions commented on Jul 21, 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.
  6. MelvinBot commented on Jul 21, 2026

    @MelvinBot
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #96228 - "feat: remove isNewManualExpenseFlowEnabled beta flag" by @thelullabyy (High confidence)
    Related Issues: #93854 (the tracking issue the PR was made for)

    Recommendation: REVERT

    This PR removed the isNewManualExpenseFlowEnabled beta flag, making the refactored "new manual expense flow" the default on staging. That flow contains the merchant-error clearing logic that fails to re-clear iou.error.invalidMerchant when the recipient switches from a workspace (merchant required) to an individual/IOU (merchant not required). The flow is still beta-gated in production, which is exactly why this reproduces on staging only. Reverting restores the beta gate and unblocks the deploy; the underlying flow can then be fixed and re-shipped.

    Assigned: @thelullabyy (PR author), @joekaufmanexpensify, @ikevin127, @puneetlath (approving reviewers) from highest-confidence causing PR only
    Labels: No changes. DeployBlockerCash kept (App deploy is blocked by an App PR); no DeployBlocker present.

    📋 Detailed Analysis

    Evidence

    • Bug is reproducible on staging but NOT production (per the report). The new manual expense flow is still beta-gated in production and only became the default on staging because of this PR, so the bug surface only exists on staging — a textbook signature of this exact PR.
    • PR feat: remove isNewManualExpenseFlowEnabled beta flag #96228 was merged 2026-07-20, is on the current StagingDeployCash checklist (Deploy Checklist: New Expensify 2026-07-21 #96534), and precedes the bug report (2026-07-21).
    • The PR touches precisely the affected code paths: the merchant-required computation, the confirmation validation, and participant switching.

    Verification

    Affected files, all modified by #96228:

    • src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts — owns isMerchantRequired, isMerchantFieldValid, and the effect that is supposed to clear the iou.error.invalidMerchant form error.
    • src/components/MoneyRequestConfirmationList/hooks/useConfirmationValidation.ts — sets iou.error.invalidMerchant when isMerchantRequired && !isMerchantFieldValid.
    • src/components/MoneyRequestConfirmationList.tsx, src/components/MoneyRequestConfirmationList/sections/MerchantField.tsx, src/pages/iou/request/step/IOURequestStepParticipants.tsx — confirmation list + merchant field + participant switching.
    • src/CONST/index.ts — removes the beta flag constant.

    gh pr view 96228 --json files confirms all of the above are in the diff.

    Root Cause

    In useFormErrorManagement.ts:

    • isMerchantRequired = isPolicyExpenseChat && (!isScanRequest || !!isEditingSplitBill) && shouldShowMerchant (line 161). Switching the recipient to an individual makes isPolicyExpenseChat false, so merchant is no longer required.
    • isMerchantFieldValid returns !isMerchantRequired when the merchant value is empty (line 172), so after the switch it should become true.
    • The effect at lines 211–214 is meant to clear the error: if (currentFormError === 'iou.error.invalidMerchant' && isMerchantFieldValid) setFormError('').

    The error persists because that clearing effect does not reliably re-run/re-clear when only the participant changes (the merchant string itself never changes; the requirement changes). There is a dedicated effect in MoneyRequestConfirmationList.tsx (lines 399–404) that clears iou.error.noParticipantSelected on participant change, but there is no equivalent path to clear iou.error.invalidMerchant when the participant change flips the merchant-required state. So the stale merchant error set during the workspace attempt remains after switching to an IOU.

    A targeted fix would clear/re-evaluate the merchant form error whenever isMerchantRequired changes (e.g. add isMerchantRequired to the clearing logic or clear iou.error.invalidMerchant in the participant-change effect). REVERT is recommended for the deploy because the flow is beta-gated in production and reverting cleanly restores that gate without risk.

  7. 32 remaining items

  8. melvin-bot commented on Jul 22, 2026

    @melvin-bot

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

    If no regressions arise, payment will be issued on 2026-07-29. 🎊

    For reference, here are some details about the assignees on this issue:

    • @ikevin127 requires payment through NewDot Manual Requests
    • @thelullabyy requires payment through NewDot Manual Requests
  9. melvin-bot commented on Jul 22, 2026

    @melvin-bot

    @ikevin127 / @thelullabyy The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero 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]

  10. melvin-bot commented on Jul 22, 2026

    @melvin-bot

    @ikevin127 / @thelullabyy The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero 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]

  11. thelullabyy commented on Jul 29, 2026

    @thelullabyy
    Contributor

    @MelvinBot Please investigate and give me patch file to test your fix solution

  12. MelvinBot commented on Jul 29, 2026

    @MelvinBot
    Contributor

    Fix patch to test

    Root cause: In the new manual-expense flow, isMerchantFieldValid never flips to true after you switch the recipient to an individual, so the stale iou.error.invalidMerchant never clears and the confirm handler keeps bailing out.

    A manual expense carries the sentinel merchant "Expense" (getMerchant → transaction.merchant). In useFormErrorManagement.ts:166-180 the !trimmedMerchant branch only handles a truly empty string, so the non-empty "Expense" sentinel skips it and falls through to !isInvalidMerchantValue("Expense") → false. Because isMerchantFieldValid stays false, the clear-effect at lines 205-210 never fires when merchant stops being required, and confirmAction.ts:98-101 early-returns on the stale error.

    The fix: treat the sentinel/blank merchant values ("", "(none)", "Expense") as "blank" so validity returns !isMerchantRequired. When the recipient switches to an individual, isMerchantRequired → false, so isMerchantFieldValid → true, the clear-effect fires, formError clears, and submit proceeds. This is the only behavior change — a not-required blank/sentinel merchant now counts as valid; every required-merchant case is unchanged.

    Patch

    Save this as fix-merchant-error.patch in the repo root and apply with git apply fix-merchant-error.patch:

    diff --git a/src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts b/src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts
    index fc87e43..69c2b19 100644
    --- a/src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts
    +++ b/src/components/MoneyRequestConfirmationList/hooks/useFormErrorManagement.ts
    @@ -172,11 +172,15 @@ function useFormErrorManagement({
                 return false;
             }
     
    -        if (!trimmedMerchant) {
    +        // A blank merchant — empty, or one of the sentinel placeholders ("Expense", "(none)") that stand in for
    +        // "no merchant yet" — is only invalid while the merchant is required. Once the recipient switches to an
    +        // individual (merchant no longer required) it becomes valid, which lets the clearing effect drop a stale
    +        // `iou.error.invalidMerchant` error instead of leaving it stuck on screen.
    +        if (isInvalidMerchantValue(trimmedMerchant)) {
                 return !isMerchantRequired;
             }
     
    -        return !isInvalidMerchantValue(trimmedMerchant);
    +        return true;
         })();
     
         const isViolationFixed = getIsViolationFixed(formError, {

    Note: since PR #96228 was reverted, the new flow is beta-gated again behind newManualExpenseFlow. To repro/test you'll need that beta enabled. This patch is the targeted fix to fold into the re-land of #96228.

    How to verify

    1. Enable the newManualExpenseFlow beta.
    2. FAB → Create expense → enter amount → Create expense (with a workspace recipient) → confirm the "Please enter a valid merchant" violation shows.
    3. Change the receiver to an individual (your own email) → Create expense.
    4. Expected with the patch: the merchant error clears and the IOU expense is created.

    Next Steps: Reply with @MelvinBot implement this to have me open a draft PR with this fix, or @MelvinBot <feedback> to refine.

  13. melvin-bot commented on Aug 21, 2026

    @melvin-bot

    @ikevin127 / @thelullabyy

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

    If no regressions arise, payment will be issued on 2026-08-28. 🎊

    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]

  14. changed the title [-][Due for payment 2026-07-29] Please enter a valid merchant violation remains when change to IOU[/-] [+][Due for payment 2026-08-28] Please enter a valid merchant violation remains when change to IOU[/+] on Aug 21, 2026
  15. ikevin127 commented on Aug 22, 2026

    @ikevin127
    Contributor

    ❌ No payment due here as this was a regression of a PR we're working on merging via multiple batch PRs.

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

Metadata

Metadata

Labels

BugSomething 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