fix(perps): Mobile decimals on open orders#29799
Conversation
|
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. |
Open orders displayed trigger/limit prices with fixed 2 decimals via PRICE_RANGES_MINIMAL_VIEW. Changed to PRICE_RANGES_UNIVERSAL to match market price precision (0 for BTC, 2 for mid-range, up to 6 for micro-cap tokens).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #29799 +/- ##
=======================================
Coverage 81.98% 81.99%
=======================================
Files 5301 5301
Lines 140621 140653 +32
Branches 32005 32016 +11
=======================================
+ Hits 115292 115322 +30
+ Misses 17493 17488 -5
- Partials 7836 7843 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Worker reportReport: TAT-3094 — Mobile decimals on open ordersSummaryOpen orders (limit, TP, SL) on compact order rows displayed trigger/limit prices with a fixed 2-decimal format ( Root cause
Data flow: Reproduction commitSHA: The marker logged the buggy formatting with Changes
Test planAutomated
Manual (Gherkin)Given the Trading account has open BTC TP/SL orders
When I navigate to BTC market details
Then the compact order rows show trigger prices with 0 decimals (matching market price format)
And the expanded order card shows trigger prices with 0 decimalsEvidence
Ticket |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Tag reasoning:
No other tags are warranted — this change does not touch navigation, accounts, networks, swaps, browser, snaps, or any shared infrastructure. Performance Test Selection: |
|



Description
Open orders (limit, TP, SL) on compact order rows displayed trigger/limit prices with fixed 2 decimals. Changed
PRICE_RANGES_MINIMAL_VIEWtoPRICE_RANGES_UNIVERSALinPerpsCompactOrderRowso prices use market-appropriate decimals (e.g., 0 for BTC, 2 for mid-range, up to 6 for micro-cap tokens), matching how market prices and expanded order cards already display.Changelog
CHANGELOG entry: Fixed open order trigger/limit prices showing only 2 decimals instead of market-appropriate precision
Related issues
Fixes: TAT-3094
Manual testing steps
Screenshots/Recordings
Compact order row price formatting changed from PRICE_RANGES_MINIMAL_VIEW (fixed 2 decimals) to PRICE_RANGES_UNIVERSAL (market-appropriate decimals).
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Validation Recipe
recipe.json
{ "pr": "29799", "title": "Open order prices use market-appropriate decimals", "jira": "TAT-3094", "acceptance_criteria": [ "AC1: Compact order rows display trigger/limit price with market-appropriate decimals instead of fixed 2 decimals", "AC2: Expanded order card detail view continues to display trigger/limit price correctly (no regression)" ], "validate": { "static": ["yarn lint:tsc"], "workflow": { "pre_conditions": ["wallet.unlocked", "perps.feature_enabled"], "entry": "setup-nav-market", "nodes": { "setup-nav-market": { "action": "call", "ref": "perps/market-discovery", "params": { "symbol": "BTC" }, "next": "ac1-eval-orders-exist" }, "ac1-eval-orders-exist": { "action": "eval_async", "expression": "Engine.context.PerpsController.getOpenOrders().then(function(orders) { var btcOrders = orders.filter(function(o) { return o.symbol === 'BTC' && o.status === 'open'; }); var results = btcOrders.map(function(o) { var tp = parseFloat(o.triggerPrice || o.price || '0'); return { orderId: o.orderId, triggerPrice: tp, type: o.detailedOrderType }; }); return JSON.stringify({ count: btcOrders.length, orders: results }); })", "assert": { "operator": "gt", "field": "count", "value": 0 }, "next": "ac1-assert-btc-price-range" }, "ac1-assert-btc-price-range": { "action": "eval_async", "expression": "Engine.context.PerpsController.getOpenOrders().then(function(orders) { var btcOrders = orders.filter(function(o) { return o.symbol === 'BTC' && o.status === 'open'; }); var o = btcOrders[0]; var price = parseFloat(o.triggerPrice || o.price || '0'); var isHighPrice = price > 10000; return JSON.stringify({ price: price, isHighPrice: isHighPrice, expectedMaxDecimals: isHighPrice ? 0 : 2, detailedType: o.detailedOrderType }); })", "assert": { "operator": "eq", "field": "isHighPrice", "value": true }, "next": "ac1-screenshot-market" }, "ac1-screenshot-market": { "action": "screenshot", "filename": "evidence-ac1-market-details.png", "note": "AC1: BTC market details screen showing order data available", "next": "ac2-eval-expanded-uses-universal" }, "ac2-eval-expanded-uses-universal": { "action": "eval_async", "expression": "Engine.context.PerpsController.getOpenOrders().then(function(orders) { var btcOrders = orders.filter(function(o) { return o.symbol === 'BTC' && o.status === 'open'; }); var results = btcOrders.map(function(o) { var price = parseFloat(o.triggerPrice || o.price || '0'); return { orderId: o.orderId, price: price, type: o.detailedOrderType, priceShouldHaveZeroDecimals: price > 10000 }; }); return JSON.stringify({ count: results.length, orders: results }); })", "assert": { "operator": "gt", "field": "count", "value": 0 }, "next": "done" }, "done": { "action": "end", "status": "pass" } } } } }Recipe Workflow
workflow.mmd
graph TD setup-nav-market["setup-nav-market<br/>call perps/market-discovery"] --> ac1-eval-orders-exist ac1-eval-orders-exist["ac1-eval-orders-exist<br/>eval_async: BTC orders exist"] --> ac1-assert-btc-price-range ac1-assert-btc-price-range["ac1-assert-btc-price-range<br/>eval_async: price > 10000"] --> ac1-screenshot-market ac1-screenshot-market["ac1-screenshot-market<br/>screenshot"] --> ac2-eval-expanded-uses-universal ac2-eval-expanded-uses-universal["ac2-eval-expanded-uses-universal<br/>eval_async: order data valid"] --> done done["done<br/>end: pass"]Note
Low Risk
Low risk UI-only change that alters decimal formatting for prices in
PerpsCompactOrderRowand updates unit tests accordingly.Overview
Compact perps open-order rows now format trigger/limit prices with market-appropriate precision.
PerpsCompactOrderRowswitchesformatPerpsFiatfromPRICE_RANGES_MINIMAL_VIEWtoPRICE_RANGES_UNIVERSAL, aligning compact rows with other perps price displays.Tests update the
formatUtilsmock and add an assertion thatformatPerpsFiatis called with{ ranges: PRICE_RANGES_UNIVERSAL }.Reviewed by Cursor Bugbot for commit 887f158. Bugbot is set up for automated code reviews on this repo. Configure here.