-
-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove SQLUserData when removing domain membership #36000
base: master
Are you sure you want to change the base?
Conversation
2c4975c
to
45dfe2c
Compare
Realized I need to soft delete user data first as there is a workflow to restore a domain membership just after removing a user from a domain. So that blocks this PR from being merged for now. Created #36045 and once merged, can update this PR to soft delete instead. |
I don't love the direction this is going. I initially thought this would be a quick fix, but am realizing it is hard to make this change without impacting a lot of code. There is a unique constraint on user + domain on SQLUserData, hence needing to delete any soft deleted user data when adding a new domain membership. I would say my confidence is in this change is low at the moment, and I would need to spend more time digging into this and probably run the change through QA to feel better about it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me but can resonate your lack of confidence 😂 Recommend to do QA~~~ Though I don't know how can QA check the correct state of SQLUserData
Product Description
Technical Summary
https://dimagi.atlassian.net/browse/SAAS-16810
Stumbled upon this issue when testing the dump and restore. We currently leave SQLUserData in an "orphaned" state when removing domain memberships, where a user still has SQLUserData associated with a domain they are no longer a part of.
This could lead to confusion if the user is re-added to this domain in the future as this SQLUserData will still be referenced/used. I think the more appropriate behavior is to cleanup any SQLUserData associated with a user and domain when removing that user from that domain.
Feature Flag
Safety Assurance
Safety story
This user data isn't useful once a user is no longer part of a domain.
Automated test coverage
Added tests to ensure deleting a domain membership cleans up SQLUserData as expected.
QA Plan
No
Rollback instructions
Labels & Review