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): fix exception getting feature states for edge identity post v2 versioning migration #3916

Merged
merged 3 commits into from
May 10, 2024

Conversation

matthewelwell
Copy link
Contributor

@matthewelwell matthewelwell commented May 10, 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

Fixes an issue where retrieving the flags for an Edge Identity following a v2 versioning migration in an environment which had previously used the change requests functionality caused an exception.

How did you test this code?

Reproduced the issue with a unit test that I was then able to get to pass following the changes. Existing unit tests should cover the refactoring that was included as part of this PR.

Copy link

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

Copy link

sentry-io bot commented May 10, 2024

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: api/edge_api/identities/models.py

Function Unhandled Issue
get_all_feature_states AttributeError: 'NoneType' object has no attribute 'is_live' /api/v1/environments/{environment_api_key}/edge-identities/{edge_identity_identity_uuid}/edge-featur...
Event Count: 1

Did you find this useful? React with a 👍 or 👎

@github-actions github-actions bot added the api Issue related to the REST API label May 10, 2024
@matthewelwell matthewelwell changed the title fix(versioning): Fix get_all_feature_states for edge identities post v2 versioning mig… fix(versioning): fix exception getting feature states for edge identity post v2 versioning migration May 10, 2024
Copy link
Contributor

github-actions bot commented May 10, 2024

Uffizzi Preview deployment-51557 was deleted.

Comment on lines -45 to -50
FeatureStateValue.objects.filter(feature_state=segment_override_p1).update(
string_value="p1"
)
FeatureStateValue.objects.filter(feature_state=segment_override_p2).update(
string_value="p2"
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These seemed superfluous since we're using the feature state's ID for the assertion below.

Copy link

codecov bot commented May 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.98%. Comparing base (da9e051) to head (263ede6).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3916      +/-   ##
==========================================
+ Coverage   95.94%   95.98%   +0.04%     
==========================================
  Files        1135     1135              
  Lines       36087    36182      +95     
==========================================
+ Hits        34624    34731     +107     
+ Misses       1463     1451      -12     

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

Copy link
Contributor

@zachaysan zachaysan left a comment

Choose a reason for hiding this comment

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

The code looks good, but I wonder if existing code has any django_assert_num_queries against it. If not, would be good to get some coverage.

@matthewelwell
Copy link
Contributor Author

The code looks good, but I wonder if existing code has any django_assert_num_queries against it. If not, would be good to get some coverage.

There are certainly some sprinkled throughout the test suite on the important code paths that will use these functions, however, I have added some additional uses of the fixture in on some specific unit tests to also verify things.

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

2 participants