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 deleted segment overrides returning #3850

Merged
merged 7 commits into from
May 1, 2024

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

This PR sets out to resolve a bug in the v2 versioning which meant that deleted segment overrides from older versions were being returned alongside other feature states in more recent versions.

This is achieved by grabbing the latest version for each feature in a given environment upfront and using this to filter the feature states.

Some notes on the specifics of this PR:

  1. Overall, I'm not particularly happy with the branching logic we now have in the versioning_service module and this is something that I'd like to work on refactoring, but if possible I'd like to do that after merging this PR so we can continue with testing.
  2. I resorted to using a raw SQL query to retrieve the latest versions from the database. I am sure it is possible using annotate in the Django ORM but I couldn't get it to work, if the reviewer has any suggestions, I'm all ears!

How did you test this code?

Added tests.

@matthewelwell matthewelwell requested review from a team and khvn26 and removed request for a team April 26, 2024 11:43
Copy link

vercel bot commented Apr 26, 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 May 1, 2024 9:56am
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 1, 2024 9:56am
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 1, 2024 9:56am

@github-actions github-actions bot added the api Issue related to the REST API label Apr 26, 2024
Copy link
Contributor

github-actions bot commented Apr 26, 2024

Uffizzi Preview deployment-50891 was deleted.

@codecov-commenter
Copy link

codecov-commenter commented Apr 26, 2024

Codecov Report

Attention: Patch coverage is 98.11321% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 95.86%. Comparing base (54c2603) to head (a714e0a).

Files Patch % Lines
api/features/versioning/managers.py 90.90% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3850   +/-   ##
=======================================
  Coverage   95.86%   95.86%           
=======================================
  Files        1130     1131    +1     
  Lines       35795    35834   +39     
=======================================
+ Hits        34315    34354   +39     
  Misses       1480     1480           

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

…sioning

# Conflicts:
#	api/tests/unit/features/test_unit_features_views.py
@matthewelwell matthewelwell added this pull request to the merge queue May 1, 2024
Merged via the queue into main with commit 41981d4 May 1, 2024
22 checks passed
@matthewelwell matthewelwell deleted the fix/deleted-segment-overrides-versioning branch May 1, 2024 10:12
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.

3 participants