Skip to content

feat: Make breaking changes to next base-controller metadata - #6593

Merged
Gudahtt merged 2 commits into
mainfrom
require-new-metadata-in-next-base-controller
Sep 12, 2025
Merged

Gudahtt merged 2 commits into
mainfrom
require-new-metadata-in-next-base-controller

Conversation

@Gudahtt

@Gudahtt Gudahtt commented Sep 12, 2025 •

Copy link
Copy Markdown
Member

Explanation

Make the planned breaking changes to controller metadata. This includes renaming anonymous to includeInDebugSnapshot, and it includes making the two new metadata properties required.

References

Relates to #6443

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

Make the planned breaking changes to controller metadata. This includes
renaming `anonymous` to `includeInDebugSnapshot`, and it includes
making the two new metadata properties required.

Relates to #6443
@Gudahtt
Gudahtt marked this pull request as ready for review September 12, 2025 20:36
@Gudahtt
Gudahtt requested a review from a team as a code owner September 12, 2025 20:36

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Metadata Constraint Mismatch

The StatePropertyMetadataConstraint type is out of sync with StatePropertyMetadata. It still uses the anonymous property instead of includeInDebugSnapshot, and includeInStateLogs and usedInUi are optional instead of required. This breaks its intended supertype relationship, causing type incompatibility.

packages/base-controller/src/next/BaseController.ts#L109-L120

/**
* A universal supertype of `StatePropertyMetadata` types.
* This type can be assigned to any `StatePropertyMetadata` type.
*/
export type StatePropertyMetadataConstraint = {
anonymous: boolean | StateDeriverConstraint;
includeInStateLogs?: boolean | StateDeriverConstraint;
persist: boolean | StateDeriverConstraint;
usedInUi?: boolean;
};

Fix in Cursor Fix in Web


@cryptodev-2s cryptodev-2s left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Gudahtt
Gudahtt merged commit dac2789 into main Sep 12, 2025
240 checks passed
@Gudahtt
Gudahtt deleted the require-new-metadata-in-next-base-controller branch September 12, 2025 20:45
Gudahtt added a commit that referenced this pull request Oct 24, 2025
## Explanation

In the `next` export of `base-controller`, the type
`StatePropertyMetadataConstraint` mistakenly referenced the old metadata
property name `anonymous` rather than `includeInDebugSnapshot`. The type
has been updated to use the correct name.

## References

Fixes a mistake introduced in #6593

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs),
highlighting breaking changes as necessary
- [x] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Corrects `StatePropertyMetadataConstraint` in the experimental `next`
export to use `includeInDebugSnapshot` instead of `anonymous`, and
updates the changelog.
> 
> - **Type fix (experimental `next`)**
> - Update `StatePropertyMetadataConstraint` in
`packages/base-controller/src/next/BaseController.ts` to use
`includeInDebugSnapshot` (replacing `anonymous`).
> - **Changelog**
> - Add Unreleased entry documenting the fix in
`packages/base-controller/CHANGELOG.md`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
31f5c11. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants