Skip to content

chore: Remove unused PerpsController state#24251

Merged
abretonc7s merged 4 commits intomainfrom
chore/cleanup-dead-perps-state-code
Jan 7, 2026
Merged

chore: Remove unused PerpsController state#24251
abretonc7s merged 4 commits intomainfrom
chore/cleanup-dead-perps-state-code

Conversation

@gambinish
Copy link
Copy Markdown
Member

@gambinish gambinish commented Jan 5, 2026

Description

Removes unused state code in PerpsController

Changelog

CHANGELOG entry: Removes dead state code from PerpsController

Related issues

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

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

Before

After

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

Simplifies PerpsController state by removing unused positions and connectionStatus, aligning implementation and tests with actual data flow (positions come via provider callbacks; connection status not tracked in state).

  • Drops positions and connectionStatus from PerpsControllerState, default state, and state metadata
  • Updates tests to stop asserting/using these fields; adjusts connection tests to only verify provider disconnect()
  • Refactors usePerpsSelector tests to select isTestnet, activeProvider, and watchlistMarkets instead of removed fields
  • Cleans up mocks, snapshots, and initial-state fixtures to remove the fields
  • E2E perps-controller mixin no longer writes positions/connectionStatus into state

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 5, 2026

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.

@metamaskbot metamaskbot added the team-perps Perps team label Jan 5, 2026
@github-actions github-actions bot added the size-S label Jan 5, 2026
@github-actions github-actions bot added size-M and removed size-S labels Jan 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 6, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps
  • Risk Level: medium
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

This PR removes two deprecated state properties (connectionStatus and positions) from the PerpsController. The changes are:

  1. PerpsController.ts - Removes connectionStatus and positions from state type, default state, and metadata
  2. Unit tests - Updated to reflect removed properties (PerpsController.test.ts, usePerpsSelector.test.ts, index.test.ts)
  3. Mocks - Updated serviceMocks.ts and initial-background-state.json
  4. E2E infrastructure - Updated perps-controller-mixin.ts to not set removed properties
  5. Snapshots - Updated log snapshots

The changes are well-contained to the Perps feature. All related tests have been updated. The positions data is now managed through subscription services (HyperLiquidSubscriptionService) and hooks (usePerpsHomeData) rather than being stored in controller state. The connectionStatus was likely redundant with initializationState.

Since this is a state structure change in a controller (critical file pattern), it warrants running the SmokePerps tag to verify the Perpetuals trading feature still works correctly. The changes don't affect other features, so broader testing is not necessary.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Jan 6, 2026

@gambinish gambinish marked this pull request as ready for review January 6, 2026 16:28
@gambinish gambinish requested a review from a team as a code owner January 6, 2026 16:28
@abretonc7s abretonc7s added this pull request to the merge queue Jan 7, 2026
Merged via the queue into main with commit 541eda2 Jan 7, 2026
95 checks passed
@abretonc7s abretonc7s deleted the chore/cleanup-dead-perps-state-code branch January 7, 2026 01:31
@github-actions github-actions bot locked and limited conversation to collaborators Jan 7, 2026
@metamaskbot metamaskbot added the release-7.62.0 Issue or pull request that will be included in release 7.62.0 label Jan 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.62.0 Issue or pull request that will be included in release 7.62.0 size-M team-perps Perps team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants