fix: mm_pay_time_to_complete_s is logging incorrect (too low) values#27862
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #27862 +/- ##
==========================================
+ Coverage 82.46% 82.51% +0.04%
==========================================
Files 4801 4804 +3
Lines 123807 124003 +196
Branches 27602 27636 +34
==========================================
+ Hits 102101 102322 +221
+ Misses 14634 14604 -30
- Partials 7072 7077 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…mask-mobile into mm_pay_metrics_fix
| addTimeToComplete( | ||
| properties, | ||
| eventType, | ||
| getLatestChildSubmittedTime(transactionMeta, allTransactions), |
There was a problem hiding this comment.
Could we call this inside addTimeToComplete to avoid unnecessary logic until finalized?
And just pass allTransactions to addTimeToComplete?
| .filter( | ||
| (tx) => | ||
| requiredTransactionIds?.includes(tx.id) || | ||
| (batchId && tx.batchId === batchId && tx.id !== transactionMeta.id), |
There was a problem hiding this comment.
Batch ID should be irrelevant as we no longer use the bridge strategy.
|
|
||
| if (hasTransactionType(transactionMeta, PAY_TYPES) || properties.mm_pay) { | ||
| addTimeToComplete(properties, eventType, transactionMeta.submittedTime); | ||
| addTimeToComplete( |
There was a problem hiding this comment.
Minor, could we remove the duplication condition, maybe assign a variable? Or re-work the conditions?
matthewwalsh0
left a comment
There was a problem hiding this comment.
Just clarifications regarding filtering.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
|
✅ E2E Fixture Validation — Schema is up to date |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
The only consumer of Performance Test Selection: |
|




Description
Fix time calculation for metrics
mm_pay_time_to_complete_s. Replace the use of submittedTime in current transaction to latest submitted time of child transactions.Changelog
CHANGELOG entry:
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/CONF-1086
Manual testing steps
Screenshots/Recordings
NA
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes MetaMask Pay analytics attribution logic (parent/child relationships and completion time calculation), which can affect reporting correctness across multi-transaction flows. Risk is moderate due to reliance on
requiredTransactionIds(removingbatchId/nonce ordering) and updated tests covering new behavior.Overview
Fixes
mm_pay_time_to_complete_sto avoid under-reporting by computing completion time from the latestsubmittedTimeamong a parent MM Pay transaction’srequiredTransactionIds, instead of using the current transaction’ssubmittedTime.Simplifies transaction linkage and step calculation by dropping
batchId/nonce-based grouping and relying solely onrequiredTransactionIdsto find parents and order steps; updates unit tests accordingly (including asserting the metric is not emitted for finalized child transactions).Written by Cursor Bugbot for commit 22bbd5c. This will update automatically on new commits. Configure here.