@deeeed/metamask-harness 0.51.8 → 0.51.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.51.9 - 2026-09-16
6
+
7
+ ### Changed
8
+
9
+ - Recipe guidance states how Perps testnet account state is handled: on an account or market the task owns, the proof converges the positions and orders it needs (team library `perps.ensure-market-state` / `perps.clean-market-testnet`, or Mobile/Core `ensure_positions` / `ensure_orders` with `mode=all` for strays) instead of refusing on a pre-existing position; Extension `ensure_*` stay assertion-only. `help`, `docs/RECIPES.md`, and the Perps mutation action descriptions say so. Mainnet stays read-only.
10
+
5
11
  ## 0.51.8 - 2026-09-15
6
12
 
7
13
  ### Fixed
package/docs/RECIPES.md CHANGED
@@ -192,10 +192,26 @@ transitions must use an explicitly funded leaf action.
192
192
  The Perps team library owns `perps.clean-market-testnet` for Mobile and Core,
193
193
  not Extension. Register that library before discovery or execution.
194
194
  They require explicit `account`, `market` and `exclusive_testnet_market=true`.
195
- That confirmation does not reserve the market or authorize deleting someone
196
- else's trades. Plan first and execute only with actual task ownership.
195
+ That confirmation does not reserve the market. Plan first and execute with
196
+ actual task ownership; on an account or market the task owns, converge the
197
+ state the proof needs (see Testnet account state) instead of refusing.
197
198
  Planning or calling a recipe never weakens those gates.
198
199
 
200
+ ### Testnet account state
201
+
202
+ On a testnet account or market the task owns for its run (the slot's fixture
203
+ account, or one reserved with `exclusive_testnet_market=true`), converging is an
204
+ explicit, ownership-scoped setup choice, not a violation. Use the team library's
205
+ `perps.ensure-market-state` or `perps.clean-market-testnet`, or on Mobile and
206
+ Core `metamask.perps.ensure_positions` / `metamask.perps.ensure_orders`
207
+ (`mode=all` for strays), record what was closed in the trace, then prove. A
208
+ pre-existing position or order on an account the task owns is never a reason to
209
+ block, skip, or refuse; a fixture that demands an empty account must converge
210
+ rather than refuse. Extension `ensure_*` and `teardown_state` only assert, so
211
+ converge there through an explicitly funded leaf action. Never broaden cleanup
212
+ onto an account or market the task does not own; obtain an owned one instead
213
+ of blocking. Mainnet is read-only.
214
+
199
215
  ### Mobile advanced-order setup
200
216
 
201
217
  These recipes belong to the Perps team library. Register it once:
@@ -389,9 +405,11 @@ The Perps team library's `perps.trading-lifecycle` combines the Core long market
389
405
  and limit examples. The harness retains read-only `perps.smoke` and
390
406
  `perps.snapshot` examples; trading policy belongs to the team library.
391
407
  It requires an explicit fixture account, market, and confirmation of exclusive
392
- testnet ownership. Initial assertions refuse non-flat state rather than clearing
393
- it. Failure-path cleanup is guarded by completed initial assertions and remains
394
- market-scoped, so it cannot safely share that account/market with another task.
408
+ testnet ownership. Its initial assertions refuse non-flat state rather than
409
+ clearing it, so a task proof converges its owned account first (see Testnet
410
+ account state). Failure-path cleanup is guarded by completed
411
+ initial assertions and remains market-scoped, so it cannot safely share that
412
+ account/market with another task.
395
413
  The limit branch uses the original 30%-below-mid offset; it must prove the order
396
414
  rests rather than assume it cannot fill. These trading paths still require live
397
415
  validation with a reserved funded testnet account.
@@ -1157,7 +1157,7 @@
1157
1157
  ]
1158
1158
  },
1159
1159
  "metamask.perps.close_positions": {
1160
- "description": "core Close selected live Perps positions on HyperLiquid testnet by driving the headless perps controller closePosition() through the full signing/provider path. Testnet only.",
1160
+ "description": "core Close selected live Perps positions on HyperLiquid testnet by driving the headless perps controller closePosition() through the full signing/provider path. Testnet only. Pre-existing testnet state on an account the task owns is converged, not refused; mainnet is never mutated.",
1161
1161
  "schema": {
1162
1162
  "type": "object",
1163
1163
  "properties": {
@@ -1427,7 +1427,7 @@
1427
1427
  "execution_capabilities": []
1428
1428
  },
1429
1429
  "metamask.perps.ensure_positions": {
1430
- "description": "core Higher-level wrapper that reads selected positions, places or closes via the headless controller as needed, then asserts the final position state. Testnet only.",
1430
+ "description": "core Higher-level wrapper that reads selected positions, places or closes via the headless controller as needed, then asserts the final position state. Testnet only. Pre-existing testnet state on an account the task owns is converged, not refused; mainnet is never mutated.",
1431
1431
  "schema": {
1432
1432
  "type": "object",
1433
1433
  "properties": {
@@ -1580,7 +1580,7 @@
1580
1580
  ]
1581
1581
  },
1582
1582
  "metamask.perps.close_orders": {
1583
- "description": "Core Perps cancellation selects current orders by market/side or mode=all, then dispatches and verifies those exact order IDs. Missing or duplicate selected IDs fail before dispatch. Requires authorized signing and task-owned selection; defaults to testnet.",
1583
+ "description": "Core Perps cancellation selects current orders by market/side or mode=all, then dispatches and verifies those exact order IDs. Missing or duplicate selected IDs fail before dispatch. Requires authorized signing and task-owned selection; defaults to testnet. Pre-existing testnet state on an account the task owns is converged, not refused; mainnet is never mutated.",
1584
1584
  "schema": {
1585
1585
  "type": "object",
1586
1586
  "properties": {
@@ -1914,7 +1914,7 @@
1914
1914
  "execution_capabilities": []
1915
1915
  },
1916
1916
  "metamask.perps.ensure_orders": {
1917
- "description": "core Default to testnet for Perps mutations; mainnet is read-only unless explicitly requested.Higher-level wrapper that reads selected orders, cancels when needed, then asserts final order state.",
1917
+ "description": "core Default to testnet for Perps mutations; mainnet is read-only unless explicitly requested.Higher-level wrapper that reads selected orders, cancels when needed, then asserts final order state. Pre-existing testnet state on an account the task owns is converged, not refused; mainnet is never mutated.",
1918
1918
  "schema": {
1919
1919
  "type": "object",
1920
1920
  "properties": {
@@ -4018,7 +4018,7 @@
4018
4018
  "execution_capabilities": []
4019
4019
  },
4020
4020
  "metamask.perps.close_orders": {
4021
- "description": "extension Default to testnet for Perps mutations; mainnet is read-only unless explicitly requested. Cancel selected live Perps open orders. Use selector/mode params to cancel matching symbols or all orders.",
4021
+ "description": "extension Default to testnet for Perps mutations; mainnet is read-only unless explicitly requested. Cancel selected live Perps open orders. Use selector/mode params to cancel matching symbols or all orders. Extension ensure_* only assert existing state; converge an owned testnet account through an explicitly funded leaf action. Mainnet is never mutated.",
4022
4022
  "schema": {
4023
4023
  "type": "object",
4024
4024
  "properties": {
@@ -4595,7 +4595,7 @@
4595
4595
  "execution_capabilities": []
4596
4596
  },
4597
4597
  "metamask.perps.ensure_positions": {
4598
- "description": "Read and assert the selected Extension Perps position state without creating or closing a position. Use an explicitly funded leaf action for any transition.",
4598
+ "description": "Read and assert the selected Extension Perps position state without creating or closing a position. Use an explicitly funded leaf action for any transition. Extension ensure_* only assert existing state; converge an owned testnet account through an explicitly funded leaf action. Mainnet is never mutated.",
4599
4599
  "schema": {
4600
4600
  "type": "object",
4601
4601
  "properties": {
@@ -4724,7 +4724,7 @@
4724
4724
  ]
4725
4725
  },
4726
4726
  "metamask.perps.ensure_orders": {
4727
- "description": "Read and assert the selected Extension Perps order state without creating or canceling an order. Use an explicitly funded leaf action for any transition.",
4727
+ "description": "Read and assert the selected Extension Perps order state without creating or canceling an order. Use an explicitly funded leaf action for any transition. Extension ensure_* only assert existing state; converge an owned testnet account through an explicitly funded leaf action. Mainnet is never mutated.",
4728
4728
  "schema": {
4729
4729
  "type": "object",
4730
4730
  "properties": {
@@ -2395,7 +2395,7 @@
2395
2395
  "execution_capabilities": []
2396
2396
  },
2397
2397
  "metamask.perps.close_positions": {
2398
- "description": "mobile Default to testnet for Perps mutations; mainnet is read-only unless explicitly requested. Close selected live Perps positions. Use selector/mode params to close matching symbols or all positions.",
2398
+ "description": "mobile Default to testnet for Perps mutations; mainnet is read-only unless explicitly requested. Close selected live Perps positions. Use selector/mode params to close matching symbols or all positions. Pre-existing testnet state on an account the task owns is converged, not refused; mainnet is never mutated.",
2399
2399
  "schema": {
2400
2400
  "type": "object",
2401
2401
  "properties": {
@@ -2486,7 +2486,7 @@
2486
2486
  "execution_capabilities": ["app-mutation", "external-mutation"]
2487
2487
  },
2488
2488
  "metamask.perps.close_orders": {
2489
- "description": "mobile Default to testnet for Perps mutations; mainnet is read-only unless explicitly requested. Cancel selected live Perps open orders. Use selector/mode params to cancel matching symbols or all orders.",
2489
+ "description": "mobile Default to testnet for Perps mutations; mainnet is read-only unless explicitly requested. Cancel selected live Perps open orders. Use selector/mode params to cancel matching symbols or all orders. Pre-existing testnet state on an account the task owns is converged, not refused; mainnet is never mutated.",
2490
2490
  "schema": {
2491
2491
  "type": "object",
2492
2492
  "properties": {
@@ -2886,7 +2886,7 @@
2886
2886
  "execution_capabilities": []
2887
2887
  },
2888
2888
  "metamask.perps.ensure_positions": {
2889
- "description": "mobile Default to testnet for Perps mutations; mainnet is read-only unless explicitly requested. Higher-level wrapper that reads selected positions, closes or places when needed, then asserts final position state.",
2889
+ "description": "mobile Default to testnet for Perps mutations; mainnet is read-only unless explicitly requested. Higher-level wrapper that reads selected positions, closes or places when needed, then asserts final position state. Pre-existing testnet state on an account the task owns is converged, not refused; mainnet is never mutated.",
2890
2890
  "schema": {
2891
2891
  "type": "object",
2892
2892
  "properties": {
@@ -3002,7 +3002,7 @@
3002
3002
  "execution_capabilities": ["app-mutation", "external-mutation"]
3003
3003
  },
3004
3004
  "metamask.perps.ensure_orders": {
3005
- "description": "mobile Converge selected testnet orders to open or absent, then independently assert the final state. Creating an open state uses a resting limit order.",
3005
+ "description": "mobile Converge selected testnet orders to open or absent, then independently assert the final state. Creating an open state uses a resting limit order. Pre-existing testnet state on an account the task owns is converged, not refused; mainnet is never mutated.",
3006
3006
  "schema": {
3007
3007
  "type": "object",
3008
3008
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deeeed/metamask-harness",
3
- "version": "0.51.8",
3
+ "version": "0.51.9",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mm-harness": "bin/mm-harness"
@@ -191,12 +191,15 @@
191
191
  "Performance: define a measured window, exclude setup, and compare equivalent builds, devices, and lifecycle conditions; action duration alone is not app latency.",
192
192
  {
193
193
  "text": "For Extension timing, inspect app.performance_capture/app.network_capture and the installed recipe-performance capture-extension-window.mjs helper before writing a collector. If LavaMoat blocks an observation API, capture its reference before initialization via Page.addScriptToEvaluateOnNewDocument during explicit setup, not inside the measured window. Keep domain predicates in the team recipe; see docs/RECIPES.md#extension-timing-observation.",
194
- "adapters": ["extension"]
194
+ "adapters": [
195
+ "extension"
196
+ ]
195
197
  },
196
198
  "Retain samples and declared limits when a measurement fails. For memory growth, compare an equal-duration idle control before attributing it to navigation; do not raise the budget to make the run pass.",
197
199
  "Analytics: verify the collection destination and existing consent before capture. Changing participation or marketing consent requires operator approval and restoration of the prior settings; a recipe's hardcoded opt-in is not permission. Missing collection prerequisites are not missing product events.",
198
200
  "Flake risk: wait on observable state instead of sleeping, keep device and runtime identity explicit, and never overwrite a prior run's artifacts.",
199
- "Mutation: require an independent state assertion and identity-bound receipt. Bind activity to that operation's accepted ID; an old row or nonzero count is insufficient. Opening and closing orders have different IDs. Schedule authorized cleanup in teardown, verify its result, and report any residue. Testnet cleanup must not cancel another task's orders or close its positions.",
201
+ "Mutation: require an independent state assertion and identity-bound receipt. Bind activity to that operation's accepted ID; an old row or nonzero count is insufficient. Opening and closing orders have different IDs. Schedule authorized cleanup in teardown, verify its result, and report any residue. Testnet cleanup closes what the task opened and never silently undoes another task's live proof on a reserved account or market.",
202
+ "Testnet account state: on a testnet account or market the task owns for its run (the slot's fixture account, or one reserved with exclusive_testnet_market=true), converging is an explicit, ownership-scoped setup choice, not a violation. Use the team library's perps.ensure-market-state or perps.clean-market-testnet, or on Mobile and Core metamask.perps.ensure_positions / metamask.perps.ensure_orders (mode=all for strays), record what was closed in the trace, then prove. A pre-existing position or order on an account the task owns is never a reason to block, skip, or refuse, and a fixture that demands an empty account must converge rather than refuse. Extension ensure_* and teardown_state only assert; converge there through an explicitly funded leaf action. Never broaden cleanup onto an account or market the task does not own; obtain an owned one instead of blocking. Mainnet is read-only.",
200
203
  {
201
204
  "text": "An accepted order can fill before the UI updates. Preserve its receipt even when the expected resting-order assertion fails; one empty read does not prove cleanup. Check the read API's cache and freshness options before adding polling. Reconcile returned margin against the pre-placement balance. A successful close does not turn the original failed proof into a pass.",
202
205
  "adapters": [