From 4c1a9f66812bc5852aad41a5de0a4860f5f1123c Mon Sep 17 00:00:00 2001 From: Wei Sun Date: Wed, 25 Nov 2026 15:35:02 -0700 Subject: [PATCH 1/3] fix: upgrade mockttp to 4.6.5 to resolve @graphql-tools/utils advisory --- .yarnrc.yml | 2 - jest.config.js | 4 + package.json | 9 +- tests/api-mocking/define-api-mock.test.ts | 3 + tests/api-mocking/helpers/cryptoRandomUUID.ts | 11 + tests/api-mocking/helpers/mockHelpers.test.ts | 3 + .../OAuthMockttpService.test.ts | 3 + tests/smoke/identity/utils/mocks.ts | 2 +- .../userStorageMockttpController.test.ts | 3 + yarn.lock | 307 +++++++++--------- 10 files changed, 183 insertions(+), 164 deletions(-) create mode 100644 tests/api-mocking/helpers/cryptoRandomUUID.ts diff --git a/.yarnrc.yml b/.yarnrc.yml index e47b7bf2931b..51d9b56ef1b0 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -57,8 +57,6 @@ npmAuditIgnoreAdvisories: # follow-redirects (MCWP-1147) - '1242605' # GHSA-8r9p-f939-6h3c high - '1244003' # GHSA-mrwp-f3q8-3g9p high - # @graphql-tools/utils (MCWP-1041) - - '1241230' # GHSA-7mx3-vvmw-hjmv high # @grpc/grpc-js (MCWP-1042) - '1240623' # GHSA-m9gg-hp2v-232j high # ip-address (MCWP-1054) diff --git a/jest.config.js b/jest.config.js index f1cbf3787066..fa58c3876edc 100644 --- a/jest.config.js +++ b/jest.config.js @@ -73,6 +73,10 @@ const DEPENDENCIES_TO_TRANSPILE = [ '@mswjs/interceptors', '@open-draft/until', 'rettime', + // mockttp 4.x depends on ESM-only milliparsec and get-port 7 (installed nested under mockttp). + 'milliparsec', + 'mockttp/node_modules/get-port', + 'get-port', 'react-native-wagmi-charts', 'react-native-nitro-modules', '@notifee', diff --git a/package.json b/package.json index d8a324afb4e5..0ea0bacc257e 100644 --- a/package.json +++ b/package.json @@ -204,7 +204,6 @@ "@react-native-community/viewpager": "patch:@react-native-community/viewpager@npm%3A3.3.0#~/.yarn/patches/@react-native-community-viewpager-npm-3.3.0.patch", "@solana-mobile/mobile-wallet-adapter-protocol": "^2.2.5", "@appium/schema/json-schema": "^0.4.0", - "@metamask/react-native-payments/validator": "^13.7.0", "@unrs/resolver-binding-wasm32-wasi": "npm:npm-empty-package@1.0.0", "d3-color": "3.1.0", "napi-postinstall": "npm:npm-empty-package@1.0.0", @@ -343,8 +342,7 @@ "http-proxy@npm:^1.18.1/follow-redirects": "1.16.3", "@open-rpc/server-js@npm:1.9.3/body-parser": "1.20.9", "@react-native-community/cli-server-api@npm:20.1.0/body-parser": "1.20.9", - "express@npm:4.22.2/body-parser": "1.20.9", - "mockttp@npm:3.15.2/body-parser": "1.20.9" + "express@npm:4.22.2/body-parser": "1.20.9" }, "dependencies": { "@braze/react-native-sdk": "23.0.0", @@ -603,7 +601,7 @@ "lodash": "4.18.1", "lottie-react-native": "~7.3.8", "luxon": "^3.5.0", - "mockttp": "^3.15.2", + "mockttp": "^4.6.5", "multihashes": "0.4.14", "number-to-bn": "1.7.0", "pako": "^2.1.0", @@ -975,7 +973,8 @@ "@metamask/transaction-pay-controller>@metamask/keyring-controller>ethereumjs-wallet>ethereum-cryptography>keccak": false, "eas-cli>@expo/logger>bunyan>dtrace-provider": false, "appium-uiautomator2-driver>appium-android-driver>appium-chromedriver>@appium/base-driver>@appium/support>sharp": false, - "appium-xcuitest-driver>appium-ios-remotexpc>appium-ios-tuntap": false + "appium-xcuitest-driver>appium-ios-remotexpc>appium-ios-tuntap": false, + "mockttp>tls-impersonate": false } }, "packageManager": "yarn@4.14.1+sha256.5c7a0c5ea1c5b690df603c8e16b3742f87169b814d56bb5e63881145e8a84033", diff --git a/tests/api-mocking/define-api-mock.test.ts b/tests/api-mocking/define-api-mock.test.ts index 9e3accab40b7..946062a5c2c1 100644 --- a/tests/api-mocking/define-api-mock.test.ts +++ b/tests/api-mocking/define-api-mock.test.ts @@ -5,6 +5,7 @@ import { SPEC_MOCK_PRIORITY, } from './define-api-mock.ts'; import { setupMockRequest } from './helpers/mockHelpers.ts'; +import { installCryptoRandomUUID } from './helpers/cryptoRandomUUID.ts'; import { API_MOCKS, accountsSupportedNetworksV2, @@ -13,6 +14,8 @@ import { spotPrice, } from './api-mocks.ts'; +beforeAll(installCryptoRandomUUID); + interface Item { name: string; nested: { a: number; b: number }; diff --git a/tests/api-mocking/helpers/cryptoRandomUUID.ts b/tests/api-mocking/helpers/cryptoRandomUUID.ts new file mode 100644 index 000000000000..461b1ba2d2ac --- /dev/null +++ b/tests/api-mocking/helpers/cryptoRandomUUID.ts @@ -0,0 +1,11 @@ +/* eslint-disable import-x/no-nodejs-modules */ +import { randomUUID } from 'node:crypto'; + +/** + * mockttp 4 calls `globalThis.crypto.randomUUID()`, which the shared Jest + * crypto stub in `app/util/test/testSetup.js` does not provide. Call this in + * unit tests that start a local mockttp server. + */ +export const installCryptoRandomUUID = (): void => { + globalThis.crypto.randomUUID = randomUUID; +}; diff --git a/tests/api-mocking/helpers/mockHelpers.test.ts b/tests/api-mocking/helpers/mockHelpers.test.ts index 4eff1d767a1e..556298440333 100644 --- a/tests/api-mocking/helpers/mockHelpers.test.ts +++ b/tests/api-mocking/helpers/mockHelpers.test.ts @@ -9,6 +9,9 @@ import { setupMockRequest, type SeenProxiedRequest, } from './mockHelpers.ts'; +import { installCryptoRandomUUID } from './cryptoRandomUUID.ts'; + +beforeAll(installCryptoRandomUUID); describe('processPostRequestBody', () => { describe('basic functionality', () => { diff --git a/tests/api-mocking/seedless-onboarding/OAuthMockttpService.test.ts b/tests/api-mocking/seedless-onboarding/OAuthMockttpService.test.ts index fba1c1f0adcd..7a6f88b7827e 100644 --- a/tests/api-mocking/seedless-onboarding/OAuthMockttpService.test.ts +++ b/tests/api-mocking/seedless-onboarding/OAuthMockttpService.test.ts @@ -3,6 +3,9 @@ import { getLocal, type Mockttp } from 'mockttp'; import { QAMockOAuthService } from '../../../app/core/OAuthService/QAMockOAuthService'; import { AuthServer } from './constants'; import { createOAuthMockttpService } from './OAuthMockttpService'; +import { installCryptoRandomUUID } from '../helpers/cryptoRandomUUID'; + +beforeAll(installCryptoRandomUUID); describe('OAuthMockttpService', () => { let mockServer: Mockttp; diff --git a/tests/smoke/identity/utils/mocks.ts b/tests/smoke/identity/utils/mocks.ts index b57fe6baa4f6..b7147e12402f 100644 --- a/tests/smoke/identity/utils/mocks.ts +++ b/tests/smoke/identity/utils/mocks.ts @@ -122,7 +122,7 @@ async function mockAPICall(server: Mockttp, response: MockResponse) { const decodedPath = getDecodedProxiedURL(url); const [requestBodyJson, requestBodyText] = await Promise.all([ - body.getJson(), + body.getJson(), body.getText(), ]); const requestBody = requestBodyJson ?? requestBodyText; diff --git a/tests/smoke/identity/utils/user-storage/userStorageMockttpController.test.ts b/tests/smoke/identity/utils/user-storage/userStorageMockttpController.test.ts index 59cae091e4da..0c4a9a511ac6 100644 --- a/tests/smoke/identity/utils/user-storage/userStorageMockttpController.test.ts +++ b/tests/smoke/identity/utils/user-storage/userStorageMockttpController.test.ts @@ -2,6 +2,9 @@ import { CompletedBody, getLocal, Mockttp } from 'mockttp'; import { UserStorageMockttpController } from './userStorageMockttpController'; import { USER_STORAGE_FEATURE_NAMES } from '@metamask/profile-sync-controller/sdk'; import { MOCK_SRP_E2E_IDENTIFIER_BASE_KEY } from '../mocks'; +import { installCryptoRandomUUID } from '../../../../api-mocking/helpers/cryptoRandomUUID'; + +beforeAll(installCryptoRandomUUID); describe('UserStorageMockttpController', () => { let mockServer: Mockttp; diff --git a/yarn.lock b/yarn.lock index 5fd1d262eee8..cc71c858773e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7284,51 +7284,51 @@ __metadata: languageName: node linkType: hard -"@graphql-tools/merge@npm:8.3.1": - version: 8.3.1 - resolution: "@graphql-tools/merge@npm:8.3.1" +"@graphql-tools/merge@npm:^9.2.8": + version: 9.2.8 + resolution: "@graphql-tools/merge@npm:9.2.8" dependencies: - "@graphql-tools/utils": "npm:8.9.0" + "@graphql-tools/utils": "npm:^12.1.0" tslib: "npm:^2.4.0" peerDependencies: graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 - checksum: 10/9354a68aa1b851ee72d2d727a3a264279f1e5ed95100f6c6e7e0a2ad7449943d2ebe6fce43b4873a15e5c3e9df52ea9d23ff51ffc1f73c417c4ccf368f8486ab + checksum: 10/f5f45f7c432b7e019c4d4fdf042da790f8833afbae7be17ea25d57de270d257453558b352e25d31916bff5bfd0e4d33f9608af8ad55433edf3c0e8039b3c5f5f languageName: node linkType: hard -"@graphql-tools/schema@npm:^8.5.0": - version: 8.5.1 - resolution: "@graphql-tools/schema@npm:8.5.1" +"@graphql-tools/schema@npm:^10.0.31": + version: 10.1.5 + resolution: "@graphql-tools/schema@npm:10.1.5" dependencies: - "@graphql-tools/merge": "npm:8.3.1" - "@graphql-tools/utils": "npm:8.9.0" + "@graphql-tools/merge": "npm:^9.2.8" + "@graphql-tools/utils": "npm:^12.1.0" tslib: "npm:^2.4.0" - value-or-promise: "npm:1.0.11" peerDependencies: graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 - checksum: 10/98f57502cc67ee48157bcf6f26c334e27b0673ec6f5a35c1a5bc1901772063c8bfdca435f81664ab1a41f9274b43dc78aa12791feee83546640d0a034b38c836 + checksum: 10/e1186178bfcc585a44d31e0293d58bbea8e3a1f4699f29a7d66bc554432d00f6fbc06be9f63496e9b42f31e2344176a8ff8135cd55405093cf0a58cc80985cd3 languageName: node linkType: hard -"@graphql-tools/utils@npm:8.9.0": - version: 8.9.0 - resolution: "@graphql-tools/utils@npm:8.9.0" +"@graphql-tools/utils@npm:^12.0.3, @graphql-tools/utils@npm:^12.1.0": + version: 12.1.0 + resolution: "@graphql-tools/utils@npm:12.1.0" dependencies: + "@graphql-typed-document-node/core": "npm:^3.1.1" + "@whatwg-node/promise-helpers": "npm:^2.0.0" + cross-inspect: "npm:1.0.1" tslib: "npm:^2.4.0" peerDependencies: graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 - checksum: 10/de5930b33664c53f0d22781bb16b4e029afaad165539faf80bd520adfad969c024891db672a2ff96195d8d1185bac66b284ebde67938e554d04c0798453da002 + checksum: 10/337225844f139312e364cef441372503ba0b6240d1a266873852daed83b11d721a809f0ac3b221e645ae67e22e9a8fdbec43a4b02aa8c141608770ba65913c82 languageName: node linkType: hard -"@graphql-tools/utils@npm:^8.8.0": - version: 8.13.1 - resolution: "@graphql-tools/utils@npm:8.13.1" - dependencies: - tslib: "npm:^2.4.0" +"@graphql-typed-document-node/core@npm:^3.1.1": + version: 3.2.0 + resolution: "@graphql-typed-document-node/core@npm:3.2.0" peerDependencies: - graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 - checksum: 10/b3679e43f6cbde26924dc6eabc5b45fe1481aac5793487284750167749c2b46f5e44ab0344f8264f8cfa657901348d8cf566c54c3c9eca2c403cb69039edf766 + graphql: ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 + checksum: 10/fa44443accd28c8cf4cb96aaaf39d144a22e8b091b13366843f4e97d19c7bfeaf609ce3c7603a4aeffe385081eaf8ea245d078633a7324c11c5ec4b2011bb76d languageName: node linkType: hard @@ -7381,12 +7381,12 @@ __metadata: languageName: node linkType: hard -"@httptoolkit/httpolyglot@npm:^2.2.1": - version: 2.2.1 - resolution: "@httptoolkit/httpolyglot@npm:2.2.1" +"@httptoolkit/httpolyglot@npm:^3.1.0": + version: 3.1.0 + resolution: "@httptoolkit/httpolyglot@npm:3.1.0" dependencies: "@types/node": "npm:*" - checksum: 10/97ff0ef69251dfb0d526e0bfdcde44ffcbdc31a3ea6c42f48ef1dc2ec570787def8c1cb42dc8da6640eb91507e6afd70e622048bcac2199bc890c8e6eb4f5c22 + checksum: 10/6cacd1e5ca6798c26fe6f336e522cb38121ee6f94db17a39c56b628d5416ed9905587b2799f78aa2111a7c577fe9c3e05eed4f6853cf3ea89a9a8a572adeae07 languageName: node linkType: hard @@ -7405,6 +7405,13 @@ __metadata: languageName: node linkType: hard +"@httptoolkit/util@npm:^0.1.7": + version: 0.1.9 + resolution: "@httptoolkit/util@npm:0.1.9" + checksum: 10/b9f22f55e7d58bf979f18d9fcd256cc0d284065a678e8d9095a79017615e5a0d177d5c1125ab90469088ae0f75dfe76b29a3273fa293d84709e57f8f8feec6ff + languageName: node + linkType: hard + "@httptoolkit/websocket-stream@npm:^6.0.1": version: 6.0.1 resolution: "@httptoolkit/websocket-stream@npm:6.0.1" @@ -14491,7 +14498,7 @@ __metadata: languageName: node linkType: hard -"@peculiar/x509@npm:^1.14.2": +"@peculiar/x509@npm:^1.12.3, @peculiar/x509@npm:^1.14.2": version: 1.14.3 resolution: "@peculiar/x509@npm:1.14.3" dependencies: @@ -23134,6 +23141,15 @@ __metadata: languageName: node linkType: hard +"@whatwg-node/promise-helpers@npm:^2.0.0": + version: 2.0.2 + resolution: "@whatwg-node/promise-helpers@npm:2.0.2" + dependencies: + tslib: "npm:^2.9.1" + checksum: 10/37584aa989e9a42de755e00a793fc88941a03f22bd290f821dd938f133268f60bfcc596524f9190bbd199533aec4a2d1d3e40ed5e47e63d018d428fdba56e841 + languageName: node + linkType: hard + "@xmldom/xmldom@npm:0.8.15, @xmldom/xmldom@npm:^0.8.15, @xmldom/xmldom@npm:^0.8.8": version: 0.8.15 resolution: "@xmldom/xmldom@npm:0.8.15" @@ -23422,7 +23438,7 @@ __metadata: languageName: node linkType: hard -"agent-base@npm:6, agent-base@npm:^6.0.2": +"agent-base@npm:6": version: 6.0.2 resolution: "agent-base@npm:6.0.2" dependencies: @@ -24487,7 +24503,7 @@ __metadata: languageName: node linkType: hard -"async@npm:^2.4.0, async@npm:^2.6.0, async@npm:^2.6.4": +"async@npm:^2.4.0, async@npm:^2.6.0": version: 2.6.4 resolution: "async@npm:2.6.4" dependencies: @@ -25091,13 +25107,6 @@ __metadata: languageName: node linkType: hard -"base64-arraybuffer@npm:^0.1.5": - version: 0.1.5 - resolution: "base64-arraybuffer@npm:0.1.5" - checksum: 10/fea6fb059b5f043c0c1d291591bf48a5901ddb0b193800d39ab30afc2809ecadeecfaec6b3089c50a8956eeedec6fe6d8cbf6c0f90e3f484e74f0c9a9bb872ea - languageName: node - linkType: hard - "base64-arraybuffer@npm:^1.0.2": version: 1.0.2 resolution: "base64-arraybuffer@npm:1.0.2" @@ -27403,13 +27412,6 @@ __metadata: languageName: node linkType: hard -"cors-gate@npm:^1.1.3": - version: 1.1.3 - resolution: "cors-gate@npm:1.1.3" - checksum: 10/161e36480d41ae11c16389267622f58b6bc69b12a28558aa3a972b44d851b92b62e11a8632cea5f0da1d48665a53c4992297e669d881e482837713e375300e1e - languageName: node - linkType: hard - "cors@npm:^2.8.4, cors@npm:^2.8.5": version: 2.8.5 resolution: "cors@npm:2.8.5" @@ -27585,7 +27587,7 @@ __metadata: languageName: node linkType: hard -"cross-fetch@npm:^3.1.4, cross-fetch@npm:^3.1.5": +"cross-fetch@npm:^3.1.4": version: 3.2.0 resolution: "cross-fetch@npm:3.2.0" dependencies: @@ -27603,6 +27605,15 @@ __metadata: languageName: node linkType: hard +"cross-inspect@npm:1.0.1": + version: 1.0.1 + resolution: "cross-inspect@npm:1.0.1" + dependencies: + tslib: "npm:^2.4.0" + checksum: 10/7c1e02e0a9670b62416a3ea1df7ae880fdad3aa0a857de8932c4e5f8acd71298c7e3db9da8e9da603f5692cd1879938f5e72e34a9f5d1345987bef656d117fc1 + languageName: node + linkType: hard + "cross-spawn@npm:7.0.6, cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.3, cross-spawn@npm:^7.0.5, cross-spawn@npm:^7.0.6": version: 7.0.6 resolution: "cross-spawn@npm:7.0.6" @@ -28259,7 +28270,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.2.0, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4, debug@npm:^4.3.5, debug@npm:^4.4.0, debug@npm:^4.4.1, debug@npm:^4.4.3, debug@npm:~4.4.1": +"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.2.0, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.4, debug@npm:^4.3.5, debug@npm:^4.4.0, debug@npm:^4.4.1, debug@npm:^4.4.3, debug@npm:~4.4.1": version: 4.4.3 resolution: "debug@npm:4.4.3" dependencies: @@ -28295,7 +28306,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:^3.1.0, debug@npm:^3.2.7": +"debug@npm:^3.1.0": version: 3.2.7 resolution: "debug@npm:3.2.7" dependencies: @@ -28745,12 +28756,12 @@ __metadata: languageName: node linkType: hard -"destroyable-server@npm:^1.0.2": - version: 1.0.2 - resolution: "destroyable-server@npm:1.0.2" +"destroyable-server@npm:^1.1.1": + version: 1.1.1 + resolution: "destroyable-server@npm:1.1.1" dependencies: "@types/node": "npm:*" - checksum: 10/c93c7651dac530bf9dd4263eab59f5724a2453dc35658d98e3707c4c9171d8496ef404655852bef257586b31850f4f6730397bc5ff496ed799352660b0495a0a + checksum: 10/483867c0ee3adb6f265e0163ea5f204135a30cd2b14ef07f58054186f63cc12ca7c591431b30cb664216e1bdc3156d50c74b56c3e17f67a5e75b0d32f0fe84f5 languageName: node linkType: hard @@ -31963,7 +31974,7 @@ __metadata: languageName: node linkType: hard -"express@npm:^4.14.0, express@npm:^4.22.1": +"express@npm:^4.22.1": version: 4.22.2 resolution: "express@npm:4.22.2" dependencies: @@ -33119,6 +33130,13 @@ __metadata: languageName: node linkType: hard +"get-port@npm:^7.2.0": + version: 7.2.0 + resolution: "get-port@npm:7.2.0" + checksum: 10/f8785ccdcc52b1e03f1b1de3fcd46dbc41fe4079e234f2727c3e154ca76bb94318fb0d341daa28a6c87eff24ad4016eaa8b1b4e26eff0d6a2196dd1c1ffc63a1 + languageName: node + linkType: hard + "get-proto@npm:^1.0.0, get-proto@npm:^1.0.1": version: 1.0.1 resolution: "get-proto@npm:1.0.1" @@ -33449,14 +33467,14 @@ __metadata: languageName: node linkType: hard -"graphql-subscriptions@npm:^1.1.0": - version: 1.2.1 - resolution: "graphql-subscriptions@npm:1.2.1" +"graphql-subscriptions@npm:^2.0.0": + version: 2.0.0 + resolution: "graphql-subscriptions@npm:2.0.0" dependencies: iterall: "npm:^1.3.0" peerDependencies: - graphql: ^0.10.5 || ^0.11.3 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 - checksum: 10/6dfc0bf278b595c7d99b577e05902d18cd0e56c8c060892ccba7651ff1a49218c7cdd5a8e811fcb9071b98492d238609ba6f326129f5cb0f5433c993671e2d14 + graphql: ^15.7.2 || ^16.0.0 + checksum: 10/fcf47bd8cef90f3d38f07b49b4b0e70514c22d56e3604a6cde03a250d3129a6c5b3e8420953a6fe5dab68e48d092a4d13fa39bcc61610bdd6c4a0804b9ee2f82 languageName: node linkType: hard @@ -33478,10 +33496,10 @@ __metadata: languageName: node linkType: hard -"graphql@npm:^14.0.2 || ^15.5": - version: 15.9.0 - resolution: "graphql@npm:15.9.0" - checksum: 10/ce1f50672bcb369395d07a47048bcbb429ed1ce06dbcafb7a0999df791cb7aa7206be21497907973dbc8a01df3cd7f632f43c583f248538f186f5adfa1a0d1c5 +"graphql@npm:^14.0.2 || ^15.5 || ^16.0.0": + version: 16.15.0 + resolution: "graphql@npm:16.15.0" + checksum: 10/95f0932151ff65ff4bbfb0ff4fea14c280fc811c2b4ddf3841e9e6e1ac1d6ba42e8171161463822024e785f554a66ed7842ae9b827fa0ad43776b55a6eca08bb languageName: node linkType: hard @@ -37723,7 +37741,7 @@ __metadata: languageName: node linkType: hard -"lru-cache@npm:^7.14.0, lru-cache@npm:^7.14.1": +"lru-cache@npm:^7.14.1": version: 7.18.3 resolution: "lru-cache@npm:7.18.3" checksum: 10/6029ca5aba3aacb554e919d7ef804fffd4adfc4c83db00fac8248c7c78811fb6d4b6f70f7fd9d55032b3823446546a007edaa66ad1f2377ae833bd983fac5d98 @@ -38726,7 +38744,7 @@ __metadata: lodash: "npm:4.18.1" lottie-react-native: "npm:~7.3.8" luxon: "npm:^3.5.0" - mockttp: "npm:^3.15.2" + mockttp: "npm:^4.6.5" multihashes: "npm:0.4.14" nock: "npm:^15.0.6" number-to-bn: "npm:1.7.0" @@ -39648,6 +39666,13 @@ __metadata: languageName: node linkType: hard +"milliparsec@npm:^5.1.1": + version: 5.1.2 + resolution: "milliparsec@npm:5.1.2" + checksum: 10/fb276eb7be54f5bfd71c58b2bc59b3e14b7efc42a8827d8430ba23c626af0322c106e182aeb092117891175d8954e78bede18f124348e91e2bff4d16f26ef5b8 + languageName: node + linkType: hard + "mime-db@npm:1.52.0": version: 1.52.0 resolution: "mime-db@npm:1.52.0" @@ -39993,23 +40018,23 @@ __metadata: languageName: node linkType: hard -"mkdirp@npm:^0.5.6, mkdirp@npm:~0.5.1": - version: 0.5.6 - resolution: "mkdirp@npm:0.5.6" - dependencies: - minimist: "npm:^1.2.6" +"mkdirp@npm:^1.0.4": + version: 1.0.4 + resolution: "mkdirp@npm:1.0.4" bin: mkdirp: bin/cmd.js - checksum: 10/0c91b721bb12c3f9af4b77ebf73604baf350e64d80df91754dc509491ae93bf238581e59c7188360cec7cb62fc4100959245a42cfe01834efedc5e9d068376c2 + checksum: 10/d71b8dcd4b5af2fe13ecf3bd24070263489404fe216488c5ba7e38ece1f54daf219e72a833a3a2dc404331e870e9f44963a33399589490956bff003a3404d3b2 languageName: node linkType: hard -"mkdirp@npm:^1.0.4": - version: 1.0.4 - resolution: "mkdirp@npm:1.0.4" +"mkdirp@npm:~0.5.1": + version: 0.5.6 + resolution: "mkdirp@npm:0.5.6" + dependencies: + minimist: "npm:^1.2.6" bin: mkdirp: bin/cmd.js - checksum: 10/d71b8dcd4b5af2fe13ecf3bd24070263489404fe216488c5ba7e38ece1f54daf219e72a833a3a2dc404331e870e9f44963a33399589490956bff003a3404d3b2 + checksum: 10/0c91b721bb12c3f9af4b77ebf73604baf350e64d80df91754dc509491ae93bf238581e59c7188360cec7cb62fc4100959245a42cfe01834efedc5e9d068376c2 languageName: node linkType: hard @@ -40025,55 +40050,58 @@ __metadata: languageName: node linkType: hard -"mockttp@npm:^3.15.2": - version: 3.15.2 - resolution: "mockttp@npm:3.15.2" +"mockttp@npm:^4.6.5": + version: 4.6.5 + resolution: "mockttp@npm:4.6.5" dependencies: - "@graphql-tools/schema": "npm:^8.5.0" - "@graphql-tools/utils": "npm:^8.8.0" - "@httptoolkit/httpolyglot": "npm:^2.2.1" + "@graphql-tools/schema": "npm:^10.0.31" + "@graphql-tools/utils": "npm:^12.0.3" + "@httptoolkit/httpolyglot": "npm:^3.1.0" "@httptoolkit/subscriptions-transport-ws": "npm:^0.11.2" + "@httptoolkit/util": "npm:^0.1.7" "@httptoolkit/websocket-stream": "npm:^6.0.1" + "@peculiar/asn1-pkcs8": "npm:^2.9.4" + "@peculiar/asn1-schema": "npm:^2.9.4" + "@peculiar/asn1-x509": "npm:^2.9.4" + "@peculiar/x509": "npm:^1.12.3" "@types/cors": "npm:^2.8.6" "@types/node": "npm:*" async-mutex: "npm:^0.5.0" - base64-arraybuffer: "npm:^0.1.5" - body-parser: "npm:^1.15.2" + base64-arraybuffer: "npm:^1.0.2" cacheable-lookup: "npm:^6.0.0" common-tags: "npm:^1.8.0" connect: "npm:^3.7.0" cors: "npm:^2.8.4" - cors-gate: "npm:^1.1.3" - cross-fetch: "npm:^3.1.5" - destroyable-server: "npm:^1.0.2" - express: "npm:^4.14.0" + destroyable-server: "npm:^1.1.1" + express: "npm:^5.2.1" fast-json-patch: "npm:^3.1.1" - graphql: "npm:^14.0.2 || ^15.5" + get-port: "npm:^7.2.0" + graphql: "npm:^14.0.2 || ^15.5 || ^16.0.0" graphql-http: "npm:^1.22.0" - graphql-subscriptions: "npm:^1.1.0" + graphql-subscriptions: "npm:^2.0.0" graphql-tag: "npm:^2.12.6" http-encoding: "npm:^2.0.1" http2-wrapper: "npm:^2.2.1" - https-proxy-agent: "npm:^5.0.1" + https-proxy-agent: "npm:^7.0.6" isomorphic-ws: "npm:^4.0.1" lodash: "npm:^4.16.4" - lru-cache: "npm:^7.14.0" + milliparsec: "npm:^5.1.1" native-duplexpair: "npm:^1.0.0" - node-forge: "npm:^1.2.1" pac-proxy-agent: "npm:^7.0.0" parse-multipart-data: "npm:^1.4.0" - performance-now: "npm:^2.1.0" - portfinder: "npm:^1.0.32" - read-tls-client-hello: "npm:^1.0.0" + read-tls-client-hello: "npm:^2.0.0" semver: "npm:^7.5.3" - socks-proxy-agent: "npm:^7.0.0" - typed-error: "npm:^3.0.2" - urlpattern-polyfill: "npm:^8.0.0" - uuid: "npm:^8.3.2" - ws: "npm:^8.8.0" + socks-proxy-agent: "npm:^8.0.5" + tls-impersonate: "npm:^0.2.1" + tslib: "npm:^2.8.1" + urlpattern-polyfill: "npm:^10.1.0" + ws: "npm:^8.20.0" + dependenciesMeta: + tls-impersonate: + optional: true bin: mockttp: dist/admin/admin-bin.js - checksum: 10/ee3bdfb25022c8f6f0d697344a04df7b8931ceac95e6b4b870a65821ab18d16d9c81537b6dd7103bf0032902e2a415a3e1854226b4056ba77a0aaefbb2284b07 + checksum: 10/0cc78526e8b853e45845c7b24bc38ef4010100005964f780898ecfe1cdb4c4175c95a651b61c2992094a7347efb42efb49f2db7b0bc9a350afc6b05056b54ab3 languageName: node linkType: hard @@ -42338,13 +42366,6 @@ __metadata: languageName: node linkType: hard -"performance-now@npm:^2.1.0": - version: 2.1.0 - resolution: "performance-now@npm:2.1.0" - checksum: 10/534e641aa8f7cba160f0afec0599b6cecefbb516a2e837b512be0adbe6c1da5550e89c78059c7fabc5c9ffdf6627edabe23eb7c518c4500067a898fa65c2b550 - languageName: node - linkType: hard - "picocolors@npm:1.1.1, picocolors@npm:^1.0.0, picocolors@npm:^1.1.1": version: 1.1.1 resolution: "picocolors@npm:1.1.1" @@ -42666,17 +42687,6 @@ __metadata: languageName: node linkType: hard -"portfinder@npm:^1.0.32": - version: 1.0.32 - resolution: "portfinder@npm:1.0.32" - dependencies: - async: "npm:^2.6.4" - debug: "npm:^3.2.7" - mkdirp: "npm:^0.5.6" - checksum: 10/842058052fb3c3da829589f3f44b13369cf504b16f6ab72fedec78a9438ac3fc53047f5c88a771511b17d6a94f50f83a94cef5fa625027b675d8f7241f7f2185 - languageName: node - linkType: hard - "portscanner@npm:^2.2.0": version: 2.2.0 resolution: "portscanner@npm:2.2.0" @@ -45921,12 +45931,12 @@ __metadata: languageName: node linkType: hard -"read-tls-client-hello@npm:^1.0.0": - version: 1.0.1 - resolution: "read-tls-client-hello@npm:1.0.1" +"read-tls-client-hello@npm:^2.0.0": + version: 2.0.0 + resolution: "read-tls-client-hello@npm:2.0.0" dependencies: "@types/node": "npm:*" - checksum: 10/fefa63605eebb197b6046cb26d7efde16eb24c026edbbca789c30b7b5be7c0dd8e45fb4d32707513dfc4dd468b787b2a46ed8be846f29eac844d6d80710688c6 + checksum: 10/21a3a3164503d8eebee4c3ebd280221e0b968b7506d8e53b536c065324584a2adbe70c7a8d62d67ee8c4eadf5780cafc5ef6e68800e3d0f0b8f851c4391147c2 languageName: node linkType: hard @@ -48227,18 +48237,7 @@ __metadata: languageName: node linkType: hard -"socks-proxy-agent@npm:^7.0.0": - version: 7.0.0 - resolution: "socks-proxy-agent@npm:7.0.0" - dependencies: - agent-base: "npm:^6.0.2" - debug: "npm:^4.3.3" - socks: "npm:^2.6.2" - checksum: 10/26c75d9c62a9ed3fd494df60e65e88da442f78e0d4bc19bfd85ac37bd2c67470d6d4bba5202e804561cda6674db52864c9e2a2266775f879bc8d89c1445a5f4c - languageName: node - linkType: hard - -"socks@npm:^2.6.2, socks@npm:^2.8.3": +"socks@npm:^2.8.3": version: 2.8.3 resolution: "socks@npm:2.8.3" dependencies: @@ -49647,6 +49646,16 @@ __metadata: languageName: node linkType: hard +"tls-impersonate@npm:^0.2.1": + version: 0.2.2 + resolution: "tls-impersonate@npm:0.2.2" + dependencies: + node-gyp: "npm:latest" + node-gyp-build: "npm:^4.8.4" + conditions: (os=linux | os=darwin | os=win32) + languageName: node + linkType: hard + "tmcp@npm:^1.19.4": version: 1.20.0 resolution: "tmcp@npm:1.20.0" @@ -49950,6 +49959,13 @@ __metadata: languageName: node linkType: hard +"tslib@npm:^2.9.1": + version: 2.9.1 + resolution: "tslib@npm:2.9.1" + checksum: 10/20aa8c3282c88f8dd1bf0a62c5b1aa03b35998cbc6db4780f6e84d593ba4ffe232bd967916c6e0f96b9e5d719dade9e329d1b2cfede31043481d8fd13f10ca5f + languageName: node + linkType: hard + "tsscmp@npm:1.0.6": version: 1.0.6 resolution: "tsscmp@npm:1.0.6" @@ -50187,13 +50203,6 @@ __metadata: languageName: node linkType: hard -"typed-error@npm:^3.0.2": - version: 3.2.2 - resolution: "typed-error@npm:3.2.2" - checksum: 10/e35ef8b16ae5681578d4d5201c6e02471b7d7cb21420ba60017982ddbc17c4f529e87ba119f82a259dfb3b3ba8acc40945897cff173cbefe018c5e2f1b66de5e - languageName: node - linkType: hard - "typed-function@npm:^4.2.1": version: 4.2.1 resolution: "typed-function@npm:4.2.1" @@ -50937,20 +50946,13 @@ __metadata: languageName: node linkType: hard -"urlpattern-polyfill@npm:^10.0.0": +"urlpattern-polyfill@npm:^10.0.0, urlpattern-polyfill@npm:^10.1.0": version: 10.1.0 resolution: "urlpattern-polyfill@npm:10.1.0" checksum: 10/a3a5cb577f40e9d14a2bc0e23e540d088ec8c18e52932337c2499a8118f32aa8fa32578f0cddaa189de671964b0f33ba7e008d0784b99804a09a9ff924f87f5a languageName: node linkType: hard -"urlpattern-polyfill@npm:^8.0.0": - version: 8.0.2 - resolution: "urlpattern-polyfill@npm:8.0.2" - checksum: 10/fd86b5c55473f3abbf9ed317b953c9cbb4fa6b3f75f681a1d982fe9c17bbc8d9bcf988f4cf3bda35e2e5875984086c97e177f97f076bb80dfa2beb85d1dd7b23 - languageName: node - linkType: hard - "usb@npm:^2.15.0": version: 2.15.0 resolution: "usb@npm:2.15.0" @@ -51342,13 +51344,6 @@ __metadata: languageName: node linkType: hard -"value-or-promise@npm:1.0.11": - version: 1.0.11 - resolution: "value-or-promise@npm:1.0.11" - checksum: 10/9bd1cf82be5b59ec4a7ee9fa17ca7b3f16165c3ea33ebabe514f7a20e4f88dd11f912900f0279760618eb7fbd5e3bb2a4cf4b351b5fd8e8da69aa2719725e54a - languageName: node - linkType: hard - "varint@npm:^5.0.0": version: 5.0.2 resolution: "varint@npm:5.0.2" @@ -52248,7 +52243,7 @@ __metadata: languageName: node linkType: hard -"ws@npm:*, ws@npm:^8.0.0, ws@npm:^8.11.0, ws@npm:^8.12.1, ws@npm:^8.13.0, ws@npm:^8.18.0, ws@npm:^8.20.1, ws@npm:^8.21.1, ws@npm:^8.5.0, ws@npm:^8.8.0": +"ws@npm:*, ws@npm:^8.0.0, ws@npm:^8.11.0, ws@npm:^8.12.1, ws@npm:^8.13.0, ws@npm:^8.18.0, ws@npm:^8.20.0, ws@npm:^8.20.1, ws@npm:^8.21.1, ws@npm:^8.5.0, ws@npm:^8.8.0": version: 8.23.0 resolution: "ws@npm:8.23.0" peerDependencies: From 027a7a7471cf067d0f1903e53b5d57febc8cd578 Mon Sep 17 00:00:00 2001 From: Wei Sun Date: Wed, 25 Nov 2026 16:02:21 -0700 Subject: [PATCH 2/3] yarn dedupe --- yarn.lock | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/yarn.lock b/yarn.lock index cc71c858773e..18daee4bdfbc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -33123,14 +33123,7 @@ __metadata: languageName: node linkType: hard -"get-port@npm:^7.0.0": - version: 7.1.0 - resolution: "get-port@npm:7.1.0" - checksum: 10/f4d23b43026124007663a899578cc87ff37bfcf645c5c72651e9810ebafc759857784e409fb8e0ada9b90e5c5db089b0ae2f5f6b49fba1ce2e0aff86094ab17d - languageName: node - linkType: hard - -"get-port@npm:^7.2.0": +"get-port@npm:^7.0.0, get-port@npm:^7.2.0": version: 7.2.0 resolution: "get-port@npm:7.2.0" checksum: 10/f8785ccdcc52b1e03f1b1de3fcd46dbc41fe4079e234f2727c3e154ca76bb94318fb0d341daa28a6c87eff24ad4016eaa8b1b4e26eff0d6a2196dd1c1ffc63a1 @@ -49952,14 +49945,7 @@ __metadata: languageName: node linkType: hard -"tslib@npm:^2.0.0, tslib@npm:^2.0.1, tslib@npm:^2.0.3, tslib@npm:^2.1.0, tslib@npm:^2.3.0, tslib@npm:^2.4.0, tslib@npm:^2.4.1, tslib@npm:^2.5.0, tslib@npm:^2.6.0, tslib@npm:^2.6.2, tslib@npm:^2.8.0, tslib@npm:^2.8.1": - version: 2.8.1 - resolution: "tslib@npm:2.8.1" - checksum: 10/3e2e043d5c2316461cb54e5c7fe02c30ef6dccb3384717ca22ae5c6b5bc95232a6241df19c622d9c73b809bea33b187f6dbc73030963e29950c2141bc32a79f7 - languageName: node - linkType: hard - -"tslib@npm:^2.9.1": +"tslib@npm:^2.0.0, tslib@npm:^2.0.1, tslib@npm:^2.0.3, tslib@npm:^2.1.0, tslib@npm:^2.3.0, tslib@npm:^2.4.0, tslib@npm:^2.4.1, tslib@npm:^2.5.0, tslib@npm:^2.6.0, tslib@npm:^2.6.2, tslib@npm:^2.8.0, tslib@npm:^2.8.1, tslib@npm:^2.9.1": version: 2.9.1 resolution: "tslib@npm:2.9.1" checksum: 10/20aa8c3282c88f8dd1bf0a62c5b1aa03b35998cbc6db4780f6e84d593ba4ffe232bd967916c6e0f96b9e5d719dade9e329d1b2cfede31043481d8fd13f10ca5f From 0d6107ab17cce428b2e3b7f9ae6f3189f1b40569 Mon Sep 17 00:00:00 2001 From: Wei Sun Date: Tue, 1 Dec 2026 10:03:30 -0700 Subject: [PATCH 3/3] chore: revert unrelated formatting in marketing-consent docs Restores STRATEGY.md and marketing-consent-use-cases.md to main's content. The merge of main had reformatted them; no content changes. Co-authored-by: Cursor --- .../harnesses/marketing-consent/STRATEGY.md | 51 ++++++++++--------- .../marketing-consent-use-cases.md | 38 +++++++------- 2 files changed, 45 insertions(+), 44 deletions(-) diff --git a/tests/integration/harnesses/marketing-consent/STRATEGY.md b/tests/integration/harnesses/marketing-consent/STRATEGY.md index 2a37ccdaaa11..3ee2c81be707 100644 --- a/tests/integration/harnesses/marketing-consent/STRATEGY.md +++ b/tests/integration/harnesses/marketing-consent/STRATEGY.md @@ -39,20 +39,20 @@ Shape B (app-flow) is the primary shape: the bug surface IS the seam between the store and the controller. A Shape A slice (controller + remote service) covers the consent machine and the remote sync directly. -| Layer of the stack | Shape B: app flow | Shape A: controller + remote service | -| --------------------------------------------------------------------------------------------------------------------------- | ----------------- | ------------------------------------ | -| `@metamask/analytics-controller` (`AnalyticsController` + selectors) | ✓ real | ✓ real | -| Production messenger layout (`AnalyticsController` child of the root controller messenger, as `@metamask/wallet` builds it) | ✓ real | ✓ real | -| `app/util/analytics/analytics.ts` (queue manager + consent mapping) | ✓ real | ✗ (the singleton is unit-covered) | -| `marketingAttribution` / `backfillSocialLoginMarketingConsent` sagas | ✓ real | ✗ | -| Real Redux reducers (`security`, `engine`, `attribution`, `onboarding`) + real selectors | ✓ real | ✓ real (security slice) | -| Engine → Redux state sync (`updateBgState` mechanism) | ✓ real | ✓ real | -| `OAuthService.updateMarketingOptInStatus` / `getMarketingOptInStatus` | ✓ real | ✓ real | -| `platformAdapter` (Segment/Braze HTTP) | mocked | mocked | -| `global fetch` (auth-server marketing opt-in API) | mocked | mocked | -| Engine module (seedless access token, controller messenger, state read) | shimmed | shimmed | -| `app/store` singleton + `analyticsId` MMKV storage | shimmed | n/a | -| Settings screen / hooks | ✗ (CV owns) | ✗ (CV owns) | +| Layer of the stack | Shape B: app flow | Shape A: controller + remote service | +| ----------------------------------------------------------------------------------------- | ----------------- | ------------------------------------ | +| `@metamask/analytics-controller` (`AnalyticsController` + selectors) | ✓ real | ✓ real | +| Production messenger layout (`AnalyticsController` child of the root controller messenger, as `@metamask/wallet` builds it) | ✓ real | ✓ real | +| `app/util/analytics/analytics.ts` (queue manager + consent mapping) | ✓ real | ✗ (the singleton is unit-covered) | +| `marketingAttribution` / `backfillSocialLoginMarketingConsent` sagas | ✓ real | ✗ | +| Real Redux reducers (`security`, `engine`, `attribution`, `onboarding`) + real selectors | ✓ real | ✓ real (security slice) | +| Engine → Redux state sync (`updateBgState` mechanism) | ✓ real | ✓ real | +| `OAuthService.updateMarketingOptInStatus` / `getMarketingOptInStatus` | ✓ real | ✓ real | +| `platformAdapter` (Segment/Braze HTTP) | mocked | mocked | +| `global fetch` (auth-server marketing opt-in API) | mocked | mocked | +| Engine module (seedless access token, controller messenger, state read) | shimmed | shimmed | +| `app/store` singleton + `analyticsId` MMKV storage | shimmed | n/a | +| Settings screen / hooks | ✗ (CV owns) | ✗ (CV owns) | The Engine / store / `analyticsId` shims are the documented app-shell glue: the real target chain (saga → helper → queue → messenger → controller → @@ -98,13 +98,13 @@ documenting authoring rules here. Shared agent index: [`../../AGENTS.md`](../../ Driven by [`marketing-consent-use-cases.md`](marketing-consent-use-cases.md): (see the matrix file for the authoritative list): -| Area | E2E | Integration | CV | Unit | Total | -| --------------------------------------------------- | ----: | ----------: | ----: | ----: | ----: | -| Consent persistence (security slice ↔ controller) | | 2 | | | 2 | -| `has_marketing_consent` trait (AND rule) + backfill | | 3 | | | 3 | -| Remote consent sync (auth server, incl. desync) | | 2 | | | 2 | -| Restart rehydration | | 1 | | | 1 | -| **Total (current matrix)** | **0** | **8** | **0** | **0** | **8** | +| Area | E2E | Integration | CV | Unit | Total | +| ------------------------------------------------------- | --: | ----------: | -: | ---: | ----: | +| Consent persistence (security slice ↔ controller) | | 2 | | | 2 | +| `has_marketing_consent` trait (AND rule) + backfill | | 3 | | | 3 | +| Remote consent sync (auth server, incl. desync) | | 2 | | | 2 | +| Restart rehydration | | 1 | | | 1 | +| **Total (current matrix)** | **0** | **8** | **0** | **0** | **8** | Integration owns the consent chain end to end; CV owns the screens and sheets that drive the toggles; no E2E is justified — there is no device or native @@ -131,12 +131,13 @@ describe('My consent flow', () => { harness.store.dispatch(setDataCollectionForMarketing(false)); await harness.waitFor( () => - harness.analyticsController.state.marketingConsentDecisionMade === true, + harness.analyticsController.state.marketingConsentDecisionMade === + true, ); - expect(harness.store.getState().security.dataCollectionForMarketing).toBe( - false, - ); + expect( + harness.store.getState().security.dataCollectionForMarketing, + ).toBe(false); }); }); ``` diff --git a/tests/integration/harnesses/marketing-consent/marketing-consent-use-cases.md b/tests/integration/harnesses/marketing-consent/marketing-consent-use-cases.md index 70683facb1f7..f69a791ae845 100644 --- a/tests/integration/harnesses/marketing-consent/marketing-consent-use-cases.md +++ b/tests/integration/harnesses/marketing-consent/marketing-consent-use-cases.md @@ -24,27 +24,27 @@ marketing opt-in sync. The production glue between the first two is the `marketingAttribution` saga; the social-login path adds the `backfillSocialLoginMarketingConsent` saga. -| ID | Use case | U | I | CV | Coverage notes | -| ---------------- | ------------------------------------------------------------------------------------------------------------------------------ | --- | ----- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | -| MC-CONSENT-ON | Marketing toggle on → the preference persists in the security slice and AnalyticsController consent through the real saga | | **✓** | Toggle rendering + sheet flow (existing `MetaMetricsAndDataCollectionSection.view.test.tsx`) | Shape B: real redux → saga → analytics helper → queue → controller chain; Engine mirror kept in sync. | -| MC-CONSENT-OFF | Marketing toggle off → opt-out persists on both surfaces, decision stays made, persisted attribution is cleared | | **✓** | Toggle rendering + data-collection sheet (existing CV coverage) | Shape B; pins the saga's `clearAttribution` on opt-out. | -| MC-TRAIT-AND | `has_marketing_consent` identify trait follows MetaMetrics (the AND rule): suppressed while opted out, delivered once opted in | | **✓** | | Shape A at the controller seam: `identify` is gated on the product opt-in; trait + consent context asserted. | -| MC-BACKFILL-OFF | Social-login backfill with consent recorded while MetaMetrics is opted out → no consent payload emitted, pending flag cleared | | **✓** | | Shape B: the saga's own `analytics.isEnabled()` gate; backfill still clears. | -| MC-BACKFILL-ON | Social-login backfill while MetaMetrics is on → consent trait identify + preference event through the real chain, flag cleared | | **✓** | | Shape B; asserts trait, `location: saga_backfill_marketing_consent`, and the derived `account_type`. | -| MC-REMOTE-OK | Consent sync to the seedless auth server succeeds: POST `opt_in_status` with the seedless access token | | **✓** | | Shape A on the real `OAuthService`; URL + auth header + body pinned to the production endpoint. | -| MC-REMOTE-DESYNC | Auth-server write fails (8.18.1 desync scenario) → the write rejects and local consent must not diverge from the local choice | | **✓** | Desync remount behaviour (existing `MetaMetricsAndDataCollectionSection.view.test.tsx`) | Shape A: failed POST rejects; local controller + redux keep the decision; the stale remote read is not adopted. | -| MC-REHYDRATE | Restart → consent rehydrates from persisted controller state + the persisted security slice, and the AND rule still applies | | **✓** | | Shape A: fresh controller from the persisted slices; identify flows post-restart. | +| ID | Use case | U | I | CV | Coverage notes | +| ---------------- | ---------------------------------------------------------------------------------------------------------------------------- | - | ----- | ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | +| MC-CONSENT-ON | Marketing toggle on → the preference persists in the security slice and AnalyticsController consent through the real saga | | **✓** | Toggle rendering + sheet flow (existing `MetaMetricsAndDataCollectionSection.view.test.tsx`) | Shape B: real redux → saga → analytics helper → queue → controller chain; Engine mirror kept in sync. | +| MC-CONSENT-OFF | Marketing toggle off → opt-out persists on both surfaces, decision stays made, persisted attribution is cleared | | **✓** | Toggle rendering + data-collection sheet (existing CV coverage) | Shape B; pins the saga's `clearAttribution` on opt-out. | +| MC-TRAIT-AND | `has_marketing_consent` identify trait follows MetaMetrics (the AND rule): suppressed while opted out, delivered once opted in | | **✓** | | Shape A at the controller seam: `identify` is gated on the product opt-in; trait + consent context asserted. | +| MC-BACKFILL-OFF | Social-login backfill with consent recorded while MetaMetrics is opted out → no consent payload emitted, pending flag cleared | | **✓** | | Shape B: the saga's own `analytics.isEnabled()` gate; backfill still clears. | +| MC-BACKFILL-ON | Social-login backfill while MetaMetrics is on → consent trait identify + preference event through the real chain, flag cleared | | **✓** | | Shape B; asserts trait, `location: saga_backfill_marketing_consent`, and the derived `account_type`. | +| MC-REMOTE-OK | Consent sync to the seedless auth server succeeds: POST `opt_in_status` with the seedless access token | | **✓** | | Shape A on the real `OAuthService`; URL + auth header + body pinned to the production endpoint. | +| MC-REMOTE-DESYNC | Auth-server write fails (8.18.1 desync scenario) → the write rejects and local consent must not diverge from the local choice | | **✓** | Desync remount behaviour (existing `MetaMetricsAndDataCollectionSection.view.test.tsx`) | Shape A: failed POST rejects; local controller + redux keep the decision; the stale remote read is not adopted. | +| MC-REHYDRATE | Restart → consent rehydrates from persisted controller state + the persisted security slice, and the AND rule still applies | | **✓** | | Shape A: fresh controller from the persisted slices; identify flows post-restart. | --- ## Deliberately not in this matrix (owned elsewhere) -| Concern | Owner | -| -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | -| Settings screen composition, switch states, data-collection sheet flow | CV — `MetaMetricsAndDataCollectionSection.view.test.tsx` (MMQA-2604 items 2–3) | -| The `analytics` helper's queue wrapper details (enrichment, error swallowing) | Unit — `app/util/analytics/analytics.test.ts` | -| Saga effect ordering with mocked analytics | Unit — `app/store/sagas/marketingAttribution.test.ts` | -| OAuthService HTTP details beyond the consent endpoint (login, token refresh) | Unit — `app/core/OAuthService/OAuthService.test.ts` | -| `withMobileAnalyticsControllerState` rehydration normalization (MMKV analyticsId preference) | Unit — `app/core/Engine/wallet-init/instance-options/analytics-controller.test.ts` | -| Consent prompts during onboarding (OptinMetrics / ExperienceEnhancer screens) | CV — existing screen tests | -| A future core `MarketingConsentController` + AUS-backed remote consent record | Pending migration — re-point this harness at the core controller when mobile can consume it | +| Concern | Owner | +| --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | +| Settings screen composition, switch states, data-collection sheet flow | CV — `MetaMetricsAndDataCollectionSection.view.test.tsx` (MMQA-2604 items 2–3) | +| The `analytics` helper's queue wrapper details (enrichment, error swallowing) | Unit — `app/util/analytics/analytics.test.ts` | +| Saga effect ordering with mocked analytics | Unit — `app/store/sagas/marketingAttribution.test.ts` | +| OAuthService HTTP details beyond the consent endpoint (login, token refresh) | Unit — `app/core/OAuthService/OAuthService.test.ts` | +| `withMobileAnalyticsControllerState` rehydration normalization (MMKV analyticsId preference) | Unit — `app/core/Engine/wallet-init/instance-options/analytics-controller.test.ts` | +| Consent prompts during onboarding (OptinMetrics / ExperienceEnhancer screens) | CV — existing screen tests | +| A future core `MarketingConsentController` + AUS-backed remote consent record | Pending migration — re-point this harness at the core controller when mobile can consume it |