Skip to content

feat(profile-sync-controller): add clearState to AuthenticationController - #10165

Merged
mathieuartu merged 4 commits into
mainfrom
feat/auth-clear-state
Sep 10, 2026
Merged

feat(profile-sync-controller): add clearState to AuthenticationController#10165
mathieuartu merged 4 commits into
mainfrom
feat/auth-clear-state

Conversation

@mathieuartu

@mathieuartu mathieuartu commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Explanation

References

Related to: https://consensyssoftware.atlassian.net/browse/MUL-2240

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
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Touches authentication lifecycle on wallet reset (session wipe and re-arming pairing gates); incorrect client wiring could leave stale auth state or skip required pairing on the next wallet.

Overview
Adds AuthenticationController.clearState() (and AuthenticationController:clearState) so hosts can wipe auth state on wallet reset, not just on sign-out. clearState replaces persisted state with defaultState: signed out, no srpSessionData, and both needsProfilePairing / needsSocialPairing set back to true.

performSignOut is unchanged in behavior; new tests document that sign-out still leaves pairing gates cleared, unlike a full reset.

clearState also bumps #profilePairingRequestEpoch (same mechanism as requestProfilePairing) so an in-flight performSignIn cannot clear needsProfilePairing after a reset mid-/pair. Test helpers gain optional delayed /pair mocks to cover that race.

Changelog and exported AuthenticationControllerClearStateAction are updated; consumers must allow the new messenger action if they call it through the registry.

Reviewed by Cursor Bugbot for commit c2ed73f. Bugbot is set up for automated code reviews on this repo. Configure here.

@mathieuartu mathieuartu self-assigned this Sep 10, 2026
@mathieuartu
mathieuartu requested review from a team as code owners September 10, 2026 10:01
@mathieuartu
mathieuartu deployed to default-branch September 10, 2026 10:01 — with GitHub Actions Active

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 14c076e. Configure here.

mathieuartu and others added 2 commits September 10, 2026 14:25
…n/AuthenticationController.test.ts

Co-authored-by: Charly Chevalier <charly.chevalier@consensys.net>
@mathieuartu
mathieuartu added this pull request to the merge queue Sep 10, 2026
Merged via the queue into main with commit 8efb521 Sep 10, 2026
137 checks passed
@mathieuartu
mathieuartu deleted the feat/auth-clear-state branch September 10, 2026 12:32
@georgeweiler georgeweiler mentioned this pull request Sep 10, 2026
4 tasks
pull Bot pushed a commit to Reality2byte/core that referenced this pull request Sep 10, 2026
## Explanation

Publishes `@metamask/profile-sync-controller@32.0.0` and
`@metamask/ramps-controller@22.0.0` so clients can pick up V2 ramps
order syncing via User Storage (MetaMask#9474).

- **profile-sync-controller 32.0.0:** adds
`BACKUPANDSYNC_FEATURES.rampsSyncing`, `isRampsSyncingEnabled`, and
`AuthenticationController.clearState()` (MetaMask#10165). **BREAKING:**
`UserStorageControllerState` requires `isRampsSyncingEnabled`.
- **ramps-controller 22.0.0:** adds V2 order sync
(`RampsController:syncOrdersWithUserStorage`). **BREAKING:** messenger
must delegate User Storage actions and
`AuthenticationController:isSignedIn`.

Also publishes dependent packages so clients can adopt the new majors
without retaining duplicate dependency versions:

- **Minor:** `@metamask/profile-metrics-controller@5.1.0`,
`@metamask/bridge-controller@81.1.0`,
`@metamask/bridge-status-controller@76.1.0`
- **Patch:** `@metamask/account-tree-controller@10.0.1`,
`@metamask/assets-controllers@112.0.1`,
`@metamask/claims-controller@1.0.1`, `@metamask/core-backend@10.0.1`,
`@metamask/notification-services-controller@28.0.1`,
`@metamask/shield-controller@7.0.1`,
`@metamask/smart-transactions-controller@27.0.1`,
`@metamask/social-controllers@3.0.1`,
`@metamask/subscription-controller@9.0.1`, and
`@metamask/transaction-pay-controller@28.0.1`.

## References

* Related to MetaMask#9474
* Follows 1247.0.0 after tags were restored:
https://github.com/MetaMask/core/releases/tag/v1247.0.0

## 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/processes/updating-changelogs.md)
- [x] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> No new runtime code in this diff, but it publishes major/breaking
controller releases and wide dependency realignment—client integrators
must adopt new state shapes and messenger wiring when bumping.
> 
> **Overview**
> **Monorepo release 1248.0.0** — bumps the root version and cuts new
package versions with updated `CHANGELOG.md` entries, `package.json`
dependency ranges, and `yarn.lock`.
> 
> The release ships **`@metamask/profile-sync-controller@32.0.0`** and
**`@metamask/ramps-controller@22.0.0`** (features already landed in
prior PRs; this PR only publishes them). Dependent packages are
republished mostly as **patch** bumps that raise
`@metamask/profile-sync-controller` to **`^32.0.0`** (and related bumps
such as `@metamask/account-tree-controller@10.0.1`,
`@metamask/assets-controllers@112.0.1`,
`@metamask/core-backend@10.0.1`).
**`@metamask/profile-metrics-controller@5.1.0`**,
**`@metamask/bridge-controller@81.1.0`**, and
**`@metamask/bridge-status-controller@76.1.0`** are included as minor
releases in the same train.
**`@metamask/transaction-pay-controller@28.0.1`** also picks up
**`@metamask/ramps-controller@^22.0.0`**.
> 
> Consumers upgrading to this release inherit the **documented breaking
changes** from profile-sync **32**
(`UserStorageControllerState.isRampsSyncingEnabled`) and ramps **22**
(extra messenger delegations for User Storage sync), plus wallet-reset
support via **`AuthenticationController.clearState()`** in the published
profile-sync version.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
2ff3eb7. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants