Skip to content

chore(agentic): improve mobile recipe validation and perps testability#28974

Merged
abretonc7s merged 1 commit into
mainfrom
wip/fs-cook-mm4-improvements
Apr 17, 2026
Merged

chore(agentic): improve mobile recipe validation and perps testability#28974
abretonc7s merged 1 commit into
mainfrom
wip/fs-cook-mm4-improvements

Conversation

@abretonc7s

@abretonc7s abretonc7s commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Description

This PR is limited to mobile app and mobile agentic validation improvements discovered while validating perps review flows on mm-4.

Scope of this PR:

  • stabilize Perps modify-action selectors so live validation no longer depends on the accidental undefined-* selector path
  • tighten the mobile agentic recipe contract so invalid wait_for.timeout usage fails fast
  • make validate-recipe.js schema-validate before execution
  • copy screenshots into the passed artifact directory so validation proof stays with the run artifacts
  • document the canonical mobile agentic timing fields in scripts/perps/agentic/README.md

Compatibility note:

  • default recipe artifact behavior is unchanged
  • only explicit --artifacts-dir runs now treat the provided path as the artifact root, so screenshots and run artifacts stay together under the requested directory

Out of scope for this PR:

  • .agents/skills/fs-cook
  • TRACKER.md
  • docs/readme/fs-cook*.md
  • worker-template integration
  • wrapper skill work (fs-review, fs-fixbug)
  • Codex-vs-Claude recipe delegation work

Changelog

CHANGELOG entry: null

Related issues

Fixes:

  • none

Manual testing steps

Feature: perps modify-action testability and mobile agentic validation contract

  Scenario: stable modify action selectors are available on the live BTC market details screen
    Given mm-4 is running MetaMask Mobile on PerpsMarketDetails for BTC
    When the user presses the modify button for the open position
    Then the modify action sheet selector appears
    And the stable flip option selector appears
    And the old undefined-derived selector is no longer needed

  Scenario: mobile agentic validation rejects invalid wait timing fields
    Given a recipe uses wait_for with timeout instead of timeout_ms
    When validate-flow-schema.js runs
    Then the recipe fails with an explicit schema error

  Scenario: screenshots are copied into the requested artifact directory
    Given validate-recipe.js runs a recipe with a screenshot step
    When the recipe passes
    Then the screenshot file is copied into the passed artifacts directory

Screenshots/Recordings

Before

  • Live validation had to rely on undefined-flip_position
  • Successful screenshots lived outside the requested artifact root

After

  • Live selector probe on mm-4 confirms:
    • perps-market-details-modify-button
    • perps-market-details-modify-action-sheet
    • perps-market-details-modify-action-sheet-flip_position
  • Successful screenshots copy into the requested artifacts directory

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.

@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 13:28
@abretonc7s abretonc7s requested a review from a team as a code owner April 17, 2026 13:28

@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 2 potential issues.

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 4ccba7d. Configure here.

Comment thread .agents/skills/fs-cook/scripts/run-cooking-lane.js Outdated
Comment thread .agents/skills/fs-cook/scripts/run-cooking-lane.js Outdated
Tighten the mobile agentic recipe contract so invalid wait timing fields fail fast, screenshots are copied into the requested artifacts directory, and Perps modify-action flows expose stable test IDs for live validation instead of relying on undefined-derived selectors.

Constraint: live mm-4 recipe validation needs deterministic selectors and artifact-local screenshot proof to be reviewable
Rejected: keep relying on undefined-flip_position | accidental selector from missing base testID is too brittle for agentic validation
Confidence: high
Scope-risk: moderate
Directive: keep modify-sheet entrypoints aligned on stable test IDs and keep validate-recipe fail-fast when schema contracts are violated
Tested: yarn jest app/components/UI/Perps/components/PerpsModifyActionSheet/PerpsModifyActionSheet.test.tsx app/components/UI/Perps/Views/PerpsSelectModifyActionView/PerpsSelectModifyActionView.test.tsx --no-coverage
Tested: node --check scripts/perps/agentic/validate-recipe.js
Tested: node --check scripts/perps/agentic/validate-flow-schema.js
Not-tested: full repo test suite
Not-tested: fresh post-reload live selector probe on the narrowed branch
@abretonc7s abretonc7s changed the title chore(agentic): improve fs-cook validation surfaces and perps testability chore(agentic): improve mobile recipe validation and perps testability Apr 17, 2026
@abretonc7s abretonc7s force-pushed the wip/fs-cook-mm4-improvements branch from 4ccba7d to 268671e Compare April 17, 2026 13:36
@abretonc7s abretonc7s marked this pull request as draft April 17, 2026 13:36
@github-actions github-actions Bot added size-S and removed size-XL labels Apr 17, 2026
@abretonc7s abretonc7s marked this pull request as ready for review April 17, 2026 13:38
@abretonc7s abretonc7s added the skip-e2e skip E2E test jobs label Apr 17, 2026
@github-actions github-actions Bot added the risk-low Low testing needed · Low bug introduction risk label Apr 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps, SmokeWalletPlatform
  • Selected Performance tags: @PerformancePreps
  • Risk Level: low
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
All changes are confined to the Perps feature area:

  1. Perps.testIds.ts: Added new PerpsModifyActionSheetSelectorsIDs enum with SHEET, ADD_TO_POSITION, REDUCE_POSITION, FLIP_POSITION IDs, and added MODIFY_ACTION_SHEET to PerpsOrderBookViewSelectorsIDs. These are purely additive test ID additions.

  2. PerpsModifyActionSheet.tsx: Changed the default value of testID prop from undefined to PerpsModifyActionSheetSelectorsIDs.SHEET. This is a minor change that ensures the sheet always has a stable testID.

  3. PerpsSelectModifyActionView.tsx: Added testID prop to the interface and passes it through to PerpsModifyActionSheet. This enables callers to specify a custom testID.

  4. PerpsMarketDetailsView.tsx and PerpsOrderBookView.tsx: Both now pass specific testIDs (PerpsMarketDetailsViewSelectorsIDs.MODIFY_ACTION_SHEET and PerpsOrderBookViewSelectorsIDs.MODIFY_ACTION_SHEET) to PerpsSelectModifyActionView.

  5. Unit test files: Updated to cover the new testID prop behavior.

  6. scripts/perps/agentic/: Improvements to the agentic testing infrastructure - schema validation is now run before recipe execution, artifact directory handling is improved, and documentation is updated. These are script-level changes that don't affect the app code.

Tag selection rationale:

  • SmokePerps: Directly required as the changes touch Perps components (PerpsModifyActionSheet, PerpsSelectModifyActionView, PerpsMarketDetailsView, PerpsOrderBookView). The testID changes could affect E2E test selectors.
  • SmokeWalletPlatform: Required per SmokePerps tag description - "When selecting SmokePerps, also select SmokeWalletPlatform (Trending section)". Perps is embedded in the Trending tab.
  • SmokeConfirmations: Per SmokePerps description, "also select SmokeConfirmations (Add Funds deposits are on-chain transactions)" - however, these changes are purely UI/testID additions to the modify action sheet, not to the Add Funds flow itself. The risk of breaking confirmations is negligible. However, to be safe and follow the tag dependency rules, including it would be conservative. Given the changes are purely additive testID props with no logic changes, SmokeConfirmations is not strictly necessary.

The changes are low-risk (additive testID props, no logic changes) and focused entirely on Perps UI components.

Performance Test Selection:
The changes touch PerpsModifyActionSheet, PerpsMarketDetailsView, and PerpsOrderBookView components. While the changes are purely additive (adding testID props), the PerpsOrderBookView and PerpsMarketDetailsView are core Perps UI components that are part of the perps trading flow. Running @PerformancePreps ensures no performance regression was inadvertently introduced in these views.

View GitHub Actions results

@abretonc7s abretonc7s enabled auto-merge April 17, 2026 13:51
@sonarqubecloud

Copy link
Copy Markdown

@abretonc7s abretonc7s added this pull request to the merge queue Apr 17, 2026
@abretonc7s abretonc7s marked this pull request as draft April 17, 2026 14:06
Merged via the queue into main with commit 1f92780 Apr 17, 2026
94 of 126 checks passed
@abretonc7s abretonc7s deleted the wip/fs-cook-mm4-improvements branch April 17, 2026 14:14
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 17, 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 17, 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-S skip-e2e skip E2E test jobs team-perps Perps team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants