Skip to content

Repoint account primary wallet so merge mail is delivered#3843

Merged
TaprootFreak merged 1 commit into
developfrom
fix/account-merge-mail-wallet
Jun 9, 2026
Merged

Repoint account primary wallet so merge mail is delivered#3843
TaprootFreak merged 1 commit into
developfrom
fix/account-merge-mail-wallet

Conversation

@TaprootFreak

Copy link
Copy Markdown
Collaborator

Summary

Data-only migration that re-points one account's primary user_data.walletId from a wallet that disables the Info mail type to the default DFX Wallet (id 1, mailConfig = NULL).

This unblocks the account-merge confirmation mail for that account: ACCOUNT_MERGE_REQUEST is classified as MailContextType.INFO, and the account's primary wallet had Info in its mailConfig, so the mail was silently suppressed (mail.factory.ts isDisabledMailWalletcreateMail returns undefinednotification.service.ts:26 sendMail returns without persisting). After re-pointing, resolveMailWallet (notification.service.ts:135) falls back to the default wallet (no Info opt-out) and the mail is delivered.

This PR is a targeted data fix only. The systemic bug (mandatory merge mail being suppressible because it lives in the Info bucket) is documented separately in #3842 and intentionally not fixed here.

Details

  • New migration migration/1780993625289-RepointAccountWalletForMergeMail.js, hand-written in the style of the existing data migration 1779381590531-RouteScryptEurViaUsdt.js.
  • Env-guarded: up() only acts when the row is in the expected pre-state (walletId = 67); it is a no-op on environments where the row/state differs. down() reverses it with a symmetric guard.
  • PostgreSQL syntax (double-quoted identifiers); passes the migration-psql-check guard test.

Tradeoff

user_data.wallet also influences fee verification (fee.service.ts:201), auto-trade-approval (auth.service.ts:423) and mail branding. Re-pointing to the default wallet changes these bindings for this account — accepted as the intended outcome.

PR completeness

  • Migration (data-only; no entity/column changes)
  • Environment/Infrastructure — n/a
  • Service updates — n/a (no DTO/interface changes)
  • Frontend synchronization — n/a (no API contract changes)

Test plan

  • npx jest migration-psql-check passes (PostgreSQL compatibility)
  • npm run type-check passes
  • Migration is env-guarded and idempotent; re-runs are no-ops

Relates to #3842

@TaprootFreak TaprootFreak marked this pull request as ready for review June 9, 2026 08:40
@TaprootFreak TaprootFreak requested a review from davidleomay as a code owner June 9, 2026 08:40
@TaprootFreak TaprootFreak merged commit ab5f23c into develop Jun 9, 2026
8 checks passed
@TaprootFreak TaprootFreak deleted the fix/account-merge-mail-wallet branch June 9, 2026 08:45
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.

2 participants