Skip to content

fix: show scan error instead of populating $0 amount when scan fails - #98871

Draft
x-dev90 wants to merge 3 commits into
Expensify:mainfrom
x-dev90:fix/scan-failed-amount-handling
Draft

fix: show scan error instead of populating $0 amount when scan fails#98871
x-dev90 wants to merge 3 commits into
Expensify:mainfrom
x-dev90:fix/scan-failed-amount-handling

Conversation

@x-dev90

@x-dev90 x-dev90 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

When a receipt fails to scan, the Amount field showed "$0.00" with no error instead of staying empty. This fixes it across the expense details page, confirmation list, report table, and chat preview — the amount now stays empty with a "missing amount" error until the user manually confirms a value (including 0). Also fixes bulk-editing a failed-scan expense's amount to 0, which previously silently failed to save.

Fixed Issues

$ #94494
PROPOSAL: #94494 (comment)

Tests

Flow 1: Workspace failed scan expense

  1. Open the workspace chat.
  2. Create a scan expense with a receipt/image that will fail SmartScan.
  3. Wait until the scan fails.
  4. Open the expense details.
  5. Verify the Amount field is empty instead of showing $0.00.
  6. Verify the Amount field shows the missing amount error.
  7. Open the Amount field.
  8. Enter 0 and save.
  9. Verify the Amount field shows $0.00.
  10. Verify the missing amount error is cleared.

Flow 2: Split expense failed scan

  1. Start a group chat.
  2. Split an expense using scan and upload an image that will fail SmartScan.
  3. Wait until the scan fails.
  4. Open the split expense details.
  5. Verify the Amount field is empty instead of showing $0.00.
  6. Verify the Amount field shows the missing amount error.
  7. Open the Amount field.
  8. Enter 0 and save.
  9. Verify the Amount field shows $0.00.
  10. Verify the missing amount error is cleared.

Flow 3: Report table inline amount edit

  1. Using the failed scan expense from Flow 1, open the parent Expense Report to see the transaction table.
  2. Verify the Amount column for that row is empty instead of showing 0.00.
  3. Verify the row shows a "Missing amount" indicator.
  4. Click the Amount cell's edit icon.
  5. Enter 0 and save.
  6. Verify the Amount cell shows 0.00.
  7. Verify the "Missing amount" indicator is cleared.

Flow 4: Report table inline edit no-op check

  1. Using another failed scan expense in the same report, click the Amount cell's edit icon.
  2. Without typing anything, click away to blur the cell.
  3. Verify the Amount cell is still empty.
  4. Verify the "Missing amount" indicator is still shown.

Flow 5: Self-DM (track expense) failed scan

  1. Go to your own personal space (self-DM).
  2. Track an expense using scan and upload an image that will fail SmartScan.
  3. Wait until the scan fails.
  4. Verify the expense preview in the chat shows an empty amount and a "Missing amount" indicator.
  5. Open the expense.
  6. Enter 0 as the amount and save.
  7. Verify the preview updates to show 0.00.
  8. Verify the "Missing amount" indicator is cleared.

Flow 6: Manual $0.00 expense in self-DM (regression check)

  1. Go to your own personal space (self-DM).
  2. Create a manual expense (not scan) with amount 0.00.
  3. Verify the expense preview in the chat shows 0.00 (not blank).
  4. Open the expense.
  5. Verify the Amount field shows 0.00 (not blank).

Flow 7: Bulk edit multiple to 0

  1. In the workspace chat, create a scan expense with a receipt/image that will fail SmartScan.
  2. Wait until the scan fails.
  3. Go to Search (or the report), select the failed scan expense's checkbox.
  4. Click the dropdown button → Edit multiple.
  5. Click Amount, enter 0, and save.
  6. Open the expense.
  7. Verify the Amount field shows 0.00.
  8. Verify the missing amount error is cleared.
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

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

@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
...estConfirmationList/hooks/useConfirmationAmount.ts 95.45% <100.00%> (+0.45%) ⬆️
src/libs/IOUAmountSubmission.ts 86.77% <100.00%> (+0.07%) ⬆️
src/libs/TransactionPreviewUtils.ts 85.65% <100.00%> (+0.12%) ⬆️
src/libs/TransactionUtils/index.ts 91.64% <100.00%> (+0.05%) ⬆️
src/libs/actions/IOU/BulkEdit.ts 84.79% <100.00%> (+0.07%) ⬆️
...c/components/ReportActionItem/MoneyRequestView.tsx 77.14% <80.00%> (+0.03%) ⬆️
...ponents/TransactionItemRow/DataCells/TotalCell.tsx 76.81% <62.50%> (-2.23%) ⬇️
... and 10 files with indirect coverage changes

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.

1 participant