From a71a8a83242b69a46649b4b6cb4e3664e945d27d Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Fri, 29 Nov 2024 20:29:19 -0330 Subject: [PATCH 1/3] feat: Allow capturing feature flags in debug snapshots (#5004) ## Explanation The controller metadata for the `RemoteFeatureFlagController` has been updated to declare the feature flag state as anonymous. These values are set by us and do not contain any PII. This allows us to capture this state in Sentry debug snapshots, which could be very useful for debugging. ## References N/A ## Changelog See changelog diff ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes --- packages/remote-feature-flag-controller/CHANGELOG.md | 5 +++++ .../src/remote-feature-flag-controller.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/remote-feature-flag-controller/CHANGELOG.md b/packages/remote-feature-flag-controller/CHANGELOG.md index afbd70db4c..bb89930857 100644 --- a/packages/remote-feature-flag-controller/CHANGELOG.md +++ b/packages/remote-feature-flag-controller/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Update metadata to declare feature flags as anonymous ([#5004](https://github.com/MetaMask/core/pull/5004)) + - This lets us capture these in debug state snapshots to help diagnose errors + ## [1.0.0] ### Added diff --git a/packages/remote-feature-flag-controller/src/remote-feature-flag-controller.ts b/packages/remote-feature-flag-controller/src/remote-feature-flag-controller.ts index cabfc0c15d..5fc4161c4d 100644 --- a/packages/remote-feature-flag-controller/src/remote-feature-flag-controller.ts +++ b/packages/remote-feature-flag-controller/src/remote-feature-flag-controller.ts @@ -24,7 +24,7 @@ export type RemoteFeatureFlagControllerState = { }; const remoteFeatureFlagControllerMetadata = { - remoteFeatureFlags: { persist: true, anonymous: false }, + remoteFeatureFlags: { persist: true, anonymous: true }, cacheTimestamp: { persist: true, anonymous: true }, }; From f11ea90dc0975497fcd74e161af67bde877047c1 Mon Sep 17 00:00:00 2001 From: Elliot Winkler Date: Sat, 30 Nov 2024 12:57:44 -0700 Subject: [PATCH 2/3] Demonstrate state as optional in controller guidelines (#4910) ## Explanation In various examples in the controller guidelines, the `state` controller option was not optional, even though there is a guideline that says it should be. This commit updates the documentation so that it shown as optional. ## References I discovered that the examples were incorrect when reviewing [this PR](https://github.com/MetaMask/metamask-extension/pull/28113#discussion_r1821573881). ## Changelog N/A ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes --- docs/writing-controllers.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/writing-controllers.md b/docs/writing-controllers.md index 519a6634d0..14be710aa6 100644 --- a/docs/writing-controllers.md +++ b/docs/writing-controllers.md @@ -49,7 +49,7 @@ class FooController extends BaseController { state = {}, }: { messenger: FooControllerMessenger; - state: Partial; + state?: Partial; }) { super({ // ... @@ -87,7 +87,7 @@ class FooController extends BaseController { state = {}, }: { messenger: FooControllerMessenger; - state: Partial; + state?: Partial; }) { super({ name, @@ -158,7 +158,7 @@ class FooController extends BaseController { state = {}, }: { messenger: FooControllerMessenger; - state: Partial; + state?: Partial; }, isEnabled: boolean, ) { @@ -177,7 +177,7 @@ class FooController extends BaseController { isEnabled, }: { messenger: FooControllerMessenger; - state: Partial; + state?: Partial; isEnabled: boolean; }) { // ... From 5eec2efdd63b64957f11072f37c6afdb8cd7ace4 Mon Sep 17 00:00:00 2001 From: cryptodev-2s <109512101+cryptodev-2s@users.noreply.github.com> Date: Sun, 1 Dec 2024 22:33:43 +0100 Subject: [PATCH 3/3] chore: Update `@ts-bridge/cli` to `0.6.1` (#5011) --- package.json | 2 +- tsconfig.build.json | 3 ++- tsconfig.json | 3 ++- yarn.lock | 20 ++++++++++---------- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 02827c4b02..99548b6670 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "@metamask/eth-json-rpc-provider": "^4.1.6", "@metamask/json-rpc-engine": "^10.0.1", "@metamask/utils": "^10.0.0", - "@ts-bridge/cli": "^0.5.1", + "@ts-bridge/cli": "^0.6.1", "@types/jest": "^27.4.1", "@types/lodash": "^4.14.191", "@types/node": "^16.18.54", diff --git a/tsconfig.build.json b/tsconfig.build.json index 63e9990113..518e786576 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -35,7 +35,8 @@ { "path": "./packages/selected-network-controller/tsconfig.build.json" }, { "path": "./packages/signature-controller/tsconfig.build.json" }, { "path": "./packages/transaction-controller/tsconfig.build.json" }, - { "path": "./packages/user-operation-controller/tsconfig.build.json" } + { "path": "./packages/user-operation-controller/tsconfig.build.json" }, + { "path": "./packages/polling-controller/tsconfig.build.json" } ], "files": [], "include": [] diff --git a/tsconfig.json b/tsconfig.json index 8dc164afcd..eea04c7fcc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -33,7 +33,8 @@ { "path": "./packages/selected-network-controller" }, { "path": "./packages/signature-controller" }, { "path": "./packages/transaction-controller" }, - { "path": "./packages/user-operation-controller" } + { "path": "./packages/user-operation-controller" }, + { "path": "./packages/polling-controller" } ], "files": [], "include": ["./types"] diff --git a/yarn.lock b/yarn.lock index de979dbf88..cb07297965 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2393,7 +2393,7 @@ __metadata: "@metamask/eth-json-rpc-provider": "npm:^4.1.6" "@metamask/json-rpc-engine": "npm:^10.0.1" "@metamask/utils": "npm:^10.0.0" - "@ts-bridge/cli": "npm:^0.5.1" + "@ts-bridge/cli": "npm:^0.6.1" "@types/jest": "npm:^27.4.1" "@types/lodash": "npm:^4.14.191" "@types/node": "npm:^16.18.54" @@ -4264,11 +4264,11 @@ __metadata: languageName: node linkType: hard -"@ts-bridge/cli@npm:^0.5.1": - version: 0.5.1 - resolution: "@ts-bridge/cli@npm:0.5.1" +"@ts-bridge/cli@npm:^0.6.1": + version: 0.6.1 + resolution: "@ts-bridge/cli@npm:0.6.1" dependencies: - "@ts-bridge/resolver": "npm:^0.1.2" + "@ts-bridge/resolver": "npm:^0.2.0" chalk: "npm:^5.3.0" cjs-module-lexer: "npm:^1.3.1" yargs: "npm:^17.7.2" @@ -4277,14 +4277,14 @@ __metadata: bin: ts-bridge: ./dist/index.js tsbridge: ./dist/index.js - checksum: 10/691abe737617597c6ec0a296a67eedf47fc93cc2682658970326ad8f5c63376f987ee92502191ed3e81e917515d101bab7ca83f06b3b489449c3b674356cc306 + checksum: 10/1cbb8fbfc7f58b804553ab9bc06b689b409d4cdd0f1e960a0ea87971ec7885b5ee2a86cb192d955c7d3611afcadb960e7dfee66aeca60f798a70e7f97aa969c3 languageName: node linkType: hard -"@ts-bridge/resolver@npm:^0.1.2": - version: 0.1.2 - resolution: "@ts-bridge/resolver@npm:0.1.2" - checksum: 10/4126154e0344f4fdf35612f65d4459e993dcf914fe765ce95d8237a6ccb85e092bd31a6d31765cc24c0280a0e243ed2385f8b355d7fb13ba7c36e95e3caf1613 +"@ts-bridge/resolver@npm:^0.2.0": + version: 0.2.0 + resolution: "@ts-bridge/resolver@npm:0.2.0" + checksum: 10/d4cfd1f47e9648a5f9c893b1b076adabde3a57cbe81ef823bcbbcc77a122fb6f06d99f40ff48198f8dc766bfc4b3b351d4e87cfcf2db64f7e6db924eb82a5db1 languageName: node linkType: hard