-
Notifications
You must be signed in to change notification settings - Fork 449
refactor: only clone latest feature states #5743
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
refactor: only clone latest feature states #5743
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5743 +/- ##
=======================================
Coverage 97.77% 97.77%
=======================================
Files 1255 1255
Lines 44357 44359 +2
=======================================
+ Hits 43371 43373 +2
Misses 986 986 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ment / feature combination
Docker builds report
|
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.
Two minor suggestions. The logic looks fine to me.
Changes
This PR changes the behaviour when cloning an environment. Previously, the logic would create a clone of all feature states, including old versions, feature states associated with uncommitted change requests, etc. This PR updates the logic to only clone the latest feature states, and mark them as live from the moment the environment is created.
This does change the user experience, but only really for those using v2 versioning (which is currently very few customers), in that they will no longer see a history of changes in the new environment. In my opinion, it was odd behaviour to show the history from another environment in the new environment anyway, so I think this is an improvement.
Refactor environment clone functionality to only clone the latest feature states. This will optimise the logic to speed it up reduce the impact of cloning environments on the database. I've also included some additional DB optimisations using select and prefetch related where necessary.
Note that this also fixes a bug in the logic for enabling versioning on new environments which existed because we were previously using the
enable_v2_versioning
task to create the versions, but this expected the input environment to not have versioning enabled.How did you test this code?
Existing tests should cover the refactor. Updated an existing test with better assertions to verify the bug fix, and new logic.