Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: profile-sync-controller - make fixture constants lazy #4592

Merged
merged 4 commits into from
Aug 12, 2024

Conversation

Prithpal-Sooriya
Copy link
Contributor

@Prithpal-Sooriya Prithpal-Sooriya commented Aug 2, 2024

Explanation

this is a temp fix so that mobile does not compute these fixtures are runtime. we do need to support multiple exports to ensure that these are not called.

References

https://consensyssoftware.atlassian.net/browse/NOTIFY-958

Changelog

@metamask/profile-sync-controller

  • CHANGED: profile sync fixture mocks to be evaluated lazily (by making them functions)
  • CHANGED: Update notification services controller event type names.

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 highlighted breaking changes using the "BREAKING" category above as appropriate

this is a temp fix so that mobile does not compute these fixtures are runtime.
we do need to support multiple exports to ensure that these are not called.
@Prithpal-Sooriya Prithpal-Sooriya added the team-notifications Notification Team changes. https://github.com/orgs/MetaMask/teams/notifications label Aug 2, 2024
Comment on lines +7 to +10
// NOTE - using encryption.encryptString directly in fixtures causes issues on mobile.
// This is because this fixture is getting added in at run time. Will be improved once we support multiple exports
export const MOCK_ENCRYPTED_STORAGE_DATA = () =>
encryption.encryptString(MOCK_STORAGE_DATA, MOCK_STORAGE_KEY);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned, mobile has an issue with running this fixture.

This most likely is because our relative imports (barrel files), drag in these fixtures and need to be computed once pulled in.

We will explore multiple file exports, this should mostly alleviate this issue.

E.g.

// If want to reuse fixtures, we can have a separate endpoint for this. Likewise for other areas for this controller.
import {} from '@metamask/profile-sync-controller/fixtures'

@Prithpal-Sooriya
Copy link
Contributor Author

@metamaskbot publish-preview

Copy link
Contributor

Preview builds have been published. See these instructions for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/accounts-controller": "18.0.0-preview-7f2b7307",
  "@metamask-previews/address-book-controller": "5.0.0-preview-7f2b7307",
  "@metamask-previews/announcement-controller": "7.0.0-preview-7f2b7307",
  "@metamask-previews/approval-controller": "7.0.2-preview-7f2b7307",
  "@metamask-previews/assets-controllers": "37.0.0-preview-7f2b7307",
  "@metamask-previews/base-controller": "6.0.2-preview-7f2b7307",
  "@metamask-previews/build-utils": "3.0.0-preview-7f2b7307",
  "@metamask-previews/chain-controller": "0.1.1-preview-7f2b7307",
  "@metamask-previews/composable-controller": "7.0.0-preview-7f2b7307",
  "@metamask-previews/controller-utils": "11.0.2-preview-7f2b7307",
  "@metamask-previews/ens-controller": "13.0.1-preview-7f2b7307",
  "@metamask-previews/eth-json-rpc-provider": "4.1.2-preview-7f2b7307",
  "@metamask-previews/gas-fee-controller": "19.0.1-preview-7f2b7307",
  "@metamask-previews/json-rpc-engine": "9.0.2-preview-7f2b7307",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.2-preview-7f2b7307",
  "@metamask-previews/keyring-controller": "17.1.2-preview-7f2b7307",
  "@metamask-previews/logging-controller": "5.0.0-preview-7f2b7307",
  "@metamask-previews/message-manager": "10.0.2-preview-7f2b7307",
  "@metamask-previews/name-controller": "8.0.0-preview-7f2b7307",
  "@metamask-previews/network-controller": "20.1.0-preview-7f2b7307",
  "@metamask-previews/notification-controller": "6.0.0-preview-7f2b7307",
  "@metamask-previews/notification-services-controller": "0.2.0-preview-7f2b7307",
  "@metamask-previews/permission-controller": "11.0.0-preview-7f2b7307",
  "@metamask-previews/permission-log-controller": "3.0.0-preview-7f2b7307",
  "@metamask-previews/phishing-controller": "10.1.1-preview-7f2b7307",
  "@metamask-previews/polling-controller": "9.0.1-preview-7f2b7307",
  "@metamask-previews/preferences-controller": "13.0.1-preview-7f2b7307",
  "@metamask-previews/profile-sync-controller": "0.2.0-preview-7f2b7307",
  "@metamask-previews/queued-request-controller": "4.0.0-preview-7f2b7307",
  "@metamask-previews/rate-limit-controller": "6.0.0-preview-7f2b7307",
  "@metamask-previews/selected-network-controller": "17.0.0-preview-7f2b7307",
  "@metamask-previews/signature-controller": "18.0.1-preview-7f2b7307",
  "@metamask-previews/transaction-controller": "35.1.0-preview-7f2b7307",
  "@metamask-previews/user-operation-controller": "14.0.1-preview-7f2b7307"
}

@Prithpal-Sooriya Prithpal-Sooriya marked this pull request as ready for review August 12, 2024 11:15
@Prithpal-Sooriya Prithpal-Sooriya requested a review from a team as a code owner August 12, 2024 11:15
Copy link
Contributor

@Jonathansoufer Jonathansoufer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Prithpal-Sooriya Prithpal-Sooriya merged commit fbf2afa into main Aug 12, 2024
116 checks passed
@Prithpal-Sooriya Prithpal-Sooriya deleted the refactor/profile-sync-mobile-fixture-fixes branch August 12, 2024 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-notifications Notification Team changes. https://github.com/orgs/MetaMask/teams/notifications
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants