Uh oh!
There was an error while loading. Please reload this page.
test(perps): add client recipe validation smoke - #8893
Conversation
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
The close order's slippage price was computed from the mid price fetched at script start (step 1), but the close happens at step 6 after leverage setup, order placement, and optional TP/SL — potentially minutes later. Stale price could cause the IOC close to miss and leave the position open.
…efore close - Change TP/SL order grouping from 'na' to 'positionTpsl' so HyperLiquid properly associates trigger orders with the open position. - Re-fetch mid price immediately before computing close order price to avoid stale price from script start causing IOC close to not fill.
abretonc7s
commented
May 27, 2026
Automated pr-complete run — #8893
Worker reportPR #8893 — Comments ReportPR Comments/Checks Addressedcursor[bot] Review Comments (2 issues)1. TP/SL orders use wrong grouping value (Medium Severity)
2. Close order uses stale price from script start (Medium Severity)
Bot Comments (not actionable)
CI Checks
Files Changed
Downstream Compatibility AssessmentNo impact. Changes are limited to Validation Results
|
Uh oh!
There was an error while loading. Please reload this page.
…feat/perps-e2e-validation # Conflicts: # packages/perps-controller/e2e/trading-lifecycle.ts
Uh oh!
There was an error while loading. Please reload this page.
The e2e limit-order script could continue into cancellation and final removal verification after failing to extract a resting order id. The final removal check then compared open orders against null, which made the cleanup verification look successful even though the script did not have a concrete exchange order to cancel or verify.\n\nThe script now records an explicit failure when no resting order id is extracted and exits with the accumulated runner result before any cancellation/removal checks run.\n\nConstraint: Review feedback targeted the e2e script behavior only; keep the production controller surface unchanged.\nRejected: Leave the final null comparison in place | it preserves the misleading cleanup signal reported by Bugbot.\nConfidence: high\nScope-risk: narrow\nTested: yarn workspace @metamask/perps-controller test --bail --no-coverage\nTested: yarn exec eslint packages/perps-controller/e2e/limit-orders.ts\nNot-tested: Live trading scenario execution; HL_E2E_PRIVATE_KEY is not configured in this slot.
## Explanation Adds a self-contained Recipe v1 headless example for `@metamask/perps-controller`, stacked on #8893. This version avoids using the direct HyperLiquid e2e scripts as the proof path. The recipes now exercise public `PerpsController` methods through a headless in-memory provider so the proof demonstrates controller/service/provider orchestration without UI, wallet credentials, or direct exchange calls. Included recipes: - `market-data.recipe.json`: calls `PerpsController.getMarkets` and asserts the returned market data. - `trading-lifecycle.recipe.json`: calls `placeOrder`, `updatePositionTPSL`, and `closePosition` and asserts each controller result. Also adds local ignore entries for AI/temp artifacts so the pre-push lint hook does not scan local-only state directories. ## Validation - `yarn eslint eslint.config.mjs packages/perps-controller/recipe-v1/runner.ts` - `yarn lint:misc --check packages/perps-controller/package.json packages/perps-controller/tsconfig.json packages/perps-controller/recipe-v1/manifests/perps.action-manifest.json packages/perps-controller/recipe-v1/recipes/market-data.recipe.json packages/perps-controller/recipe-v1/recipes/trading-lifecycle.recipe.json` - `yarn workspace @metamask/perps-controller recipe:market-data` - `yarn workspace @metamask/perps-controller recipe:trading-lifecycle` - `git push` pre-push hook: `yarn lint` passed ## References - Stacked on #8893 ## Checklist - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've updated the test suite for new or updated code as appropriate - [ ] I've updated changelogs for packages I've changed, or this change is internal/dev-only tooling - [ ] I've introduced breaking changes and prepared consumer PRs if needed
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
abretonc7s
commented
Jun 1, 2026
Heads up: PR #8955 was merged into this branch accidentally and then reverted in Replacement direction is to keep |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
abretonc7s
commented
Jun 2, 2026
@SocketSecurity ignore npm/@farmslot/recipe-harness@0.1.0 Reviewed for this PR: |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 6c7cd07. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
geositta
left a comment
There was a problem hiding this comment.
Thanks for adding a package native PerpsController client smoke test and a Farmslot recipe around it. The test itself passes, the recipe schema validates, formatting passes, and git diff --check origin/main...HEAD passes.
I am requesting changes because the new headless recipe currently depends on Jest's default Watchman behavior. In a headless agent workspace, the documented recipe command fails before producing the JSON evidence artifact.
Please add --watchman=false to the recipe’s Jest command so the validation recipe runs deterministically in the environment it is designed for.
Uh oh!
There was an error while loading. Please reload this page.
…tion Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # .gitignore # packages/perps-controller/package.json # yarn.lock
Add --watchman=false to the client-smoke recipe Jest command so headless Farmslot validation does not fail when Watchman is unavailable. Co-authored-by: Cursor <cursoragent@cursor.com>
Move Farmslot artifact paths out of the root .gitignore into a package-local ignore file and use package-local recipe artifact dirs. Co-authored-by: Cursor <cursoragent@cursor.com>
Route client-smoke recipe output and Farmslot evidence under temp/perps-controller/ and ignore temp/ at the repo root instead of maintaining package-local artifact directories. Co-authored-by: Cursor <cursoragent@cursor.com>
abretonc7s
commented
Jun 11, 2026
Closing — superseded by a different design. Recipe/e2e validation for |
Pull request was closed

Explanation
Adds a minimal headless recipe validation path for
@metamask/perps-controllerthat matches the intended Mobile/Extension boundary: a client callsPerpsController:*messenger actions, and the controller delegates to its services/providers.This replaces the previous standalone HyperLiquid e2e scripts. The recipe/test no longer imports or constructs HyperLiquid SDK clients directly.
Changes
packages/perps-controller/e2e/*HyperLiquid scripts.@farmslot/recipe-harnessas a dev dependency.packages/perps-controller/recipes/client-smoke.recipe.jsonplus a small official-action manifest.packages/perps-controller/recipes/README.mdexplaining recipes as structured agentic-loop validation compatible with Extension/Mobile validation usage.yarn workspace @metamask/perps-controller exec farmslot-recipe ....PerpsController.client-smoke.test.ts, which simulates an installed MetaMask client dispatching controller messenger actions:PerpsController:getMarketsPerpsController:getPositionsPerpsController:getAccountStatePerpsController:placeOrderPerpsController:cancelOrderFarmslot dependency
Already published under the
@farmslotnpm scope:@farmslot/protocol@0.5.0@farmslot/recipe-harness@0.1.0Validation
yarn install --immutableNODE_OPTIONS=--experimental-vm-modules yarn workspace @metamask/perps-controller jest --runInBand --no-coverage --runTestsByPath tests/src/PerpsController.client-smoke.test.ts --verboseyarn workspace @metamask/perps-controller exec farmslot-recipe run recipes/client-smoke.recipe.json --artifacts-dir ../../.recipe-artifacts/perps-controller/client-smoke --action-manifest recipes/headless.action-manifest.json --project-root .passyarn lintgit pushReferences
Checklist
Note
Low Risk
Test-only and dev-tooling changes; no published controller API or runtime behavior changes.
Overview
Adds a Farmslot recipe path for
@metamask/perps-controllerso agentic validation can run repeatable headless checks and collect Jest JSON evidence under gitignored repo-roottemp/, without changing packagescripts.The recipe (
client-smoke.recipe.json) runsPerpsController.client-smoke.test.ts, asserts exit code and Jest report fields, and indexes artifacts.@farmslot/recipe-harnessis added as a dev-only dependency with a small official-action manifest and README for explicitfarmslot-recipeinvocation.The new smoke test models Mobile/Extension usage: a client dispatches
PerpsController:*messenger actions (getMarkets,getPositions,getAccountState,placeOrder,cancelOrder) through a dispatching mock messenger, with services/providers mocked and no direct HyperLiquid/protocol SDK usage.Reviewed by Cursor Bugbot for commit 17fb836. Bugbot is set up for automated code reviews on this repo. Configure here.