JSON schema validation error when trying to update profile

Summary

A GitLab Free customer is reporting this behaviour on gitlab.com via a support ticket

Whenever this user tries to update their profile on GitLab.com (commit email specifically), they are returned a User detail onboarding status must be a valid json schema error message. They were later added to a paid namespace, which had 2FA enforced, which led to the user being constantly redirected to /profile/two_factor_auth with a 422 response The change you requested was rejected.

Steps to reproduce

I was unable to reproduce this bug.

Example Project

N/A

What is the current bug behavior?

User tries to update their profile on GitLab.com but is returned with a User detail onboarding status must be a valid json schema error message instead. They are also unable to set up 2FA for their account, instead they receive a 422 status response.

What is the expected correct behavior?

User should be able to update their profile and enable 2FA for their account.

Relevant logs and/or screenshots

User in question's user_detail.onboarding_status

[ gprd ] production> user.user_detail.onboarding_status
=> {"role"=>99}

Schema: https://gitlab.com/gitlab-org/gitlab/blob/590bae012b0a9b6a8d70642e9ca899e71ff4f99b/app/validators/json_schemas/user_detail_onboarding_status.json#L55-55

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes