Adds regression coverage asserting that an over-cap money account deposit
reports `alert_triggered: ['deposit_limit']` on the transaction event
fragment, that the alert survives the per-type exclusion filter, and that it
is reported as resolved once confirmed.
This is the extension counterpart to the Mobile work in CONF-2194. On Mobile
the same instrumentation was entirely dark: the alert was never registered in
`useConfirmationAlerts`, it only read an explicit `pendingAmount` argument, and
`trackAlertMetrics` lived inside a Footer that returns `null` for money
account deposits.
None of those three defects exist here. The alert is already registered
(`useConfirmationAlerts.ts:58`), already falls back to the committed amount
when called without arguments, and `useConfirmationAlertMetrics` is mounted in
the `ConfirmAlerts` provider above the page rather than inside the Footer, so
the Footer's `SingleActionFooter` divergence for money account deposits cannot
suppress it.
The only gap was that no test pinned the deposit limit to its metrics name, so
a future change to `ALERTS_NAME_METRICS`, to the exclusion list, or to where
the metrics hook is mounted could silently repeat the Mobile regression.
No production code change.
Description
Counterpart to the Mobile work in CONF-2194 (metamask-mobile#38715), where the
deposit_limitalert was completely absent from Mixpanel — zeroTransaction Added/Submitted/Rejected/Finalizedevents carried it between 2025-01-01 and 2026-10-26.The headline result: that bug does not reproduce here, so this PR contains no production code change.
I verified each of the three Mobile defects against this codebase:
useConfirmationAlertsuseConfirmationAlerts.ts:58pendingAmountarg, so bare calls saw0primaryRequiredToken.amountFiat ?? amountUsd—useTransactionDepositLimitAlert.ts:42-54trackAlertMetricslived in aFooterthat early-returnsnullfor money-account depositsConfirmAlertsprovider atconfirm.tsx:32, above<Footer />atconfirm.tsx:48That third point is the important one. The Footer here does diverge for money-account deposits —
isSingleActionFooterConfirmation(footer.tsx:94-124) routesmoneyAccountDeposit,moneyAccountWithdraw,musdConversion,perpsDeposit,perpsWithdrawto aSingleActionFooter, which is the same failure shape as Mobile. But because the metrics hook sits two levels up in a pass-through provider with no early returns, no conditionals (confirm-alerts.tsx:8-28), the Footer's divergence cannot suppress the metric.There is also a structural reason the Mobile "uncommitted amount" problem can't occur: Mobile gates the commit behind a Done button that the cap itself disables, so an over-cap amount is never persisted. Here
useTransactionCustomAmountauto-commits on a debounce (:198-221) with no blocking gate, so the over-cap value does reachprimaryRequiredTokenand the committed fallback sees it.What this PR actually does
The one real gap was test coverage: nothing pinned
AlertsName.DepositLimitto its'deposit_limit'metrics name, or asserted it survives the per-transaction-type exclusion filter. So a future edit toALERTS_NAME_METRICS(useConfirmationAlertMetrics.ts:28), toEXCLUDED_ALERT_KEYS_BY_TRANSACTION_TYPE(:53-58), or to whereConfirmAlertsis mounted could silently reintroduce the Mobile regression with nothing failing.Three tests added to
useConfirmationAlertMetrics.test.ts:alert_triggered: ['deposit_limit']hexDataWhileInteractingWithNonContractAddressfor this transaction typealert_resolvedonce confirmedThese pass against current
main, which is the evidence that the pipeline already works end to end rather than an assertion that it should.Two differences from Mobile worth noting for reviewers
alert_triggered/alert_triggered_count; Mobile emitsalert_trigger_name/alert_trigger_count. Anyone querying both clients needs both names.fiat_buy_amount_limitdoes not exist here at all — nouseFiatBuyLimitAlert, noAlertsNamemember. On Mobile that alert was also dark and got fixed incidentally. Nothing to port.Changelog
CHANGELOG entry: null
Related issues
Fixes: CONF-2222
Refs: CONF-2194 · metamask-mobile#38715
Manual testing steps
No user-facing change; the production behaviour is already correct. To confirm the instrumentation by hand:
confirmations_pay_extended.depositLimit.moneyAccountDepositto a low value (e.g.100).alert_triggeredcontainsdeposit_limit.Automated:
yarn jest ui/pages/confirmations/hooks/useConfirmationAlertMetrics.test.ts— 16 passed.Screenshots/Recordings
N/A — test-only change, no UI impact.
Before
N/A
After
N/A
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Test-only change with no runtime or analytics pipeline modifications.
Overview
This PR adds test-only coverage for the money-account deposit limit alert in
useConfirmationAlertMetrics— no production code changes.A new
deposit limitdescribe block adds three cases: over-cap money-account deposits emitalert_triggered: ['deposit_limit'],deposit_limitis not filtered by the same per-type exclusion that dropshexDataWhileInteractingWithNonContractAddress, and a user-confirmed deposit limit alert appears inalert_resolved. Together they lock the existingAlertsName.DepositLimit→deposit_limitmapping and behavior so future edits to metrics naming or exclusion rules cannot silently drop the alert (as happened on Mobile).Reviewed by Cursor Bugbot for commit cc3c76a. Bugbot is set up for automated code reviews on this repo. Configure here.