-
Notifications
You must be signed in to change notification settings - Fork 392
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
fix: audit log creation failure when a segment override is deleted #4829
fix: audit log creation failure when a segment override is deleted #4829
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
@uinstinct is attempting to deploy a commit to the Flagsmith Team on Vercel. A member of the Team first needs to authorize it. |
Uffizzi Preview |
environment = project = None | ||
if instance.__class__.objects.filter(pk=instance.pk).exists(): | ||
environment, project = instance.get_environment_and_project() |
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.
Thanks for the contribution, @uinstinct.
Two thoughts on the PR:
- Let's add a unit test that reproduces the bug/problem we're trying to fix here.
- An
AuditLog
instance lacking bothproject
andenvironment
relations is not valid. Even for a soft-deleted instance it shouldn't be a problem to retrieve them. I believe the problem is the way the related descriptors are used inFeatureSegment._get_environment
andFeatureSegment._get_project
implementations — they probably should account for soft-deleted instances. This should be clearer when we have a test with the actual reproducing code.
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.
on 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.
@uinstinct , just checking in to see when you think you'll have time to make the suggested changes?
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.
a5e1638
into
Flagsmith:fix/delete-segment-override-audit-log-creation
Thanks for submitting a PR! Please check the boxes below:
docs/
if required so people know about the feature!closes #4828
Changes
instance
is already deleted in the audit tasks while it is processedthis PR introduces a check to see if the instance exists before getting the environment from a non-existent object
How did you test this code?
As described in the issue