Skip to content

Commit 0d8af7b

Browse files
Merge branch 'main' into MMQA-1367-serve-test-snaps-locally
2 parents 6e6c46b + edf69ec commit 0d8af7b

80 files changed

Lines changed: 4158 additions & 939 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.

.ai-pr-analyzer/config.yaml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
repo: MetaMask/metamask-mobile
2+
3+
critical:
4+
files:
5+
- package.json
6+
- yarn.lock
7+
- babel.config.js
8+
- tsconfig.json
9+
- metro.config.js
10+
- metro.transform.js
11+
- react-native.config.js
12+
- index.js
13+
- app.config.js
14+
- shim.js
15+
- jest.config.js
16+
- tailwind.config.js
17+
- ios/Podfile
18+
- ios/Podfile.lock
19+
- ios/Gemfile
20+
- android/build.gradle
21+
- android/settings.gradle
22+
- android/gradle.properties
23+
- android/app/build.gradle
24+
- bitrise.yml
25+
- builds.yml
26+
- .github/workflows/ci.yml
27+
- .github/workflows/build.yml
28+
29+
keywords:
30+
- Controller
31+
- Keyring
32+
- SecureKeychain
33+
- Permission
34+
- Middleware
35+
- Migration
36+
- Engine
37+
- DeeplinkManager
38+
- SDKConnect
39+
- WalletConnect
40+
- BackgroundBridge
41+
- Transaction
42+
- Vault
43+
- Encryptor
44+
- Authentication
45+
- NativeModule
46+
- NavigationService
47+
- SnapKeyring
48+
- RPCMethods
49+
- LockManager
50+
51+
paths:
52+
# Security and authentication
53+
- app/core/SecureKeychain.ts
54+
- app/core/Vault.ts
55+
- app/core/Encryptor/
56+
- app/core/Authentication/
57+
- app/core/Permissions/
58+
- app/core/BackupVault/
59+
60+
# Core engine and controllers
61+
- app/core/Engine/
62+
- app/core/EngineService/
63+
- app/controllers/
64+
65+
# Keyring and accounts
66+
- app/core/SnapKeyring/
67+
- app/core/QrKeyring/
68+
- app/core/HardwareWallet/
69+
- app/core/HardwareWallets/
70+
- app/core/Ledger/
71+
72+
# Transactions and signing
73+
- app/core/Transaction/
74+
- app/core/RPCMethods/
75+
- app/core/SanitizationMiddleware.ts
76+
77+
# Deep linking and external connections
78+
- app/core/DeeplinkManager/
79+
- app/core/SDKConnect/
80+
- app/core/SDKConnectV2/
81+
- app/core/WalletConnect/
82+
- app/core/BackgroundBridge/
83+
84+
# Snaps
85+
- app/core/Snaps/
86+
- app/lib/snaps/
87+
88+
# Native modules and platform bridges
89+
- app/core/NativeModules.ts
90+
- app/core/MobilePortStream.js
91+
- ios/MetaMask/
92+
- android/app/
93+
94+
# Navigation
95+
- app/core/NavigationService/
96+
- app/components/Nav/
97+
98+
# State management
99+
- app/store/
100+
- app/reducers/
101+
- app/selectors/
102+
- app/actions/
103+
- app/core/redux/
104+
105+
# Build and CI
106+
- scripts/
107+
- patches/
108+
- .github/workflows/
109+
- android/keystores/
110+
111+
# PPOM and security scanning
112+
- ppom/
113+
- app/lib/ppom/
114+
- app/lib/address-scanning/
115+
116+
# Multichain
117+
- app/core/Multichain/
118+
- app/multichain-accounts/
119+
- app/multichain-bitcoin/
120+
- app/multichain-tron/
121+
122+
searchDirs:
123+
- app/
124+
- ios/
125+
- android/
126+
- scripts/
127+
- patches/
128+
- e2e/
129+
- locales/
130+
- .github/
131+
132+
models:
133+
default: azure/grok-4-fast-reasoning
134+
escalation: anthropic/claude-sonnet-4-6
135+
escalationThreshold: 2
136+
137+
escalationPatterns:
138+
- 'confirm|transaction|swap|bridge|send'
139+
- 'predict|perp|trade|stake|exchange'
140+
- 'keyring|vault|seed|mnemonic|private.?key'
141+
- 'auth|permission|access.?control|role'
142+
143+
144+
modes:
145+
- pr-risk-analysis
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[
2+
{
3+
"name": "controller-version-bump",
4+
"description": "MetaMask controller package version changed",
5+
"trigger": {
6+
"file": "package.json",
7+
"diffPattern": "@metamask/.*-controller"
8+
},
9+
"result": {
10+
"merge_safe": false,
11+
"risk_level": "high",
12+
"summary": "- One or more @metamask/*-controller package versions were changed — controller upgrades can alter core behavior."
13+
}
14+
}
15+
]

.github/actionlint.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ 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"
20-
- "bitrise_pool_name:DemoFAL"
2118

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

.github/actions/smart-e2e-selection/action.yml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ outputs:
4545
ai_confidence:
4646
description: 'AI confidence score (0-100)'
4747
value: ${{ steps.final-outputs.outputs.ai_confidence }}
48-
ai_risk_level:
49-
description: 'Risk level of the PR (low, medium, high) — indicates testing need and bug introduction likelihood'
50-
value: ${{ steps.final-outputs.outputs.ai_risk_level }}
5148
ai_performance_test_tags:
5249
description: 'Performance test tags to run (JSON array format, empty [] means no performance tests)'
5350
value: ${{ steps.final-outputs.outputs.ai_performance_test_tags }}
@@ -218,16 +215,6 @@ runs:
218215
else
219216
echo "force_run=false" >> "$GITHUB_OUTPUT"
220217
fi
221-
# Risk level: force_run → always high; otherwise use AI output
222-
AI_RISK='${{ steps.ai-analysis.outputs.ai_risk_level }}'
223-
if [[ "$FORCE_RUN" == "true" ]]; then
224-
echo "ai_risk_level=high" >> "$GITHUB_OUTPUT"
225-
elif [[ -n "$AI_RISK" ]]; then
226-
echo "ai_risk_level=$AI_RISK" >> "$GITHUB_OUTPUT"
227-
else
228-
echo "ai_risk_level=" >> "$GITHUB_OUTPUT"
229-
fi
230-
231218
- name: Display AI Analysis Outputs
232219
if: always()
233220
shell: bash
@@ -236,7 +223,6 @@ runs:
236223
echo "================================"
237224
echo "ai_e2e_test_tags: ${{ steps.final-outputs.outputs.ai_e2e_test_tags }}"
238225
echo "ai_confidence: ${{ steps.final-outputs.outputs.ai_confidence }}"
239-
echo "ai_risk_level: ${{ steps.final-outputs.outputs.ai_risk_level }}"
240226
echo "ai_performance_test_tags: ${{ steps.final-outputs.outputs.ai_performance_test_tags }}"
241227
echo "force_run: ${{ steps.final-outputs.outputs.force_run }}"
242228
echo "================================"
@@ -271,16 +257,6 @@ runs:
271257
echo "📝 No Smart E2E selection comments found"
272258
fi
273259
274-
- name: Apply risk label to PR
275-
if: inputs.pr-number != '' && inputs.github-token != '' && inputs.is-draft != 'true' && (inputs.base-ref == 'main' || startsWith(inputs.base-ref, 'release/'))
276-
shell: bash
277-
env:
278-
GH_TOKEN: ${{ inputs.github-token }}
279-
GITHUB_REPOSITORY: ${{ inputs.repository }}
280-
PR_NUMBER: ${{ inputs.pr-number }}
281-
RISK_LEVEL: ${{ steps.final-outputs.outputs.ai_risk_level }}
282-
run: node .github/scripts/e2e-risk-label.mjs
283-
284260
- name: Create PR comment
285261
if: inputs.post-comment == 'true' && inputs.pr-number != '' && inputs.github-token != ''
286262
shell: bash

.github/scripts/e2e-risk-label.mjs

Lines changed: 0 additions & 110 deletions
This file was deleted.

.github/scripts/e2e-smart-selection.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,9 @@ function generatePRComment(summaryContent) {
6363
}
6464

6565
function setGitHubOutputs(analysis) {
66-
const { tags, confidence, riskLevel, performanceTests } = analysis;
66+
const { tags, confidence, performanceTests } = analysis;
6767
setGithubOutputs('ai_e2e_test_tags', tags);
6868
setGithubOutputs('ai_confidence', confidence);
69-
setGithubOutputs('ai_risk_level', riskLevel);
7069
// Performance test tags (empty array means no performance tests needed)
7170
setGithubOutputs('ai_performance_test_tags', JSON.stringify(performanceTests.selectedTags));
7271
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: AI PR risk analysis
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
- ready_for_review
10+
11+
concurrency:
12+
group: ai-pr-risk-analysis-${{ github.event.pull_request.number || github.run_id }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
analyze:
17+
name: Analyze
18+
if: >-
19+
github.event_name == 'pull_request'
20+
&& !(github.event.pull_request.head.repo.fork || github.event.repository.fork)
21+
&& github.event.pull_request.draft == false
22+
&& (github.event.pull_request.base.ref == 'main' || startsWith(github.event.pull_request.base.ref, 'release/'))
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
pull-requests: write
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
33+
# https://github.com/MetaMask/ai-analyzer/releases
34+
- name: Checkout AI Analyzer
35+
uses: actions/checkout@v4
36+
with:
37+
repository: MetaMask/ai-analyzer
38+
ref: v1
39+
path: .ai-analyzer-action
40+
token: ${{ secrets.AI_ANALYZER_TOKEN || secrets.GITHUB_TOKEN }}
41+
42+
- name: Run AI PR Analysis
43+
uses: ./.ai-analyzer-action
44+
env:
45+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
with:
47+
mode: pr-risk-analysis
48+
add-comment: true
49+
add-label: true
50+
github-token: ${{ secrets.GITHUB_TOKEN }}
51+
litellm-api-key: ${{ secrets.LITELLM_API_KEY }}

0 commit comments

Comments
 (0)