Skip to content

Chore/nitro-fetch websockets#32091

Draft
adnxy wants to merge 7 commits into
mainfrom
chore/nitro-fetch-websockets
Draft

Chore/nitro-fetch websockets#32091
adnxy wants to merge 7 commits into
mainfrom
chore/nitro-fetch-websockets

Conversation

@adnxy

@adnxy adnxy commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Description

Changelog

CHANGELOG entry:

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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.

adnxy and others added 7 commits June 19, 2026 11:51
Replaces global.fetch with react-native-nitro-fetch (native C++ transport)
and registers startup prefetches for feature-flags and phishing lists so
responses are ready before the JS bundle needs them.

E2E builds are fully guarded: NitroFetchSetup.ts skips global.fetch install
and prefetchOnAppStart when hasTestOverrides is set; shim.js owns global.fetch
in that context using originalFetch (RN built-in, background-queue URLSession)
to avoid the Main Queue deadlock that caused the test-snap-get-file 150s timeout.
Replaces global.fetch with react-native-nitro-fetch (native C++ transport)
and registers startup prefetches for feature-flags and phishing lists so
responses are ready before the JS bundle needs them.

E2E builds are fully guarded: NitroFetchSetup.ts skips global.fetch install
and prefetchOnAppStart when hasTestOverrides is set; shim.js owns global.fetch
in that context using originalFetch (RN built-in, background-queue URLSession)
to avoid the Main Queue deadlock that caused the test-snap-get-file 150s timeout.
… comments

Restores the defensive GoogleService-Info.plist validation before
FirebaseApp.configure() to prevent an uncatchable NSException crash
when the plist is missing or contains a placeholder API_KEY on CI/test
builds. Also tightens nitro-fetch prefetch comments to be more concise.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace global.WebSocket with react-native-nitro-websockets and prewarm the
MetaMask backend gateway on cold start. Stacks on chore/nitro-fetch without
duplicating fetch bootstrap changes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Cover W3C adapter behaviour for property and addEventListener listeners,
send/close delegation, and startup prewarm registration.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@github-actions github-actions Bot added the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label Jun 19, 2026
@adnxy adnxy changed the title Chore/nitro fetch websockets Chore/nitro-fetch websockets Jun 19, 2026
@mm-token-exchange-service

Copy link
Copy Markdown

PR template — items to address before "Ready for review"

Blocking — these items fail the workflow until fixed:

  • Changelog section has an empty CHANGELOG entry: line. Fill in a description, write CHANGELOG entry: null, or apply the no-changelog label.

Warnings — informational, address before merging:

  • Related issues section is empty. Add Fixes: #123 / Closes: <URL> / Refs: <Jira key>, or write a short rationale after the colon.
  • Manual testing steps still contain template content (the Gherkin example title or a [...] placeholder). Replace with real steps, or write N/A — <reason>.
  • Screenshots/Recordings section is empty. Add an image/video for user-facing changes, logs/console output for non-user-facing changes, or write N/A if no evidence is applicable.
  • Pre-merge author checklist has unchecked items (e.g. "I've followed MetaMask Contributor Docs and MetaMask Mobile Coding Standards."). Every box must be consciously checked — see docs/readme/ready-for-review.md.

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​react-native-nitro-websockets@​1.0.3761001009370
Addednpm/​react-native-nitro-text-decoder@​0.2.07210010090100
Addednpm/​react-native-nitro-fetch@​1.3.37810010097100

View full report

@socket-security

Copy link
Copy Markdown

Caution

MetaMask internal reviewing guidelines:

  • Do not ignore-all
  • Each alert has instructions on how to review if you don't know what it means. If lost, ask your Security Liaison or the supply-chain group
  • Copy-paste ignore lines for specific packages or a group of one kind with a note on what research you did to deem it safe.
    @SocketSecurity ignore npm/PACKAGE@VERSION
Action Severity Alert  (click "▶" to expand/collapse)
Block Medium
Network access: npm react-native-nitro-fetch in module globalThis["fetch"]

Module: globalThis["fetch"]

Location: Package overview

From: package.jsonnpm/react-native-nitro-fetch@1.3.3

ℹ Read more on: This package | This alert | What is network access?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should remove all network access that is functionally unnecessary. Consumers should audit network access to ensure legitimate use.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/react-native-nitro-fetch@1.3.3. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Medium
Network access: npm react-native-nitro-websockets in module globalThis["fetch"]

Module: globalThis["fetch"]

Location: Package overview

From: package.jsonnpm/react-native-nitro-websockets@1.0.3

ℹ Read more on: This package | This alert | What is network access?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should remove all network access that is functionally unnecessary. Consumers should audit network access to ensure legitimate use.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/react-native-nitro-websockets@1.0.3. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@sonarqubecloud

Copy link
Copy Markdown

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.61111% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.43%. Comparing base (19d69fc) to head (72d23f9).
⚠️ Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
app/core/NitroFetchSetup.ts 95.45% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #32091      +/-   ##
==========================================
+ Coverage   83.41%   83.43%   +0.01%     
==========================================
  Files        5835     5838       +3     
  Lines      152895   153004     +109     
  Branches    36118    36133      +15     
==========================================
+ Hits       127545   127655     +110     
- Misses      16596    16603       +7     
+ Partials     8754     8746       -8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. size-XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants