Repository navigation
Description
Problem
In rare cases, receipts captured in NewDot can fail to upload and end up effectively lost — the user is left without a clear way to recover the image. A recent investigation suggested this can happen when something blocks the write queue between capture and a sign-out (or other lifecycle event), but we currently lack the observability to confirm the exact sequence in production. We're left guessing at what happened in individual cases.
Two related concerns:
- Receipt durability — once a user has taken a photo of a receipt inside the app, we should make it very hard for that image to be lost, even if the upload pipeline fails.
- Observability — when this does happen, we don't have enough logs to diagnose the root cause after the fact.
Proposals discussed
Option 1 — Save the receipt to the device's photo library on capture.
- Pros: Simple, gives the user a clear recovery path (re-submit from gallery).
- Cons: Requires photo library permission. Doesn't work if the user has denied that permission.
Option 2 — Persist the captured receipt in a dedicated local queue/store, and on next sign-in by the same user, prompt them to resubmit if anything is still pending.
- Pros: Better UX. No extra OS permission needed. Doesn't rely on the user having access to the photo library.
- Cons: If we persist images as base64 in Onyx, they'd remain on disk after sign-out in an unencrypted form. We don't currently encrypt anything at rest in Onyx, so this is arguably consistent with our current model — but it raises the bar of what's accessible to a technical user after sign-out. We'd want to think carefully about scope-down/cleanup behavior here.
Observability work
Independently of which recovery approach we pick, we need to substantially improve logging in the receipt capture → upload → SmartScan flow so that when a customer reports a lost receipt, we can:
- Confirm whether the image was captured.
- Confirm whether the upload request was enqueued.
- Confirm whether/when it was sent, and what the server response was.
- Confirm queue state at sign-out / app close / app foreground events.
The goal: when a similar report comes in, we should be able to answer "what happened" from logs rather than guessing.
Related
There was also a side discussion about doing a SmartScan queue (SQ) audit, similar to the prior offline-tracking audit, and documenting the findings in a doc analogous to NETWORK_STATE_DETECTION.md. That work is likely tracked separately, but is referenced here for context.
Suggested next steps
- Decide between Option 1, Option 2, or a hybrid (e.g., photo library when permission is granted, fall back to local queue otherwise).
- Define the cleanup/scope-down rules for any locally persisted receipt images.
- Add structured logs at each step of the capture → upload → scan pipeline, plus lifecycle events (sign-out, background, foreground).
Slack thread: https://expensify.slack.com/archives/C05LX9D6E07/p1779949397375439
Issue Owner
Current Issue Owner: @mallenexpensifyMetadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
melvin-bot commentedon Jun 2, 2026
@adhorodyski Whoops! This issue is 2 days overdue. Let's get this updated quick!
melvin-bot commentedon Jun 4, 2026
@adhorodyski Huh... This is 4 days overdue. Who can take care of this?
adhorodyski commentedon Jun 8, 2026
Not overdue, this PR is in motion and I'm already working on a SQ audit 👍🏼
melvin-bot commentedon Jun 11, 2026
@adhorodyski Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
melvin-bot commentedon Jun 15, 2026
@adhorodyski Still overdue 6 days?! Let's take care of this!
adhorodyski commentedon Jun 16, 2026
Wrapped up most SQ related topics and going back to this one now, I'll update as soon as I have something.
56 remaining items
mallenexpensify commentedon Jul 28, 2026
Payment Summary
Contributor+: @mkhutornyi due $500 via NewDot
rinej commentedon Jul 29, 2026
I checked, and you're right - we missed that. It looks like it was reverted because of this issue with permission storage modal: #95957
The logging implementation itself is already merged and looks solid.
I'll wrap up my current tasks and start working on re-implementing the v2
mountiny commentedon Jul 29, 2026
Thanks
mallenexpensify commentedon Jul 30, 2026
Cool to close?!??!
rinej commentedon Jul 30, 2026
@mountiny do we need new ticket for the follow up? There will be just the following part of it:
Problem: When a user signs out on iOS/Android while a receipt is still queued for upload (e.g. offline), the pending receipt is lost.
Solution: If a user signs out while a receipt is still uploading, save that receipt image to the device gallery before storage is cleared, and show a confirmation modal with the prompt.
mountiny commentedon Jul 30, 2026
@MelvinBot can you create a new issue with:
Assign @rinej @mountiny and @eVoloshchak as a follow up
MelvinBot commentedon Jul 30, 2026
🤖 Created the follow-up issue: #97487
Assigned
rinej,mountiny, andeVoloshchak.rinej commentedon Jul 31, 2026
created follow up PR -> #97562
trjExpensify commentedon Aug 3, 2026
approved $500 for @mkhutornyi