Skip to content

fix: add UUIDNaturalKeyManagerMixin to EnvironmentFeatureVersionManager#7066

Open
MartinLam12 wants to merge 1 commit intoFlagsmith:mainfrom
MartinLam12:fix-environment-feature-version-loaddata
Open

fix: add UUIDNaturalKeyManagerMixin to EnvironmentFeatureVersionManager#7066
MartinLam12 wants to merge 1 commit intoFlagsmith:mainfrom
MartinLam12:fix-environment-feature-version-loaddata

Conversation

@MartinLam12
Copy link
Copy Markdown

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

  • [ x] I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • [ x] I have filled in the "Changes" section below.
  • [ x] I have filled in the "How did you test this code" section below.

Changes

Closes #6768

EnvironmentFeatureVersionManager was missing UUIDNaturalKeyManagerMixin, causing loaddata to raise DeserializationError for organisations with v2 feature versioning enabled. FKs to EnvironmentFeatureVersion were serialised as natural-key lists but could not be resolved without get_by_natural_key on the manager.

Fix: added UUIDNaturalKeyManagerMixin to EnvironmentFeatureVersionManager in features/versioning/managers.py, following the same pattern used by every other exportable manager in the codebase.

How did you test this code?

Added 7 unit tests in tests/unit/import_export/test_unit_import_export_loaddata.py (based on tests from #6765). The key test test_full_export_loaddata__v2_versioning_enabled__roundtrips_correctly exercises the exact scenario: exporting an organisation with v2 feature versioning and loading it back via loaddata. All tests pass.

EnvironmentFeatureVersionManager was missing UUIDNaturalKeyManagerMixin,
causing loaddata to raise DeserializationError for organisations with
v2 feature versioning enabled. FKs to EnvironmentFeatureVersion were
serialised as natural-key lists but could not be resolved without
get_by_natural_key on the manager.

Closes Flagsmith#6768
@MartinLam12 MartinLam12 requested a review from a team as a code owner March 30, 2026 08:23
@MartinLam12 MartinLam12 requested review from emyller and removed request for a team March 30, 2026 08:23
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@cursor
Copy link
Copy Markdown

cursor bot commented Mar 30, 2026

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

@MartinLam12 is attempting to deploy a commit to the Flagsmith Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added the api Issue related to the REST API label Mar 30, 2026
@Zaimwa9 Zaimwa9 requested review from khvn26 and removed request for emyller March 30, 2026 09:02
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.26%. Comparing base (9c09ac1) to head (6d6072e).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7066      +/-   ##
==========================================
- Coverage   98.33%   98.26%   -0.07%     
==========================================
  Files        1337     1338       +1     
  Lines       50010    50013       +3     
==========================================
- Hits        49178    49146      -32     
- Misses        832      867      +35     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Environment feature versions are not importable via loaddata

1 participant