Skip to content

fix: fix stop loss banner debounce#27458

Open
gambinish wants to merge 3 commits intomainfrom
perps/fix-stop-loss-banner
Open

fix: fix stop loss banner debounce#27458
gambinish wants to merge 3 commits intomainfrom
perps/fix-stop-loss-banner

Conversation

@gambinish
Copy link
Member

@gambinish gambinish commented Mar 12, 2026

Description

Simplifying debounce logic to allow the stop loss banner to be shown predictably.

Changelog

CHANGELOG entry: fix stop loss banner rendering issue

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/TAT-2323

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Screen.Recording.2026-03-12.at.3.40.10.PM.mov

Pre-merge author checklist

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.

Note

Medium Risk
Changes the decision logic for when the Perps stop-loss prompt banner appears by removing time-based ROE debouncing, which can alter user-facing risk prompts and their timing across markets.

Overview
Simplifies useStopLossPrompt so the stop_loss banner shows as soon as ROE breaches the threshold after the minimum position age is met, removing the previous 60s ROE debounce behavior.

Updates position-age handling to allow positionOpenedTimestamp (order fills) to immediately satisfy the age requirement when the position is already old enough, and removes the unused RoeDebounceMs config plus associated unit tests/expectations.

Written by Cursor Bugbot for commit 32d3e84. This will update automatically on new commits. Configure here.

@metamaskbot metamaskbot added the team-perps Perps team label Mar 12, 2026
@gambinish gambinish marked this pull request as ready for review March 12, 2026 22:46
@gambinish gambinish requested a review from a team as a code owner March 12, 2026 22:46
@github-actions
Copy link
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The changes are isolated to the Perps feature (PerpsMarketDetailsView, perpsConfig constants, and useStopLossPrompt hook with associated test). These directly impact the perpetuals trading UI and related logic. Since SmokePerps validates core Perps flows (including Add Funds and balance updates), it must run to ensure no regression in trading flows. Per the tag dependency rules, selecting SmokePerps requires also selecting SmokeWalletPlatform (Perps section is embedded in Trending and platform activity views) and SmokeConfirmations (Add Funds deposits are on-chain transactions requiring confirmations). No changes were made to controllers, Engine, network stack, swaps, accounts, identity, ramps, snaps, or multi-chain APIs, so other tags are not required. Risk is medium because this affects user-facing trading UI and trading logic but is scoped to a single feature area.

Performance Test Selection:
Changes modify the Perps market details view and related hook logic, which can affect rendering behavior and interaction responsiveness within the Perps trading interface. Running @PerformancePreps ensures no regression in market loading, add funds flow, or perps screen responsiveness.

View GitHub Actions results

Copy link

@cursor cursor bot left a comment

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 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.

@github-actions
Copy link
Contributor

E2E Fixture Validation — Schema is up to date
16 value mismatches detected (expected — fixture represents an existing user).
View details

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants