Skip to content
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(versioning): prevent FeatureSegment from writing audit log on delete when v2 versioning enabled #4088

Merged

Conversation

matthewelwell
Copy link
Contributor

Thanks for submitting a PR! Please check the boxes below:

  • I have run pre-commit to check linting
  • I have added information to docs/ if required so people know about the feature!
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

Prevents the application from writing an AuditLog record when a feature segment is deleted if v2 versioning is enabled.

How did you test this code?

Added a new unit test.

@matthewelwell matthewelwell requested review from a team and khvn26 and removed request for a team June 3, 2024 17:15
Copy link

vercel bot commented Jun 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 3, 2024 5:19pm
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 3, 2024 5:19pm
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 3, 2024 5:19pm

Copy link
Contributor

github-actions bot commented Jun 3, 2024

Uffizzi Preview deployment-52578 was deleted.

Copy link

codecov bot commented Jun 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.44%. Comparing base (22d371b) to head (b1c50ed).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4088   +/-   ##
=======================================
  Coverage   96.44%   96.44%           
=======================================
  Files        1149     1149           
  Lines       37575    37589   +14     
=======================================
+ Hits        36238    36252   +14     
  Misses       1337     1337           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@zachaysan zachaysan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with one minor quality of life improvement suggestion

Comment on lines +392 to +395
def get_skip_create_audit_log(self) -> bool:
# Don't create audit logs when deleting feature segments using versioning
# v2 as we rely on the version history instead.
return self.environment_feature_version_id is not None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I would do the following

Suggested change
def get_skip_create_audit_log(self) -> bool:
# Don't create audit logs when deleting feature segments using versioning
# v2 as we rely on the version history instead.
return self.environment_feature_version_id is not None
@property
def is_skip_create_audit_log(self) -> bool:
# Don't create audit logs when deleting feature segments using versioning
# v2 as we rely on the version history instead.
return self.environment_feature_version_id is not None

@matthewelwell matthewelwell added this pull request to the merge queue Jun 3, 2024
Merged via the queue into main with commit 60c0748 Jun 3, 2024
24 checks passed
@matthewelwell matthewelwell deleted the fix(versioning)/prevent-feature-segment-delete-audit-log branch June 3, 2024 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants