Skip to content

Add Share Extension receipt telemetry: stamp trace id, log capture and submit milestones#59

Closed
adhorodyski wants to merge 1 commit into
mainfrom
durable-receipts-share-telemetry
Closed

Add Share Extension receipt telemetry: stamp trace id, log capture and submit milestones#59
adhorodyski wants to merge 1 commit into
mainfrom
durable-receipts-share-telemetry

Conversation

@adhorodyski

Copy link
Copy Markdown
Collaborator

What

Extends the receipt capture-to-upload telemetry from Expensify#94950 to receipts that enter through the iOS Share Extension (print an email, Share, Expensify, Save).

Why

The trace id was minted in only two places: buildReceiptFiles.ts (camera, gallery, file) and replaceReceipt in Receipt.ts. The share flow goes through neither. It builds the receipt by hand in SubmitDetailsPage.onSuccess and calls requestMoney/trackExpense directly, so it also skips createTransaction, where the submitted milestone fires.

For a shared receipt this meant:

  • No trace id, so we could not follow one receipt from capture to upload.
  • The captured log never fired, so we lost mimeType, fileExtension, and fileSizeBytes. That is the PDF-format and large-file signal we care about.
  • The submitted log never fired, so we lost the draft to final transactionID mapping.

Only enqueued and the queue snapshot still fired, both with receiptTraceId: undefined, joinable only by transactionID. This is the exact variant confirmed lost in production.

Changes

  • Add 'share' to the ReceiptCaptureSource union in ReceiptObservability.ts.
  • In SubmitDetailsPage.onSuccess, stamp the receipt with a trace id and log the capture milestone with captureSource: 'share'. The file read from disk carries its type, name, and size, so the capture log gets the format and size fields.
  • In SubmitDetailsPage.finishRequestAndNavigate, log the submit milestone with the draft and final transaction ids right before the direct requestMoney/trackExpense call.

The stamp makes enqueued and snapshot carry a real trace id. The two log calls restore the captured and submitted milestones, so a shared receipt has the same end-to-end trace as a camera or gallery receipt.

Tests

Added a test in SubmitDetailsPageTest.tsx that drives a share submit and checks the trace id reaches the request receipt, and that the captured and submitted lines fire with source share. The existing ReceiptObservability unit tests already cover the shared helpers.

Related

…d submit milestones

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3d739520-468e-479e-a872-1e8b87a1ddd6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch durable-receipts-share-telemetry

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@adhorodyski

Copy link
Copy Markdown
Collaborator Author

Reopening against Expensify/App instead. See the new PR.

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