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

feat: async the logic for cloning feature states into a cloned environment #4005

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

matthewelwell
Copy link
Contributor

@matthewelwell matthewelwell commented May 22, 2024

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 utilises the task processor to handle the cloning of feature states when cloning an environment. This stemmed from work I did to handle the cloning of an environment that is using v2 versioning, however, even the cloning of an environment on the old versioning system is pretty intensive.

This PR also adds a new field is_creating to the environment model which can be used by the frontend to determine when an environment has been successfully cloned.

Before merging this, we will need to get the FE to use the is_creating field to show some indication that the environment is not yet ready for use.

Related issue: #4489

How did you test this code?

Since we're enforcing synchronous running of tasks in the test suite, the existing tests on the Environment.clone method cover the behaviour. I added an extra assertion to a couple of existing tests for the new is_creating field that I added to the environment model.

Copy link

vercel bot commented May 22, 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 Aug 13, 2024 1:16pm
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 13, 2024 1:16pm
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 13, 2024 1:16pm

Copy link
Contributor

github-actions bot commented May 22, 2024

Uffizzi Ephemeral Environment deployment-52130

☁️ https://app.uffizzi.com/github.com/Flagsmith/flagsmith/pull/4005

📄 View Application Logs etc.

What is Uffizzi? Learn more!

Copy link

codecov bot commented May 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.28%. Comparing base (59ddfba) to head (2a662af).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4005   +/-   ##
=======================================
  Coverage   96.28%   96.28%           
=======================================
  Files        1143     1144    +1     
  Lines       36992    37010   +18     
=======================================
+ Hits        35618    35636   +18     
  Misses       1374     1374           

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

@matthewelwell
Copy link
Contributor Author

Note that this PR is only marked as draft as we need to discuss with the FE team how to implement the 'pending creation' logic. I don't want to review / merge this PR before then as it includes a migration that might need to change.

# Conflicts:
#	api/environments/models.py
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.

1 participant