fix: ensure PII is cleared from historical certificate records during retirement#38671
Merged
Conversation
vgulati-apphelix
approved these changes
Jun 1, 2026
robrap
reviewed
Jun 4, 2026
…o include logging
…t for waffle flag handling
robrap
reviewed
Jun 10, 2026
robrap
left a comment
Contributor
There was a problem hiding this comment.
Lots of simple changes. I gave it a bit more attention. Not everything would be blocking, but simple enough in most cases.
robrap
reviewed
Jun 11, 2026
robrap
reviewed
Jun 11, 2026
robrap
approved these changes
Jun 11, 2026
robrap
left a comment
Contributor
There was a problem hiding this comment.
Nice job. I made two minor updates before merging.
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
GeneratedCertificateusesdjango-simple-history, which mirrors every row change intocertificates_historicalgeneratedcertificate. This table stores the learner's full name in every snapshot. The existing retirement pipeline only blankednamein the live table — all prior audit snapshots retained the real name indefinitely.This PR closes that gap:
clear_pii_from_certificate_records_for_user()now also blanksnamein the history table viaGeneratedCertificate.history.filter(...).update(name="")purge_pii_from_generatedcertificatesmanagement command extended to also backfill the history table for all previously retired users(flag-gated)pii_retirementannotation onGeneratedCertificatecorrected fromretainedtolocal_apiTesting:
pytest lms/djangoapps/certificates/tests/test_api.py::CertificatesLearnerRetirementFunctionality
pytest lms/djangoapps/certificates/management/commands/tests/test_purge_pii_from_generatedcertificates.py
Jira ticket:
https://2u-internal.atlassian.net/browse/BOMS-590