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: Fine tune feature import export #3163

Merged
merged 7 commits into from
Dec 14, 2023

Conversation

zachaysan
Copy link
Contributor

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

  • I have run pre-commit to check linting
  • 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

As @kyle-ssg and I were going through the frontend integration a number of quality of life improvements came up:

  1. Rather than listing feature exports by environment, it would be more useful to list them by created_at descending, since the newest created feature export should be at the top of the list.
  2. Rather than following the feature export permissions where an environment admin is the most logical choice for an export, the feature import permission must be more expansive, since it can destructively overwrite all environments for the right permission, so this has been changed to organisation admin for import only.
  3. To show features that are going to be import @kyle-ssg relied on the existing tagging system of the project feature list endpoint. The drawback with this approach is that it's an intersection approach, i.e., every feature must have every tag supplied, whereas the feature export uses an union approach, i.e., any one tag supplied is enough to warrant the inclusion of the feature. In order to support the proper function I added a tag_strategy serializer field which defaults to the old behavior and I added the new feature to the test suite plus an additional one since the old behaviour had no test coverage.

How did you test this code?

New tests and verified an existing one.

Copy link

vercel bot commented Dec 13, 2023

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 Dec 14, 2023 6:57pm
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 14, 2023 6:57pm
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 14, 2023 6:57pm

@github-actions github-actions bot added the api Issue related to the REST API label Dec 13, 2023
Copy link
Contributor

github-actions bot commented Dec 13, 2023

Uffizzi Preview deployment-42788 was deleted.

@codecov-commenter
Copy link

codecov-commenter commented Dec 13, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9c475e4) 96.11% compared to head (b9a6b07) 96.11%.

❗ Current head b9a6b07 differs from pull request most recent head e5c46e0. Consider uploading reports for the commit e5c46e0 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3163   +/-   ##
=======================================
  Coverage   96.11%   96.11%           
=======================================
  Files        1058     1058           
  Lines       31918    31959   +41     
=======================================
+ Hits        30677    30718   +41     
  Misses       1241     1241           

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

Copy link
Contributor

@matthewelwell matthewelwell left a comment

Choose a reason for hiding this comment

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

Added a couple of minor comments but looks good on the whole.

api/features/import_export/permissions.py Outdated Show resolved Hide resolved
api/features/views.py Outdated Show resolved Hide resolved
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.

None yet

3 participants