Repository navigation
fix: make retired customer email unique per LMS user - #575
Merged
Merged
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
bseverino
approved these changes
Nov 16, 2026
naincy128
force-pushed
the
naincy/fix-retired-email-duplicate
branch
from
December 4, 2026 10:05
38a14df to
2556d7f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Retiring a Commercetools customer fails with
DuplicateFieldwhen another customer already holds the same retired email:Root cause:
AnonymizeRetiredUserbuilds the retired email asretired_user_<sha256(email.lower() + salt)>. That depends only on the email. Commercetools requires customer emails to be unique, so the second customer with a given email can never be retired. This happens when someone re-registers in LMS with the email of an account that was already retired.Impact: the customer update is atomic, so none of that customer's PII fields (first name, last name, email, LMS username) are anonymized.
/lms/user_retirement/returns 400, and retries fail the same way.Changes
AnonymizeRetiredUsernow hashesemail + lms_user_idfor the retired email, so each customer gets a distinct value. It's still a salted hash with no PII.