[pull] main from MetaMask:main - #258
Merged
Merged
Conversation
## Explanation This PR adds latency reporting to shield coverage and signature coverage results. The latency (in milliseconds) is included as part of the `metrics` property in each coverage response, allowing downstream consumers and analytics systems to track and analyze the performance of coverage checks. Unit tests have been updated to verify correct latency values in the metrics. ### Changes - Add `metrics.latency` to coverage and signature coverage responses. - Update backend and test logic to use `Date.now()` for latency measurements. - Extend unit test coverage to validate latency reporting in result metrics. <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> Fixes https://github.com/MetaMask/MetaMask-planning/issues/6136 ## 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 communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Add `metrics.latency` to coverage and signature coverage responses, measuring end-to-end latency (including retries) and update tests and changelog accordingly. > > - **Backend**: > - Add `metrics.latency` to `GetCoverageResultResponse` and `CoverageResult` returned by `ShieldRemoteBackend`. > - Measure end-to-end latency in `#getCoverageResult` using `Date.now()`, including retries/delays via polling policy. > - **Types**: > - Extend `CoverageResult` and `GetCoverageResultResponse` with `metrics.latency` in `src/types.ts` and `src/backend.ts`. > - **Tests**: > - Update `src/backend.test.ts` to assert presence and correctness of `metrics.latency` for both transaction and signature coverage, including retry-delay scenarios. > - **Changelog**: > - Document addition of latency metrics in `packages/shield-controller/CHANGELOG.md`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit fc9d432. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Tuna <tunguyenanh@tunatech.org> Co-authored-by: Chaitanya Potti <chaitanya.potti@gmail.com>
## Explanation <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> Minor releases of shield-controller ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## 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 communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Publishes shield-controller 2.1.0 adding latency metrics and updates monorepo version to 676.0.0. > > - **Packages**: > - `@metamask/shield-controller` v2.1.0 > - Added latency metrics in Shield coverage responses. > - Updated changelog entries and links. > - Monorepo `package.json`: version bumped to `676.0.0`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 4d83b16. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## Explanation Support providing `gasFeeToken` when adding a transaction or transaction batch. ## References Related to [#6173](MetaMask/MetaMask-planning#6173) ## 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 communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds optional gas fee token support to transaction APIs and validates/removes it before publish based on native balance, with supporting balance utilities and tests. > > - **API/Types**: > - Add optional `gasFeeToken` to `addTransaction` and `addTransactionBatch`. > - Extend `TransactionMeta` with `isGasFeeTokenIgnoredIfBalance`; initialize `selectedGasFeeToken` and flag on add. > - **Publish Flow**: > - New `checkGasFeeTokenBeforePublish` ensures native balance sufficiency; unsets `selectedGasFeeToken` and clears `isExternalSign` if native balance covers gas; fetches tokens if missing; throws if invalid selection. > - Refactor `TransactionController` to call this check and add `#getGasFeeTokens` helper. > - **Utils**: > - Add `balance` module (`getNativeBalance`, `isNativeBalanceSufficientForGas`) using `bignumber.js`; use it in `balance-changes`. > - Enhance `gas-fee-tokens` to build auth lists and parse sponsorship; add tests. > - **Batch**: > - Pass `gasFeeToken` through `addTransactionBatch` path. > - **Misc**: > - Update tests; lower Jest function coverage threshold; add `bignumber.js` dependency; update changelog. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 2ffc7e8568047a11bb61a39257c77363b9ed382f. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This reverts commit 9b84201. ## Explanation This release used an invalid commit name (Relase/676.0.0) so the publish CI script did not run. Reverting and will add this back as a fast follow. <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## 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 communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Rolls back release versions (core to 675.0.0, shield-controller to 2.0.0) and updates shield-controller changelog accordingly. > > - **Versions**: > - Roll back root `package.json` from `676.0.0` to `675.0.0`. > - Roll back `packages/shield-controller/package.json` from `2.1.0` to `2.0.0`. > - **Changelog (`packages/shield-controller/CHANGELOG.md`)**: > - Remove `2.1.0` section; keep its entry under `Unreleased`. > - Update compare links to reference `2.0.0` and drop `2.1.0` link. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit b9b1b52. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
PR adds back 9b84201 ## Explanation <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> Minor releases of shield-controller ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## 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 communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Bumps monorepo to 676.0.0 and releases `@metamask/shield-controller` 2.1.0 adding latency metrics to coverage response. > > - **Release** > - Bump monorepo version in `package.json` to `676.0.0`. > - **Packages — `@metamask/shield-controller`** > - Version bump to `2.1.0` in `packages/shield-controller/package.json`. > - Changelog update: add entry for `2.1.0` with latency metrics in coverage response; update compare links in `packages/shield-controller/CHANGELOG.md`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 1eec9d7. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## Explanation Major bump of the `@metamask/notification-services-controller` from `19.0.0` to `20.0.0` Extension Preview: MetaMask/metamask-extension#37709 Mobile Preview: MetaMask/metamask-mobile#22539 <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## 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 communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Publishes core 677.0.0 and updates `@metamask/notification-services-controller` to 20.0.0 with breaking Notification API v3 migration documented. > > - **Release** > - Bump monorepo `version` to `677.0.0` in `package.json`. > - **@metamask/notification-services-controller (20.0.0)** > - `package.json`: version bump to `20.0.0`. > - `CHANGELOG.md`: document breaking migration from Notification API v2 to v3, including: > - Endpoint changes to `/api/v3/notifications` and request format update (`{ addresses: string[], locale?: string }`). > - Response structure updates with `notification_type` and nested payloads; new platform notifications with templates. > - Type and function renames; import path updates to `api-notifications`. > - Auto-expiry reduced to 30 days; optional `locale` support in controller constructor. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 584085c. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## Explanation Always get a quote if using the Relay strategy and the required token is Arbitrum USDC, even if the payment token matches. ## References Related to [#6247](MetaMask/MetaMask-planning#6247) ## 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 communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Always retrieve a Relay quote for Arbitrum USDC deposits and convert getStrategy from async to sync across controller, utils, and tests. > > - **Behavior Change (Relay + Arbitrum USDC)** > - In `utils/source-amounts.ts`, always require a quote when strategy is `Relay` and required token is Arbitrum USDC, even if the payment token matches (via `isQuoteAlwaysRequired`). > - **API/Contract Change (BREAKING)** > - `getStrategy` constructor option and action changed from async to sync. > - Updated handler registration in `TransactionPayController.ts` and all call sites to remove `await` (e.g., `utils/strategy.ts`, `utils/quotes.ts`, `helpers/TransactionPayPublishHook.ts`). > - **Tests** > - Adjusted tests to reflect synchronous `getStrategy` and new behavior for Arbitrum USDC with Relay. > - **Changelog** > - Documented breaking change and new Relay quote behavior. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit a5261e83340d02e90a7ffb43a52861fc9836a801. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## Explanation <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> - Previously `triggerAccessTokenRefresh` was only called during `getSubscriptions` polling, normal subscription state change didn't trigger it. This PR trigger `triggerAccessTokenRefresh` everytime subscription state change - Remove `triggerAccessTokenRefresh` from `startShieldSubscriptionWithCard` since that only return stripe checkout url, not subscribed yet. ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## 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 communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Refresh access token immediately when subscription state changes and remove refresh after starting card/crypto checkout; delete polling flag/logic. > > - **Subscription Controller**: > - **Behavior**: Call `triggerAccessTokenRefresh` in `getSubscriptions` whenever state changes (subscriptions/customer/trials/lastSubscription). > - **Refactor**: Remove `#shouldCallRefreshAuthToken` and related polling conditional; `_executePoll` now only calls `getSubscriptions`. > - **Flows**: Remove `triggerAccessTokenRefresh` after `startShieldSubscriptionWithCard` and `startSubscriptionWithCrypto` (checkout/session creation only). > - **Docs**: > - Update `CHANGELOG.md` to reflect the new refresh behavior and removal after card checkout. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 04b3ce9. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## Explanation <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> Patch for `@metamask/subscription-controller` -> `v4.2.2` ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [ ] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Publishes @metamask/subscription-controller v4.2.2 with access token refresh behavior changes and bumps monorepo version to 678.0.0. > > - **Release**: > - `packages/subscription-controller`: bump to `4.2.2` > - Changed: trigger `triggerAccessTokenRefresh` on any subscription state change (not only polling) > - Changed: remove `triggerAccessTokenRefresh` after `startShieldSubscriptionWithCard` > - Update changelog links for `4.2.2` > - **Monorepo**: > - Bump root `package.json` version to `678.0.0` > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 49da155. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )