You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(ci): resilient BrowserStack main reuse + fallback upload (#33277)
## **Description**
On test-only PRs, performance E2E reuses BrowserStack Android apps
uploaded from `main` instead of compiling fresh dual builds. The resolve
step was fragile: it only scanned BrowserStack `recent_apps` for IDs
like `MetaMask-Android-*-main-<run_id>`, so main apps that existed could
still be missed when the short recent list was flooded by other uploads.
When resolve failed hard, dual upload was skipped (`reuse_main_builds`)
and performance suites ran with no app.
This PR makes main BrowserStack reuse resilient:
1. Upload with a **stable per-branch `custom_id`**
(`MetaMask-Android-With-SRP-<slug>` / `…-Without-SRP-<slug>`, no
`run_id`) so BrowserStack overwrites the previous app for that ID.
2. Resolve via **`recent_apps/{custom_id}`** for the stable main IDs
first, then fall back to scanning the recent list for stable or legacy
`…-main-<run_id>` IDs.
3. If nothing is found, emit `found=false` and **fall back to a fresh
dual Android build/upload** instead of failing empty.
4. Quiet the unit-test J7 flaky-pattern flag by using `fs.mkdtempSync`
instead of `Date.now()` in the temp output path.
Follow-up to MMQA-1667 (#33180). Observed on verification PR #33270.
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Fixes: MMQA-1667
## **Manual testing steps**
```gherkin
Feature: BrowserStack main-app resolve for test-only performance PRs
Scenario: Resolve finds stable main custom_id
Given main has uploaded Android apps with custom_id MetaMask-Android-*-main
When a test-only PR runs performance E2E with reuse_main_builds=true
Then resolve-main-browserstack-urls sets found=true
And dual Android upload is skipped
And performance tests use the resolved BrowserStack app URLs
Scenario: Resolve miss falls back to fresh upload
Given BrowserStack has no resolvable main custom_id
When a test-only PR runs performance E2E with reuse_main_builds=true
Then resolve-main-browserstack-urls sets found=false
And Trigger Android Dual Versions runs and uploads new apps
` ` `
## **Screenshots/Recordings**
### **Before**
N/A — CI-only change, no UI affected.
### **After**
N/A — CI-only change, no UI affected.
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable
- [x] 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.
#### Performance checks (if applicable)
- [x] I've tested on Android
- Ideally on a mid-range device; emulator is acceptable
- [x] I've tested with a power user scenario
- 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
- [x] I've instrumented key operations with Sentry traces for production performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and [`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274) for an example
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
```
---
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: javiergarciavera <javiergarciavera@users.noreply.github.com>
Copy file name to clipboardExpand all lines: .github/guidelines/E2E_DECISION_TREE.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ When a PR only changes E2E/performance test files (and other ignorable files), C
32
32
33
33
The native build fingerprint for test-only PRs is computed from **`main` HEAD** (not the PR merge tree) so the lookup key matches completed `ci.yml` runs on `main`. Reuse tries GitHub Actions artifacts first, then the Cirrus `main` APK cache on Android.
34
34
35
-
If `main` has new native-changing commits but its CI build has not finished yet, reuse lookup may miss — CI logs a warning and **falls back to a fresh native build** instead of failing the workflow. Performance E2E on test-only PRs resolves BrowserStack apps by `custom_id` prefix `MetaMask-Android-*-main-*` so only uploads from `main`are reused (not other branches or PRs).
35
+
If `main` has new native-changing commits but its CI build has not finished yet, reuse lookup may miss — CI logs a warning and **falls back to a fresh native build** instead of failing the workflow. Performance E2E on test-only PRs resolves BrowserStack apps via stable main `custom_id`s (`MetaMask-Android-*-main`) first, then legacy `…-main-<run_id>` IDs; if none are found it **falls back to a fresh dual Android upload** instead of failing.
36
36
37
37
This applies when all changed files match `e2e_test_files` or `e2e_ignorable` filters in `.github/rules/filter-rules.yml`, with at least one E2E test file changed, and no E2E-relevant workflow files were modified.
0 commit comments