Repository navigation
[Payment due @brunovjk] Show Explain button on receipt scan failed system messages - #93532
Conversation
The .reasoning field is now populated on RECEIPTSCANFAILED actions by Auth #21123, but ReceiptScanFailedContent renders via the bare ReportActionItemBasicMessage which does not check hasReasoning(). Switch to ReportActionItemMessageWithExplain when reasoning is present so users see the inline Explain link and can thread on the message.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
Reviewing ASAP. Thanks |
|
quick bump @brunovjk 🙏 |
Reviewer Checklist
Screenshots/VideosAndroid: HybridApp93532_android_native.movAndroid: mWeb Chrome93532_android_web.moviOS: HybridAppiOS: mWeb Safari93532_ios_web.movMacOS: Chrome / Safari93532_web_chrome.mov |
|
@Beamanator do you think we can increase test coverage here? Thanks. |
|
ooooh ya good plan :D |
|
One more thing, every time we press the "Explain" button, we send the same message over again. Is this intentional? Thank you. Screen.Recording.2026-06-17.at.13.33.56.mov |
Adds four UI tests for RECEIPT_SCAN_FAILED in ReportActionItemTest.tsx: submitter + reasoning shows Explain, non-submitter + reasoning shows Explain (guards both canEdit branches), no reasoning hides Explain (backward compat for pre-Auth-21123 actions), and missingFields + reasoning shows the field-specific message alongside Explain. Matches the existing MOVED_TRANSACTION / APPROVED / EXPORTED_TO_INTEGRATION Explain test patterns in the same file.
|
Ok so i def need to remove the dupe period, will work on that 👍 As for the And as for |
The `smartscanFailed` translation always ends with a period (e.g. "…Enter details manually."), and `AskToExplain` prepends its own leading ". Explain", so the rendered string came out as "…manually.. Explain" — two periods. Other Explain-using flows (MovedTransaction, ExportIntegration, etc.) don't hit this because their underlying message strings don't end in a period. Stripping the trailing period in the WithExplain branch of ReceiptScanFailedContent keeps the fix narrow to this caller. Adds a regression test that asserts the rendered DOM does not contain ".. Explain", mirroring the existing EXPORTED_TO_INTEGRATION guard.
main now requires chatReport as a prop on ReportActionItem (commit 8aad255, lift up chatReport), and main's version of this test file already passes chatReport={undefined} to every existing usage. The five new RECEIPT_SCAN_FAILED tests I added were missing the prop, so the PR-merged-with-main typecheck failed on each of them.
|
ok i think this is ready for you again @brunovjk ! |
brunovjk
left a comment
There was a problem hiding this comment.
LGTM. I do wonder whether removing the leading period from AskToExplain would be a cleaner solution than trimming the message here. That said, it may have a wider impact on other usages and would probably be out of scope for this PR. What do you think, @Beamanator?
|
@neil-marcellini Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
🎯 @brunovjk, thanks for reviewing and testing this PR! 🎉 A payment issue will be created for your review once this PR is deployed to production. If payment is not needed (e.g., regression PR review fix etc), react with 👎 to this comment to prevent the payment issue from being created. |
Yeah def an interesting thought and could be nice to update at some point, but as you said - probably not in this PR since it would require updating other usages of the All you @neil-marcellini ! |
|
Actually @brunovjk i'm seeing this in the failing check - can you take a look?:
|
brunovjk
left a comment
There was a problem hiding this comment.
I redid the checklist now. I approved it again to trigger another run.
|
@jayeshmangwani Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
I re-assigned this because I currently have 14+ PRs to review and I do not want to slow things down while I catch up on reviews. Pullerbear didn't work to get a new internal engineer, so if you really need someone I can review tomorrow. |
|
no worries! i'll find a new reviewer! |
|
🚧 @mollfpr has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/mollfpr in version: 9.4.18-0 🚀
Bundle Size Analysis (Sentry): |
|
🤖 I reviewed this PR against the help site articles under Docs update required: Yes. This PR surfaces a discoverable inline Explain link on Draft PR: #94377 It adds a task-based ## How to understand why a SmartScan failed section to @Beamanator, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR |
|
Deploy Blocker #94411 was identified to be related to this PR. |
I don’t think this is a regression from our PR. I commented on the issue, explaining a bit of what I think. |
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.4.18-2 🚀
|
|
🤖 Payment issue created: #94492 |

Explanation of Change
When SmartScan fails to parse a receipt, Auth posts a
RECEIPTSCANFAILEDreport action in the transaction thread. As of Auth PR 21123 (merged 2026-06-13), that action now carries areasoningfield onoriginalMessage— an LLM-friendly description of what was/wasn't extracted — andhasReasoning(action)is what activates the inlineExplainaffordance everywhere else in the App.The gap before this PR:
ReceiptScanFailedContentrendered the action with a plainReportActionItemBasicMessage, which has nohasReasoning()awareness. Soreasoningwas being delivered but the inlineExplainlink never appeared. (The right-click / long-press context menu'sExplainentry — which gates onhasReasoning(reportAction)directly inContextMenuActions.tsx— was already working, but the much more discoverable inline affordance was not.)This PR:
ReceiptScanFailedContent.tsx— whenhasReasoning(action)is true, renders throughReportActionItemMessageWithExplain(passingaction,childReport, andoriginalReport), matching the pattern used byMovedTransactionAction,ExportIntegration,ModifiedExpenseContent,UnreportedTransactionAction, andApprovalFlowContent. Otherwise falls back to the existingReportActionItemBasicMessagerendering.ActionContentRouter.tsx— threadsoriginalReportdown toReceiptScanFailedContent(required by the WithExplain wrapper'sexplain()call).src/types/onyx/OriginalMessage.ts— addsreasoning?: stringtoOriginalMessageSmartScanFailedfor type accuracy. (Behaviour unchanged: the runtimehasReasoning()check is'reasoning' in originalMessage, so this is type hygiene, not a behavioral fix.)The user-visible message string is unchanged —
translate('violations.smartscanFailed', {canEdit, missingFields})still drives the human-readable copy (Receipt scanning failed — missing <fields>. Enter details manually.) for both branches.Parent feature: the
Explainfeature rollout.Fixed Issues
$ https://github.com/Expensify/Expensify/issues/612790
PROPOSAL:
Tests
These are reproducible against a local dev build where the merged Auth PR is deployed (i.e. the Auth service on staging/prod, or the local Auth checkout past commit
d67a2a0b).Receipt scanning failed — missing <field(s)>. Enter details manually.— the exact field list reflects what couldn't be extracted (one of merchant, date, amount, or multiple).Explainlink is appended after that message (rendered as a muted, clickable link).Explainlink.reasoningfield round-tripping through the Explain flow.Explainoption (this path was already working pre-PR viaContextMenuActions.tsxand must not break).RECEIPTSCANFAILEDaction from before the merged Auth PR (i.e. noreasoningfield onoriginalMessage), confirm it renders the same as before — message text only, no inlineExplainlink.Explainlink is present on a freshly-failed scan.Explainopens a Concierge thread with a field-aware reply.Explainentry still works (regression).reasoningrender without the inline link (backward compat).Offline tests
Tapping
Explainis a normal Concierge round-trip; offline behaviour mirrors any otherExplainaction (e.g.Moved transaction,Exported to integration):Explainlink render in the transaction thread.Explainlink still render from cached Onyx data.Explainwhile offline — the action should be queued (no immediate Concierge response).QA Steps
QA can run against staging once the merged Auth PR has deployed.
Receipt scanning failed — missing <field(s)>. Enter details manually.and the exact missing-field list matches what was undetectable.Explainlink is present immediately after the message text.Explain.Explainentry is also still present (regression check).PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline testssectionQA stepssectionreasoning; offline tap-Explain behavior)toggleReportand notonIconClick) — N/A, no new callbackssrc/languages/*files and using the translation method — no new copy added; existingviolations.smartscanFailedtranslation reusedSTYLE.md) were followedhasReasoning+ReportActionItemMessageWithExplainpatternAvatar, I verified the components usingAvatarare working as expected) — the neworiginalReportprop onReceiptScanFailedContentis required and supplied at the only call site inActionContentRouter.tsx; no other consumers existReceiptScanFailedContent's prop type gained the requiredoriginalReportfield; updated at its single call siteStyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases) — N/A, modifies an action-specific renderer, not a generic componentReportActionItemMessageWithExplainwrapper; no new buttons, no padding/spacing changes, no new form input stylesDesignlabel and/or tagged@Expensify/designso the design team can review the changes. — N/A, reuses an existing affordance unchangedScrollViewcomponent to make it scrollable when more elements are added to the page. — N/A, no new pagemainbranch 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