Skip to content

chore: Ensure Engine.state has complete engine state#21482

Merged
Gudahtt merged 2 commits intomainfrom
ensure-engine-state-is-complete
Jan 7, 2026
Merged

chore: Ensure Engine.state has complete engine state#21482
Gudahtt merged 2 commits intomainfrom
ensure-engine-state-is-complete

Conversation

@Gudahtt
Copy link
Copy Markdown
Member

@Gudahtt Gudahtt commented Oct 21, 2025

Description

The getter Engine.state was missing the state of some controllers. It has been updated to include everything, and a unit test has been added to ensure we don't forget to add state to this again in the future.

There is no known user impact, we don't rely on this state to be present right now. This was done to let us use this as a replacement for Engine.datamodel later on.

Changelog

CHANGELOG entry: null

Related issues

N/A

Manual testing steps

N/A

Screenshots/Recordings

N/A

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

Ensures the Engine.state getter exposes a complete engine state and guards access before initialization.

  • Adds missing GatorPermissionsController and SnapsRegistry to Engine.state in Engine.ts
  • Introduces tests in Engine.test.ts to assert:
    • Accessing Engine.state before initialization throws an error
    • Engine.state includes all controllers that have non-empty state

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

@metamaskbot metamaskbot added the team-core-platform Core Platform team label Oct 21, 2025
@Gudahtt Gudahtt force-pushed the ensure-engine-state-is-complete branch from 3ab5330 to 697685a Compare October 21, 2025 17:57
@Gudahtt Gudahtt added the skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. label Oct 21, 2025
@Gudahtt
Copy link
Copy Markdown
Member Author

Gudahtt commented Oct 21, 2025

Calling those lines "duplicate code" is ridiculous. I've skipped Sonar for this PR to suppress that blocker.

@Gudahtt Gudahtt force-pushed the ensure-engine-state-is-complete branch from 697685a to de86e5f Compare October 21, 2025 20:11
@Gudahtt Gudahtt marked this pull request as ready for review October 21, 2025 20:12
@Gudahtt Gudahtt requested a review from a team as a code owner October 21, 2025 20:12
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
100.0% Duplication on New Code (required ≤ 10%)
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@Gudahtt Gudahtt moved this to Needs dev review in PR review queue Oct 21, 2025
@Gudahtt Gudahtt force-pushed the ensure-engine-state-is-complete branch from de86e5f to d1d68b7 Compare December 16, 2025 13:11
The getter `Engine.state` was missing the state of some controllers. It has
been updated to include everything, and a unit test has been added to ensure we
don't forget to add state to this again in the future.
@Gudahtt Gudahtt force-pushed the ensure-engine-state-is-complete branch from d1d68b7 to 3b2d0d0 Compare January 6, 2026 20:22
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 6, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeCore, SmokeMultiChainPermissions, SmokeWalletPlatform
  • Risk Level: medium
  • AI Confidence: 80%
click to see 🤖 AI reasoning details

The changes modify the core Engine.ts file to add GatorPermissionsController and SnapsRegistry to the Engine's state getter. This is an additive change that ensures these controllers' states are properly exposed when accessing Engine.state. The test file adds a new test to verify that all controllers with state are included in the Engine.state export.

While this is a critical file (Engine.ts), the changes are relatively low-risk because:

  1. They are additive - adding missing state exports rather than modifying existing behavior
  2. The controllers (GatorPermissionsController and SnapsRegistry) are already initialized in the Engine
  3. The test addition helps catch similar issues in the future

I recommend running:

  • SmokeCore: To verify core wallet functionality isn't affected by Engine state changes
  • SmokeMultiChainPermissions: Since GatorPermissionsController is related to permissions management
  • SmokeWalletPlatform: To verify core wallet platform functionality with the updated state export

The changes don't directly affect swaps, staking, assets, notifications, or other specific features, so those tags are not necessary.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Jan 6, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
100.0% Duplication on New Code (required ≤ 10%)
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@github-project-automation github-project-automation bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Jan 7, 2026
@Gudahtt Gudahtt added this pull request to the merge queue Jan 7, 2026
Merged via the queue into main with commit 896e056 Jan 7, 2026
91 of 92 checks passed
@Gudahtt Gudahtt deleted the ensure-engine-state-is-complete branch January 7, 2026 15:01
@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-S skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. team-core-platform Core Platform team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants