[Performance] Cancel telemetry span when user discards expense without submitting#94451
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d83b5c2e4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bb88cb5a79
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bb88cb5a79
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
|
@codex review, dont repeat yourself |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bb88cb5a79
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
bb88cb5 to
7b7fee9
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! 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". |
|
@mananjadhav 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] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1949ec76a4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! 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". |
|
Overall the changes look good. But quick question, I am wondering if we want to mirror this behavior when the user clicks the back button in a new manual expense flow. Should we be calling App/src/pages/iou/request/IOURequestStartPage.tsx Lines 192 to 199 in 0b40ac9 |
Good catch! In the new manual expense beta the confirmation is embedded with its header hidden, so this back button is the only escape hatch. The unmount cleanup alone isn't sufficient here because it guards against cancelling when |
|
@JakubKorytko Can you fix the failing tests and Typescript errors? |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb Chromemweb-chrome-cancel-telemetry.moviOS: HybridAppios-cancel-telemetry.moviOS: mWeb Safarimweb-safari-cancel-telemetry.movMacOS: Chrome / Safariweb-cancel-telemetry.mov |
mananjadhav
left a comment
There was a problem hiding this comment.
I've got an issue with Android build, so skipping that as anywya it's platform indepdent.
@mountiny Can we rerun the tests?
|
🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.26-0 🚀
|
|
🤖 No help site changes required. I reviewed the changes in this PR and they are entirely internal telemetry instrumentation — no user-facing behavior, UI, copy, settings, or feature changes. Why no docs changes are neededThe diff only affects Sentry/telemetry span lifecycle:
The user-facing flows (creating an expense, discarding it, submitting, paying) behave exactly as before. Nothing in @JakubKorytko, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR (Note: since this change is telemetry-only and has no user-facing impact, no help site PR was created — there is nothing to review. Let me know if you believe a specific article is affected and I'll take another look.) |
|
🚀 Deployed to production by https://github.com/grgia in version: 9.4.27-2 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Fix telemetry spans that linger when users discard an expense (navigate back from Confirmation after pressing Submit). The fix has two layers:
Primary: Call
cancelTracking()at the top ofnavigateBackin IOURequestStepConfirmation. The orchestrator never usesnavigateBack(it usesdismissModal), so this unambiguously means the user is abandoning the flow - cancel any active span regardless of pending state.Fallback: A
useEffectcleanup that cancels tracking on unmount when nopendingSubmitFollowUpActionis set. This catches gesture/hardware back that bypassesnavigateBack, but only for theDEFAULThandler case where pending hasn't been set yet.Also exported
cancelTrackingfrom thesubmitFollowUpActionmodule.Sentry Evidence
Trace 1f7d2097 (Web, Safari/Mac, 13.6s, manual expense): The user clicked Submit, then navigated back and discarded changes (breadcrumbs show "Discard changes" button tap, navigation back to manual start page). Despite never completing the submission, the span ran for 13.6s and ended with
finished_manually: true. This pollutes metrics with durations that don't represent real submit-to-visible time.Fixed Issues
$ #94464
PROPOSAL: N/A
Tests
[Sentry][ManualSubmitToDestinationVisible] Ending spanlog appears withoutcanceled: true(either no log at all, or it showscanceled: true)[Sentry][ManualSubmitToDestinationVisible] Ending span (Xms)appears with a sub-two-second duration and nocanceled: true[Sentry][ManualSubmitToDestinationVisible] Ending span (Xms)appears with a sub-two-second duration and nocanceled: trueOffline tests
N/A
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch 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.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
Web.mov