-
Notifications
You must be signed in to change notification settings - Fork 429
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): fix cloning environments using v2 versioning #3999
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🔍 Existing Issues For ReviewYour pull request is modifying functions with the following pre-existing issues: 📄 File: api/features/versioning/models.py
Did you find this useful? React with a 👍 or 👎 |
Uffizzi Preview |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3999 +/- ##
=======================================
Coverage 96.21% 96.22%
=======================================
Files 1142 1142
Lines 36724 36760 +36
=======================================
+ Hits 35335 35371 +36
Misses 1389 1389 ☔ View full report in Codecov by Sentry. |
api/features/versioning/managers.py
Outdated
return self.filter( | ||
uuid__in=[ | ||
efv.uuid | ||
for efv in EnvironmentFeatureVersion.objects.get_latest_versions(self) | ||
] | ||
) |
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.
I'm not particularly happy with this, but the alternative was to update the sql to return all the fields and then (in the Environment.clone
method) manually create the EnvironmentFeatureVersion, rather than using a clone method on the model class. To keep things consistent with other models, this seemed like the lesser of 2 evils.
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.
Why not write a second sql with all the fields?
manually create the EnvironmentFeatureVersion, rather than using a clone method on the model class
I don't think so as long as the model instances were correctly mapped?
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.
I think that "Cloning environments" is not used frequently enough to make this a real issue.
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.
Fair point Novak
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.
I think that "Cloning environments" is not used frequently enough to make this a real issue.
Well, I wish this were true. But the FE made the decision to remove the functionality to 'create' an environment, and now all environments are cloned from another.
Why not write a second sql with all the fields?
I'd still rather avoid this to avoid code duplication or hacky ways of concatenating SQL strings.
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.
LGTM
ba65782
to
655a9cf
Compare
Thanks for submitting a PR! Please check the boxes below:
pre-commit
to check lintingdocs/
if required so people know about the feature!Changes
This fixes an issue found in testing when cloning an environment that has enabled v2 versioning.
How did you test this code?
Added a unit test for cloning an environment using v2 versioning.