Skip to content

Commit 9dc7207

Browse files
committed
Merge branch 'main' into chore/add-sentry-size-analysis-to-nightly
2 parents 3a2d60c + 4345902 commit 9dc7207

1,010 files changed

Lines changed: 42955 additions & 22128 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/skills/perps-core-sync/SKILL.md

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: Sync the perps controller from mobile to the core monorepo with cha
77

88
## Purpose
99

10-
Use this skill to sync `app/controllers/perps/` from mobile to `packages/perps-controller/src/` in the core monorepo. The sync is driven by `scripts/perps/validate-core-sync.sh` — a 9-step pipeline (preflight, conflict check, copy, install, verify, eslint fix, build, lint, write sync state).
10+
Use this skill to sync `app/controllers/perps/` from mobile to `packages/perps-controller/src/` in the core monorepo. The sync is driven by `scripts/perps/validate-core-sync.sh` — a 13-step pipeline that validates not only source sync but also the built publish artifact safety for extension consumers.
1111

1212
Use when:
1313

@@ -58,37 +58,39 @@ Options:
5858
- `--skip-test` — skip the test step for faster iteration
5959
- `--verbose` — show full output for every step (useful for debugging)
6060

61-
The script runs these 12 steps in order:
62-
63-
| Step | What it does |
64-
| ----------------------- | --------------------------------------------------------------------------------------- |
65-
| 1. Pre-flight checks | Confirms mobile source, core destination, required tools |
66-
| 2. Conflict check | Fetches origin/main, checks for upstream perps-controller changes, validates sync state |
67-
| 3. Copy source files | rsync `.ts` files (excluding tests, mocks, fixtures) |
68-
| 4. Install dependencies | `yarn install` in core |
69-
| 5. Verify build fixes | Checks for `__DEV__`, mobile imports, closure fixes |
70-
| 6. ESLint auto-fix | Runs `--fix`, `--suppress-all`, `--prune-suppressions`, checks suppression delta |
71-
| 7. Format fix (oxfmt) | Runs `yarn lint:misc --write` — core uses oxfmt, not prettier |
72-
| 8. Build | `yarn workspace @metamask/perps-controller build` |
73-
| 9. Lint | Final lint pass to confirm zero violations |
74-
| 10. Test | `yarn workspace @metamask/perps-controller test` — catches DI/fixture mismatches |
75-
| 11. Changelog check | Verifies `CHANGELOG.md` has been updated (core CI requirement) |
76-
| 12. Write sync state | Updates `.sync-state.json` with commit hashes and checksum |
61+
The script runs these 13 steps in order:
62+
63+
| Step | What it does |
64+
| -------------------------- | -------------------------------------------------------------------------------------------------- |
65+
| 1. Pre-flight checks | Confirms mobile source, core destination, required tools |
66+
| 2. Conflict check | Fetches origin/main, checks for upstream perps-controller changes, validates sync state |
67+
| 3. Copy source files | rsync `.ts` files (excluding tests, mocks, fixtures) |
68+
| 4. Install dependencies | `yarn install` in core |
69+
| 5. Verify build fixes | Checks for `__DEV__`, mobile imports, closure fixes |
70+
| 6. ESLint auto-fix | Runs `--fix`, `--suppress-all`, `--prune-suppressions`, checks suppression delta |
71+
| 7. Format fix (oxfmt) | Runs `yarn lint:misc --write` — core uses oxfmt, not prettier |
72+
| 8. Build | `yarn workspace @metamask/perps-controller build:all` (builds references on a clean Core checkout) |
73+
| 9. Verify publish artifact | Confirms built `dist/PerpsController.{mjs,cjs}` still preserves the MYX webpack-ignore safeguard |
74+
| 10. Lint | Final lint pass to confirm zero violations |
75+
| 11. Test | `yarn workspace @metamask/perps-controller test` — catches DI/fixture mismatches |
76+
| 12. Changelog check | Verifies `CHANGELOG.md` has been updated (core CI requirement) |
77+
| 13. Write sync state | Updates `.sync-state.json` with commit hashes and checksum |
7778

7879
## Failure Resolution
7980

80-
| Failure | Cause | Fix |
81-
| -------------------------------------------------------- | -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
82-
| `__DEV__` found | Mobile code uses `__DEV__` guard | Replace with `false` in the mobile source file, or route through `PerpsPlatformDependencies` for environment-aware behavior. Fix in mobile, then re-sync. |
83-
| Mobile imports (Engine, react-native, Sentry, DevLogger) | Direct platform import in controller | Route through `PerpsPlatformDependencies` (DI). All platform services must come through the `infrastructure` constructor param. Fix in mobile. |
84-
| Suppression delta increase | Sync introduces new ESLint violations | Fix violations in mobile first (e.g., `'x' in y``hasProperty(y, 'x')` from `@metamask/utils`). Re-run sync after fixing. |
85-
| Build failure | Missing tsconfig references, missing dependencies, type errors | Check `packages/perps-controller/tsconfig.json` references. Ensure new imports have corresponding `dependencies` in `package.json`. |
86-
| Lint failure after fix | Auto-fix didn't resolve all issues | Re-run the eslint fix step. If persistent, check for new rule violations that need manual fixes in mobile. |
87-
| Format fix failure | oxfmt can't auto-fix some files | Check for syntax errors that prevent parsing. Core uses `oxfmt` (not prettier) for TS formatting. |
88-
| Test failure | Test fixtures missing new DI dependencies | Add mocks for new `PerpsPlatformDependencies` fields (e.g., `diskCache`) in `tests/defer-eligibility.test.ts`. |
89-
| Changelog check failure | `CHANGELOG.md` not updated | Add entries under `## [Unreleased]` with `### Added`, `### Fixed`, `### Changed` sections linking to the PR. |
90-
| Conflict check: behind origin/main | Someone pushed perps-controller changes to main | `cd <core-path> && git merge origin/main` before re-running sync. |
91-
| Conflict check: checksum mismatch | Core source was hand-edited since last sync | Review the edits. Either port them back to mobile or discard and re-sync. |
81+
| Failure | Cause | Fix |
82+
| -------------------------------------------------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
83+
| `__DEV__` found | Mobile code uses `__DEV__` guard | Replace with `false` in the mobile source file, or route through `PerpsPlatformDependencies` for environment-aware behavior. Fix in mobile, then re-sync. |
84+
| Mobile imports (Engine, react-native, Sentry, DevLogger) | Direct platform import in controller | Route through `PerpsPlatformDependencies` (DI). All platform services must come through the `infrastructure` constructor param. Fix in mobile. |
85+
| Suppression delta increase | Sync introduces new ESLint violations | Fix violations in mobile first (e.g., `'x' in y``hasProperty(y, 'x')` from `@metamask/utils`). Re-run sync after fixing. |
86+
| Build failure | Missing tsconfig references, missing dependencies, type errors | Check `packages/perps-controller/tsconfig.json` references. Ensure new imports have corresponding `dependencies` in `package.json`. |
87+
| Lint failure after fix | Auto-fix didn't resolve all issues | Re-run the eslint fix step. If persistent, check for new rule violations that need manual fixes in mobile. |
88+
| Format fix failure | oxfmt can't auto-fix some files | Check for syntax errors that prevent parsing. Core uses `oxfmt` (not prettier) for TS formatting. |
89+
| Test failure | Test fixtures missing new DI dependencies | Add mocks for new `PerpsPlatformDependencies` fields (e.g., `diskCache`) in `tests/defer-eligibility.test.ts`. |
90+
| Publish artifact verification failure | Built Core dist lost the MYX webpack-ignore safeguard | Restore the `myxModulePath` workaround in mobile `PerpsController.ts`, rebuild Core, and confirm `dist/PerpsController.{mjs,cjs}` still contains `webpackIgnore: true`. |
91+
| Changelog check failure | `CHANGELOG.md` not updated | Add entries under `## [Unreleased]` with `### Added`, `### Fixed`, `### Changed` sections linking to the PR. |
92+
| Conflict check: behind origin/main | Someone pushed perps-controller changes to main | `cd <core-path> && git merge origin/main` before re-running sync. |
93+
| Conflict check: checksum mismatch | Core source was hand-edited since last sync | Review the edits. Either port them back to mobile or discard and re-sync. |
9294

9395
## Post-Sync
9496

@@ -131,6 +133,8 @@ After all 12 steps pass:
131133

132134
6. **Use `--verbose` when debugging** — without it, step output is captured to temp files and only shown on failure. With `--verbose`, all output streams to the terminal.
133135

136+
7. **Treat extension-consumer safety as a hard invariant.** If `packages/perps-controller/package.json` excludes `dist/providers/MYXProvider*`, the built `dist/PerpsController.{mjs,cjs}` must still preserve the `webpackIgnore` safeguard so extension bundlers never statically resolve the missing file.
137+
134138
## Portability Rules
135139

136140
Reference: `docs/perps/perps-review-antipatterns.md` (Controller Portability section).

.agents/skills/pr-codeowners/SKILL.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ description: Identify code owners for changed files and map them to Slack group
3838
| wallet-api-platform | wallet-integrations-team |
3939
| ramp | ramp-team |
4040
| predict | predict-team |
41+
| social-ai | social-ai-team |
4142
| rewards | rewards-team |
4243
| design-system-engineers | metamask-design-system-team |
4344
| core-platform | core-platform-team |

.depcheckrc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ ignores:
3838
# ESBuild is used for AI E2E script compilation
3939
- 'esbuild'
4040
- 'esbuild-register'
41+
# tsx runs all scripts/tooling/*.ts files directly (CLI wrapper, MCP server, yarn pre/post hooks, report CLI)
42+
- 'tsx'
4143
# xml2js is used in .github/scripts/ for E2E test report processing
4244
- 'xml2js'
4345
# jest-junit is used as a Jest reporter in tests/jest.e2e.detox.config.js

.detoxrc.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ module.exports = {
8181
devices: {
8282
'ios.simulator': {
8383
type: 'ios.simulator',
84-
device: {
85-
type: 'iPhone 16 Pro',
86-
},
84+
device: process.env.IOS_SIMULATOR
85+
? { name: process.env.IOS_SIMULATOR }
86+
: { type: 'iPhone 16 Pro' },
8787
},
8888
'android.emulator': {
8989
type: 'android.emulator',

.github/CODEOWNERS

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,25 @@ app/core/AgenticService/ @MetaMask/perps
181181
**/Perps/** @MetaMask/perps
182182
**/perps/** @MetaMask/perps
183183

184+
# Social & AI Team
185+
app/components/Views/SocialLeaderboard/ @MetaMask/social-ai
186+
app/components/UI/MarketInsights/ @MetaMask/social-ai
187+
app/components/Views/Homepage/Sections/WhatsHappening/ @MetaMask/social-ai
188+
app/components/Views/Homepage/Sections/TopTraders/ @MetaMask/social-ai
189+
app/core/Engine/controllers/social-controller-init* @MetaMask/social-ai
190+
app/core/Engine/controllers/social-service-init* @MetaMask/social-ai
191+
app/core/Engine/messengers/social-controller-messenger* @MetaMask/social-ai
192+
app/core/Engine/messengers/social-service-messenger* @MetaMask/social-ai
193+
app/core/Engine/controllers/ai-digest-controller-init* @MetaMask/social-ai
194+
app/core/Engine/messengers/ai-digest-controller-messenger* @MetaMask/social-ai
195+
app/selectors/featureFlagController/socialLeaderboard/ @MetaMask/social-ai
196+
app/selectors/featureFlagController/marketInsights/ @MetaMask/social-ai
197+
app/selectors/featureFlagController/whatsHappening/ @MetaMask/social-ai
198+
**/SocialLeaderboard/** @MetaMask/social-ai
199+
**/MarketInsights/** @MetaMask/social-ai
200+
**/WhatsHappening/** @MetaMask/social-ai
201+
**/TopTraders/** @MetaMask/social-ai
202+
184203
# Predict Team
185204
app/components/UI/Predict/ @MetaMask/predict
186205
app/core/Engine/controllers/predict-controller @MetaMask/predict

.github/actionlint.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ self-hosted-runner:
1515
- "ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-lg"
1616
- "ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-xl"
1717
- "low-priority"
18+
- "bitrise_pool_name:DemoFA"
19+
- "bitrise_pool_name:DemoFAXL"
1820

1921
# Configuration variables in array of strings defined in your repository or
2022
# organization. `null` means disabling configuration variables check.

.github/pull-request-template.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ Feature: my feature name
6363
- [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable
6464
- [ ] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors.
6565

66+
#### Performance checks (if applicable)
67+
68+
- [ ] I've tested on Android
69+
- Ideally on a mid-range device; emulator is acceptable
70+
- [ ] I've tested with a power user scenario
71+
- Use these [power-user SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93) to import wallets with many accounts and tokens
72+
- [ ] I've instrumented key operations with Sentry traces for production performance metrics
73+
- See [`trace()`](/app/util/trace.ts) for usage and [`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274) for an example
74+
75+
For performance guidelines and tooling, see the [Performance Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).
76+
6677
## **Pre-merge reviewer checklist**
6778

6879
- [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).

.github/scripts/collect-qa-stats.mjs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,14 @@ const SCAN_ANALYTICS_EXPECTATIONS_DIR = 'tests/helpers/analytics/expectations';
6363
* Remove paths here when migrated to the expectations folder so the slim parser is enough.
6464
*/
6565
const LEGACY_INLINE_METAMETRICS_PATHS = [
66-
'tests/smoke/card/card-button.spec.ts',
67-
'tests/smoke/card/card-home-add-funds.spec.ts',
68-
'tests/smoke/card/card-home-manage-card.spec.ts',
6966
'tests/smoke/confirmations/send/metricsValidationHelper.ts',
7067
'tests/smoke/confirmations/transactions/dapp-initiated-transfer.spec.ts',
7168
'tests/smoke/predict/predict-cash-out.spec.ts',
7269
'tests/smoke/predict/predict-claim-positions.spec.ts',
7370
'tests/smoke/predict/predict-geo-restriction.spec.ts',
7471
'tests/smoke/predict/predict-open-position.spec.ts',
75-
'tests/smoke/ramps/onramp-unified-buy.spec.ts',
7672
'tests/smoke/snaps/test-snap-preinstalled.spec.ts',
7773
'tests/smoke/swap/bridge-action-smoke.spec.ts',
78-
'tests/smoke/swap/swap-action-smoke.spec.ts',
79-
'tests/smoke/wallet/analytics/import-wallet.spec.ts',
80-
'tests/smoke/wallet/analytics/new-wallet.spec.ts',
8174
'tests/regression/ramps/onramp-parameters.spec.ts',
8275
'tests/regression/wallet/analytics/opt-out.ts',
8376
];

0 commit comments

Comments
 (0)