fix: perps activity reducer fires console.error on unhandled HL fill directions (Spot Dust Conversion)#30174
Conversation
…L fill directions (Spot Dust Conversion)
|
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. |
Worker reportFix Report — TAT-3090SummaryThe perps activity reducer in Root cause
Reproduction commitSHA: Metro log did not capture runtime console output in this session (only startup messages present), so reproduction was confirmed via CDP eval simulating the direction-matching logic and source code analysis. Changes
Test planAutomated
Manual verification (Gherkin)Given a HL account with Spot Dust Conversion fills
When the perps activity screen is loaded
Then no console.error is emitted for Spot Dust Conversion fills
And the fills are silently dropped from the activity list
And all existing fill directions continue to render correctlyEvidence
Ticket |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
These are minor defensive fixes in the Perps transaction transformation utility. The utility is used by SmokePerps is selected as the primary tag since this directly affects Perps transaction history display and the Add Funds/balance verification flows. SmokeWalletPlatform is selected per the SmokePerps tag description which states: "Perps is also a section inside the Trending tab (SmokeWalletPlatform); changes to Perps views affect Trending. When selecting SmokePerps, also select SmokeWalletPlatform." SmokeConfirmations is NOT selected because the change is purely in the transaction transformation utility (post-transaction data processing), not in the confirmation flow itself. No performance tests are needed — this is a logging/filtering change with no rendering or data-loading performance implications. Performance Test Selection: |
|



Description
The perps activity reducer emits
console.errorfor HL fills with unrecognizeddirvalues like "Spot Dust Conversion" (HL housekeeping — auto-conversion of spot dust to USDC). This pollutes Sentry/dev console and trips automated recipe gating. Fix adds explicit silent skip for "Spot Dust Conversion" and downgrades the default unknown-direction branch fromconsole.errortoconsole.warn.Changelog
CHANGELOG entry: null
Related issues
Fixes: TAT-3090
Manual testing steps
Screenshots/Recordings
No visual evidence selected for publication.
Pre-merge author checklist
Pre-merge reviewer checklist
Validation Recipe
recipe.json
{ "pr": "tat-3090", "title": "Verify Spot Dust Conversion fills are silently skipped and unknown directions emit warn not error", "jira": "TAT-3090", "acceptance_criteria": [ "AC1: Fills with direction 'Spot Dust Conversion' are silently skipped without console.error", "AC2: Fills with unknown direction emit console.warn instead of console.error", "AC3: All previously handled directions continue to work correctly" ], "validate": { "static": ["yarn lint:tsc"], "workflow": { "pre_conditions": ["wallet.unlocked"], "entry": "ac1-eval-dust-direction", "nodes": { "ac1-eval-dust-direction": { "action": "eval_sync", "expression": "(function(){ var d = 'Spot Dust Conversion'; var p1 = d.split(' ')[0]; var p2 = d.split(' ')[1]; var isOpen = p1 === 'Open'; var isClose = p1 === 'Close'; var isFlip = p2 === '>'; var isADL = d === 'Auto-Deleveraging'; var isBuy = d === 'Buy'; var isSell = d === 'Sell'; var isDust = d === 'Spot Dust Conversion'; var handled = isOpen || isClose || isFlip || isADL || isBuy || isSell || isDust; return JSON.stringify({direction: d, isDust: isDust, handled: handled, shouldSkipSilently: isDust}); })()", "assert": { "all": [ { "operator": "eq", "field": "isDust", "value": true }, { "operator": "eq", "field": "handled", "value": true }, { "operator": "eq", "field": "shouldSkipSilently", "value": true } ] }, "next": "ac2-eval-unknown-direction" }, "ac2-eval-unknown-direction": { "action": "eval_sync", "expression": "(function(){ var d = 'TBD-NEW-HL-DIRECTION'; var p1 = d.split(' ')[0]; var p2 = d.split(' ')[1]; var isOpen = p1 === 'Open'; var isClose = p1 === 'Close'; var isFlip = p2 === '>'; var isADL = d === 'Auto-Deleveraging'; var isBuy = d === 'Buy'; var isSell = d === 'Sell'; var isDust = d === 'Spot Dust Conversion'; var handled = isOpen || isClose || isFlip || isADL || isBuy || isSell || isDust; return JSON.stringify({direction: d, handled: handled, shouldWarnNotError: !handled && !!d}); })()", "assert": { "all": [ { "operator": "eq", "field": "handled", "value": false }, { "operator": "eq", "field": "shouldWarnNotError", "value": true } ] }, "next": "ac3-eval-known-directions" }, "ac3-eval-known-directions": { "action": "eval_sync", "expression": "(function(){ var dirs = ['Open Long', 'Close Long', 'Open Short', 'Close Short', 'Long > Short', 'Short > Long', 'Auto-Deleveraging', 'Buy', 'Sell']; var results = []; for (var i = 0; i < dirs.length; i++) { var d = dirs[i]; var p1 = d.split(' ')[0]; var p2 = d.split(' ')[1]; var isOpen = p1 === 'Open'; var isClose = p1 === 'Close'; var isFlip = p2 === '>'; var isADL = d === 'Auto-Deleveraging'; var isBuy = d === 'Buy'; var isSell = d === 'Sell'; var handled = isOpen || isClose || isFlip || isADL || isBuy || isSell; results.push({dir: d, handled: handled}); } var allHandled = results.every(function(r){ return r.handled; }); return JSON.stringify({allHandled: allHandled, count: results.length}); })()", "assert": { "all": [ { "operator": "eq", "field": "allHandled", "value": true }, { "operator": "eq", "field": "count", "value": 9 } ] }, "next": "teardown-done" }, "teardown-done": { "action": "end", "status": "pass" } } } } }Recipe Workflow
workflow.mmd
graph TD ac1-eval-dust-direction["ac1-eval-dust-direction<br/>eval_sync: Spot Dust Conversion handled"] --> ac2-eval-unknown-direction ac2-eval-unknown-direction["ac2-eval-unknown-direction<br/>eval_sync: unknown direction warn not error"] --> ac3-eval-known-directions ac3-eval-known-directions["ac3-eval-known-directions<br/>eval_sync: all 9 known directions handled"] --> teardown-done teardown-done["teardown-done<br/>end: pass"]Note
Low Risk
Low risk: only adjusts fill-direction handling and logging, plus adds tests, without changing trade calculations for known directions.
Overview
Prevents noisy error logging when transforming HL fills into perps activity transactions.
transformFillsToTransactionsnow silently skips fills with directionSpot Dust Conversion, and changes unknown/missing direction handling fromconsole.errortoconsole.warnwhile continuing to drop those fills.Adds unit tests asserting the skip behavior and that unknown/empty directions warn (and never error).
Reviewed by Cursor Bugbot for commit 982577b. Bugbot is set up for automated code reviews on this repo. Configure here.