Commit 09f76fa
authored
feat(ramp): opt-in RAMPS debug dashboard tooling (#28110)
## **Description**
Adds **opt-in** developer tooling so Money Movement / RAMPS engineers
can stream `RampsController` state and calls to a local browser
dashboard without loading the bridge for every dev build.
- **`RAMPS_DEBUG_DASHBOARD=true`** in `.js.env` + Metro restart enables
the bridge; **`RAMPS_DEBUG_DASHBOARD_URL`** overrides the WebSocket URL
(devices/emulators).
- **Dynamic `import()`** from `ramps-controller-init.ts` so the bridge
(including fetch instrumentation) is omitted from the bundle unless
enabled.
- **`app/components/UI/Ramp/debug/README.md`** — setup, `adb reverse`,
env vars.
- **`ramps-debug-dashboard/`** — self-contained Node server (`npm ci` +
`node server.mjs`); session logs gitignored.
- Includes prior commit on this branch: **CODEOWNERS** paths for Money
Movement (`@MetaMask/money-movement`) and **`ramps-debug-dashboard/`**
entry.
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: RAMPS debug dashboard
Scenario: Dashboard receives data when opt-in env is set
Given a debug build with RAMPS_DEBUG_DASHBOARD=true in .js.env and Metro restarted
And ramps-debug-dashboard is running (npm ci && node server.mjs)
When the app launches and RampsController is active
Then the browser UI at http://localhost:8099 shows state/method traffic
And Metro logs include a RampsDebug connected message
```
## **Screenshots/Recordings**
<div>
<a href="https://www.loom.com/share/4644574b45ae42e6beda7d17b627a6ca">
<p>Ramps Debug Dashboard - Watch Video</p>
</a>
<a href="https://www.loom.com/share/4644574b45ae42e6beda7d17b627a6ca">
<img style="max-width:300px;"
src="https://cdn.loom.com/sessions/thumbnails/4644574b45ae42e6beda7d17b627a6ca-cc0038d0a8a8afd5-full-play.gif#t=0.1">
</a>
</div>
## **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.
## **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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Dev-only code now conditionally patches `fetch` and wraps
`RampsController` methods when `RAMPS_DEBUG_DASHBOARD=true`, which could
affect local debugging behavior if enabled. Production behavior should
remain unchanged due to `__DEV__` gating and optional `require`.
>
> **Overview**
> Adds an **opt-in, `__DEV__`-only** “RAMPS debug dashboard” that
streams `RampsController` state changes, method calls (with
timing/cache-hit heuristics), and selected ramps-related `fetch` traffic
to `ws://localhost:8099`.
>
> Introduces a self-contained host dashboard under
`scripts/money-movement/debug-dashboard/` (Node HTTP+WebSocket server,
JSONL session logging, and `yarn ramps:debug-dashboard` runner) plus new
docs and env var guidance in `.js.env.example`.
>
> Updates `ramps-controller-init` to conditionally `require` and
initialize the bridge when `RAMPS_DEBUG_DASHBOARD=true`, adds Jest
coverage for that gating, and excludes the new debug tooling from Sonar
coverage and the security code scanner.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
b8ed425. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 8c0e92c commit 09f76fa
File tree
17 files changed
+2309
-1
lines changed- .github/workflows
- app
- components/UI/Ramp/debug
- core/Engine/controllers/ramps-controller
- scripts/money-movement/debug-dashboard
17 files changed
+2309
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
57 | 61 | | |
58 | 62 | | |
59 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
0 commit comments