Repository navigation
fix(kyc-controller): Make SessionStatus.finalStatus: pending only possible after sumsub has been fully submitted again - #11094
Conversation
SessionStatus.finalStatus: pending only possible after sumsub has been fully submitted again
…-augment Co-authored-by: Cursor <cursoragent@cursor.com>
| export function patchKycSessionStatus( | ||
| sessionStatus: KycSessionStatus, | ||
| ): KycSessionStatus { | ||
| if ( | ||
| sessionStatus.finalStatus === KYC_STATUSES.pending && | ||
| sessionStatus.currentStep === KYC_CURRENT_STEPS.kyc | ||
| ) { | ||
| return { | ||
| ...sessionStatus, | ||
| finalStatus: 'new', | ||
| }; | ||
| } | ||
| return sessionStatus; | ||
| } | ||
|
|
There was a problem hiding this comment.
Looks odd to me to expose this function inside a types file? I see we also have needsCapabilityAuthorizationRefresh function inside this file, is it done on purpose?
There was a problem hiding this comment.
yeah. These are effectively helpers for reading/modifying the KycSessionStatus type. They seem thin/simple enough that they don't warrant their own file yet. We could put these in a separate kycSessionStatus.ts file (or somewhere else) if you feel strongly
There was a problem hiding this comment.
That's not a blocker at all, let's keep them here for now.
…-augment Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort 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.
Reviewed by Cursor Bugbot for commit d0145b5. Configure here.
|
@metamaskbot publish-preview |
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
…-augment Co-authored-by: Cursor <cursoragent@cursor.com>
## Explanation Reverts MetaMask#11205 (`Release 1378.0.0`), which was merged before its predecessor [Release/1377.0.0](MetaMask#11203) had been released. The release numbering assumed 1377 would land first, so this release has to come off `main`. The revert restores: - Root version `1378.0.0` → `1376.0.0` - `@metamask/kyc-controller` `0.14.0` → `0.13.0` - The `ensureLocalUserSecret` (MetaMask#11099), `getDataShares` (MetaMask#11158) and `currentStep` (MetaMask#11094) entries move back under `[Unreleased]` Nothing was published. The `main` run for the merge failed on an unrelated `rate-limit-controller` test, so the `Publish release` job was skipped. No tags were created, and npm still lists `@metamask/kyc-controller` at `0.13.0`. ## References - Reverts MetaMask#11205 ## 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) - [ ] 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 Made with [Cursor](https://cursor.com) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Version and changelog-only revert with no code changes; aligns `main` with unpublished release state. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 9311ab8. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## Explanation Release **1380.0.0**. This PR bumps `@metamask/kyc-controller` from `0.13.0` to `0.14.0` (minor). The unreleased changelog adds public API: optional `currentStep` on `KycSessionStatus`, `KycController.ensureLocalUserSecret`, and `getDataShares` on both the service and the controller, plus their exported types. It also maps a session that reports `finalStatus: pending` with `currentStep: kyc` back to `finalStatus: new`, which restores the previous meaning of `pending` (only after SumSub is fully submitted). That behavior change is not marked breaking. The root monorepo version is bumped to `1380.0.0`. No other package in this repo depends on `@metamask/kyc-controller`, so no other packages are included. Dev-only commits since `0.13.0` (the `nock` bump and a test import change) are left out of the changelog. ## References - Ships [MetaMask#11094](MetaMask#11094), [MetaMask#11099](MetaMask#11099), and [MetaMask#11158](MetaMask#11158) - Previous merged release: [MetaMask#11210](MetaMask#11210) ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate (N/A: version bump and changelog only) - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate (N/A) - [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) - [ ] 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 (N/A: no breaking changes) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Version and changelog-only release with no new runtime changes in this PR; consumer impact comes from the already-merged kyc-controller APIs and status mapping described in the changelog. > > **Overview** > This PR cuts **release 1380.0.0** for the core monorepo by bumping the root version from `1379.0.0` to **1380.0.0** > > It publishes **`@metamask/kyc-controller` `0.14.0`**, moving the existing Unreleased changelog into a **`[0.14.0]`** section and updating compare links. There is **no application code in the diff**—only version and changelog housekeeping. > > The **0.14.0** notes document what consumers get from earlier merged work: optional **`currentStep`** on **`KycSessionStatus`**, **`ensureLocalUserSecret`**, **`getDataShares`** on the service and controller, related exports, and a **behavior tweak** that maps API **`pending` + `currentStep: kyc`** back to **`finalStatus: new`** so partially submitted flows are not treated like post–SumSub pending. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 1727a26. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Signed-off-by: Sébastien Van Eyck <sebastien.vaneyck@consensys.net>

Previously
SessionStatus.finalStatus: pendingwas only possible after sumsub was fully submitted. This made it possible for the consumer to know if the user should be shown the sumsub flow again or not. Relay now sends this value aspendingwhen any sumsub data has been submitted, breaking our sumsub resumption logic. This PR patches the old behavior back by also checking theSessionStatus.currentStepvalue. This is meant to be a temporary patch until we are able to discuss a larger refactor to rely oncurrentStepentirely instead offinalStatus.Fixes: https://consensyssoftware.atlassian.net/browse/KYC-67
Screen.Recording.2026-10-29.at.11.58.30.AM.mov
Note
Medium Risk
Changes how
finalStatusis derived from the relay for in-progress KYC sessions, which drives SumSub resumption and related UI; incorrect mapping could show or hide the provider flow at the wrong time.Overview
Adds optional
currentSteponKycSessionStatus(parsed from kyc-api, exported asKYC_CURRENT_STEPS/KycCurrentStep) so clients can see where the applicant is in the flow.patchKycSessionStatusremaps API responses wherefinalStatusispendingandcurrentStepiskyctofinalStatusnew, restoring the old rule thatpendingmeant documents were already fully submitted.KycServiceapplies this patch ongetSessionStatus,getSessionStatusForVendor, andsetAuthorizations.After SumSub completes,
KycControllerstill storespendingbut now setscurrentSteptoprocessing, matching post-submit vendor processing rather than the in-flowkycstep.Reviewed by Cursor Bugbot for commit 97c7f5c. Bugbot is set up for automated code reviews on this repo. Configure here.