feat: add @metamask/superstruct as a dependency#27096
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. |
Replace hardcoded DEFAULT_FEE_COLLECTION_FLAG with a superstruct schema that provides default values via `defaulted()`, enabling runtime validation of the remote feature flag while preserving the same defaults.
There was a problem hiding this comment.
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.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
The PredictController is a Phase 6 controller (business logic/features), which means it has more isolated impact. The changes don't affect:
SmokePredictions is required because it directly tests Polymarket prediction market integration including fee-related functionality. SmokeWalletPlatform is required because Predictions is a section inside the Trending tab, and changes to Predictions views/controllers affect Trending functionality. SmokeConfirmations is NOT required here because the changes are to the controller's feature flag parsing logic, not to the transaction/confirmation flow itself. The fee collection configuration is used internally by the Predict feature. Performance Test Selection: |
|
The committed fixture schema is out of date. To update, comment: |



Description
@metamask/superstruct(^3.2.1) as a direct dependency. This package provides runtime type validation utilities used across the MetaMask ecosystem.@metamask/abi-utilsfromdevDependencies— it was duplicated, already present independencies.superstructfor parsing PredictfeeCollectionfeature flagChangelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
N/A — dependency-only change.
Before
N/A
After
N/A
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Low risk dependency and validation change; main behavioral impact is that invalid
predictFeeCollectionremote flag payloads now reliably fall back toDEFAULT_FEE_COLLECTION_FLAGinstead of being used unchecked.Overview
Adds
@metamask/superstructas a direct dependency (and removes duplicate@metamask/abi-utilsfromdevDependencies).Introduces a small
Predictschema layer (parsehelper,HexSchema, andPredictFeeCollectionSchemawith defaults) and updatesPredictController.resolveFeatureFlags()to validate/normalize thefeeCollectionremote feature flag, falling back toDEFAULT_FEE_COLLECTION_FLAGon invalid input. Includes unit tests covering schema validation, defaulting, andparsefallback behavior.Written by Cursor Bugbot for commit b94d17c. This will update automatically on new commits. Configure here.