Skip to content

Scan - Amount edit system message changes to "changed the expense" after reset app #98783

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.54-2
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #96772
Email or phone of affected tester (no customers): sjdoinsjdnoijnsdojo@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5 / Chrome
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create a scan expense with invalid receipt.
  4. Wait for scan to fail.
  5. Open the expense.
  6. Click Amount.
  7. Edit the amount to 0.00 and save it.
    → System message shows "changed the amount to MYR 0.00 (previously MYR 0.00)".
  8. Go to Account > Troubleshoot > Clear cache and restart > Reset and refresh.
  9. Open the expense from Step 3.

Expected Result:

System message will remain the same - "changed the amount to MYR 0.00 (previously MYR 0.00)".

Actual Result:

System message changes to "changed the expense" after reset app.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7235670_1786983397207.9.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Svetlana Lazutkina
Bug ID: 7235670

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 17, 2026
  2. melvin-bot commented on Aug 17, 2026

    @melvin-bot

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

  3. applause-bot commented on Aug 17, 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/63f945e1323707a7a44f37d4bb829afffd67aa999a7135d36797d6c67eab8836

  4. melvin-bot commented on Aug 17, 2026

    @melvin-bot

    @arosiclair @Ollyws you have been assigned to this deploy blocker because you reviewed the offending PR: #96772

  5. melvin-bot commented on Aug 17, 2026

    @melvin-bot

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

  6. github-actions commented on Aug 17, 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. MelvinBot commented on Aug 17, 2026

    @MelvinBot
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #96772 - "fix: show scan error instead of populating $0 amount when scan fails" by @x-dev90 (High confidence)
    Related Issues: #94494 (issue the PR fixed)

    Recommendation: ROLL FORWARD

    PR #96772 is a legitimate, approved UX feature (blank amount + error for failed scans), so a full revert would remove valid functionality; the defect is a narrow edge case and warrants a targeted fix instead. Keeping DeployBlockerCash since an App PR caused it.

    Assigned: @x-dev90 (PR author), @Ollyws and @arosiclair (approving reviewers) from the causing PR
    Labels: No change. DeployBlockerCash kept (App PR caused it → App deploy is blocked). No DeployBlocker present to remove.

    📋 Detailed Analysis

    Evidence

    Verification

    • Affected/producing file for the message: src/libs/ModifiedExpenseMessage.ts.
    • The offending change is in src/libs/IOUAmountSubmission.ts:613-614 (added by fix: show scan error instead of populating $0 amount when scan fails #96772):
      const hasFailedScanAmountPlaceholder = isFailedScanAmountPlaceholder(currentTransaction);
      if (!hasFailedScanAmountPlaceholder && newAmount === getAmount(...) && selectedCurrency === transactionCurrency) {
          navigateBack();
          return;
      }
    • Supporting new helper isFailedScanAmountPlaceholder added in src/libs/TransactionUtils/index.ts (also fix: show scan error instead of populating $0 amount when scan fails #96772).
    • The optimistic system-message fields are built in src/libs/ReportUtils.ts:6230-6241 (getModifiedExpenseOriginalMessage): because amount is in transactionChanges, the optimistic action gets amount: 0, oldAmount: 0, currency, oldCurrency.

    Root Cause

    This is an optimistic-vs-server message divergence caused by submitting a no-op amount edit:

    1. On the failed-scan expense, the user edits the amount to 0.00. Old amount is also 0. PR fix: show scan error instead of populating $0 amount when scan fails #96772 now lets this submit instead of short-circuiting.
    2. The optimistic MODIFIED_EXPENSE includes amount/oldAmount/currency/oldCurrency (ReportUtils.ts:6230-6241). ModifiedExpenseMessage.getForReportAction sees hasModifiedAmount === true (src/libs/ModifiedExpenseMessage.ts:312-313) and renders "changed the amount to MYR 0.00 (previously MYR 0.00)" (ModifiedExpenseMessage.ts:341-350).
    3. On cache reset, the action is rebuilt from the server. The backend (ModifiedExpense::getNewDotComment) sees no real amount change (0 → 0) and does not persist the amount/currency keys in the action's originalMessage.
    4. Now hasModifiedAmount === false at ModifiedExpenseMessage.ts:312-313, every field check misses, message === '', and the code hits the generic fallback:
      • src/libs/ModifiedExpenseMessage.ts:563 → return translate('iou.changedTheExpense'); ("changed the expense").

    So the amount detail is lost precisely because the frontend manufactures an amount-change action for a change the backend treats as a non-change.

    Suggested targeted fix

    Align optimistic behavior with the backend for the failed-scan-confirm case: still submit (to clear the scan-failure error), but don't build an amount-change originalMessage when the numeric amount is unchanged, or clear the scan error via a path that doesn't emit an amount-modification system message. This keeps the #96772 feature while eliminating the message that the server won't reproduce.

  8. m-natarajan commented on Aug 18, 2026

    @m-natarajan

    Amount field displayed as 0.00 after scanning, Win 11/Chrome, v9.4.54-4

    Recording.3381.mp4
  9. Beamanator commented on Aug 18, 2026

    @Beamanator
    Contributor

    ok looks like we're back to the old version, closing this out 👍

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.EngineeringHourlyKSv2ReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions