Skip to content

feat(agentic): add mobile decimal reference recipe#28992

Merged
abretonc7s merged 3 commits into
mainfrom
feat/perps/mobile-decimal-reference-recipe
Apr 18, 2026
Merged

feat(agentic): add mobile decimal reference recipe#28992
abretonc7s merged 3 commits into
mainfrom
feat/perps/mobile-decimal-reference-recipe

Conversation

@abretonc7s

@abretonc7s abretonc7s commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a single reusable agentic recipe that captures mobile-side decimal
output across key Perps screens, so it can serve as the mobile reference
pass for later extension parity checks.

  • scripts/perps/agentic/teams/perps/recipes/reference-decimal-key-screens.json
    — one entrypoint, covers market details, order, close, withdraw,
    adjust-margin, flip, and position card screens. No dependency on
    extra committed flows. Rerunnable against live mobile state to
    regenerate a fresh baseline.
  • Adds testIDs on decimal values across the covered Perps screens
    (entry / liq / funding / fees / receive / etc.) so the recipe can
    assert against stable targets.
  • Extends AgenticService with text-scraping bridge helpers
    (pressText, getTextByTestId, getAncestorTextsByTestId,
    getRowValue) the recipe uses to extract row values.

Intended reuse model:

  1. run the mobile reference recipe
  2. run the extension extraction pass
  3. compare the two outputs

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

Feature: mobile decimal reference recipe

  Scenario: capture mobile decimal baseline
    Given the app is built and Metro + CDP are connected

    When the user runs `bash scripts/perps/agentic/validate-recipe.sh scripts/perps/agentic/teams/perps/recipes/reference-decimal-key-screens.json --testnet`
    Then the recipe visits the covered Perps screens and writes the captured values + trace.json into the artifacts directory

Screenshots/Recordings

Before

N/A — tooling/testID PR, no user-visible UI change.

After

N/A — tooling/testID PR, no user-visible UI change.

Pre-merge author checklist

  • I've followed MetaMask Contributor Docs and MetaMask Mobile Coding Standards
  • I've completed the PR template to the best of my ability
  • I've included tests if applicable
  • I've documented my code using JSDoc format if applicable
  • I've applied the right labels on the PR

Performance checks (if applicable)

  • I've tested on Android
  • I've tested with a power user scenario
  • I've instrumented key operations with Sentry traces for production performance metrics

Pre-merge reviewer checklist

  • I've manually tested the PR
  • 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.

Note

Medium Risk
Introduces new agentic bridge helpers that traverse React Fiber trees to press/extract text, which could be brittle across React Native/DevTools changes and may affect debugging behavior in dev builds. UI changes are limited to adding testID props on displayed values across Perps screens.

Overview
Adds a new agentic validation recipe (reference-decimal-key-screens.json) that navigates key Perps screens and captures displayed numeric/fiat values as a reusable baseline for later parity checks.

To support stable extraction, this PR expands Perps testID coverage on value fields (e.g., margin/liquidation/fees/receive/entry/funding/oracle price) and threads those IDs into shared components like PerpsFeesDisplay and PerpsCloseSummary.

Extends AgenticService with text-driven interaction and scraping utilities (pressText, getTextByTestId, getAncestorTextsByTestId, getRowValue) built on React Fiber traversal to locate pressables and read rendered text.

Reviewed by Cursor Bugbot for commit 5aa046a. Bugbot is set up for automated code reviews on this repo. Configure here.

Adds testIDs on decimal values across key Perps screens and extends
the agentic bridge with text-scraping helpers so a single reusable
recipe can capture the mobile-side decimal reference output.

The recipe scripts/perps/agentic/teams/perps/recipes/reference-decimal-key-screens.json
is the mobile reference pass for later extension parity checks.
@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.

@metamaskbotv2 metamaskbotv2 Bot added the team-perps Perps team label Apr 17, 2026
@abretonc7s abretonc7s marked this pull request as ready for review April 17, 2026 17:11
@abretonc7s abretonc7s requested a review from a team as a code owner April 17, 2026 17:11
@abretonc7s abretonc7s enabled auto-merge April 17, 2026 17:11
@github-actions github-actions Bot added the risk-medium Moderate testing recommended · Possible bug introduction risk label Apr 18, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit dca772e. Configure here.

Comment thread app/core/AgenticService/AgenticService.ts
@github-actions

Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
12 value mismatches detected (expected — fixture represents an existing user).
View details

@abretonc7s abretonc7s changed the title feat(perps): add mobile decimal reference recipe feat(agentic): add mobile decimal reference recipe Apr 18, 2026
@abretonc7s abretonc7s added the skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. label Apr 18, 2026
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 18, 2026
@abretonc7s abretonc7s added the skip-e2e skip E2E test jobs label Apr 18, 2026
@github-actions github-actions Bot added risk-low Low testing needed · Low bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps, SmokeWalletPlatform, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR makes two categories of changes:

  1. Perps UI testID additions (10 files): All changes across PerpsOrderView, PerpsWithdrawView, PerpsAdjustMarginView, PerpsClosePositionView, PerpsCloseSummary, PerpsFeesDisplay, PerpsFlipPositionConfirmSheet, PerpsMarketStatisticsCard, and PerpsPositionCard are purely additive testID props on existing Text/SensitiveText components. One minor refactoring in PerpsWithdrawView and PerpsMarketStatisticsCard changes label rendering from a plain object {text, variant, color} to a JSX <Text> element with testID - functionally equivalent but worth verifying. Perps.testIds.ts defines all new constants.

  2. AgenticService.ts (CRITICAL): Adds new bridge methods (pressText, getTextByTestId, getAncestorTextsByTestId, getRowValue) and helper functions for the agentic testing infrastructure. These are testing/automation utilities, not production app logic. The changes are additive and don't modify existing methods.

  3. reference-decimal-key-screens.json: New agentic recipe that exercises the new testIDs and AgenticService methods across perps screens. This is a scripts/testing artifact.

Tag rationale:

  • SmokePerps: Primary tag - all Perps component changes need validation to ensure testID additions and JSX refactoring didn't break rendering or functionality.
  • SmokeWalletPlatform: Required by SmokePerps description since Perps is a section inside the Trending tab.
  • SmokeConfirmations: Required by SmokePerps description since Add Funds deposits are on-chain transactions.

No other tags are warranted as changes are isolated to Perps components and agentic testing infrastructure.

Performance Test Selection:
No performance-impacting changes. All modifications are testID additions to existing components and new agentic service helper methods. No changes to rendering logic, data loading, state management, list rendering, or app initialization that would affect performance metrics.

View GitHub Actions results

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 117 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.19%. Comparing base (88bb30c) to head (5aa046a).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
app/core/AgenticService/AgenticService.ts 0.00% 115 Missing ⚠️
...erps/Views/PerpsWithdrawView/PerpsWithdrawView.tsx 0.00% 0 Missing and 1 partial ⚠️
...MarketStatisticsCard/PerpsMarketStatisticsCard.tsx 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #28992      +/-   ##
==========================================
- Coverage   82.26%   82.19%   -0.08%     
==========================================
  Files        5055     5055              
  Lines      133121   133236     +115     
  Branches    29795    29828      +33     
==========================================
  Hits       109518   109518              
- Misses      16173    16288     +115     
  Partials     7430     7430              

☔ View full report in Codecov by Sentry.
📢 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.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1.9% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@abretonc7s abretonc7s added this pull request to the merge queue Apr 18, 2026
Merged via the queue into main with commit 52154e1 Apr 18, 2026
134 of 156 checks passed
@abretonc7s abretonc7s deleted the feat/perps/mobile-decimal-reference-recipe branch April 18, 2026 06:31
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 18, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.75.0 Issue or pull request that will be included in release 7.75.0 label Apr 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.75.0 Issue or pull request that will be included in release 7.75.0 risk-low Low testing needed · Low bug introduction risk size-XL skip-e2e skip E2E test jobs skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. team-perps Perps team type-feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants