Skip to content

Environment feature versions are not importable via loaddata #6768

@khvn26

Description

@khvn26

Symptom: loaddata raises DeserializationError for any organisation that has an environment with use_v2_feature_versioning = True.

Root cause: EnvironmentFeatureVersionManager (features/versioning/managers.py:16) inherits from SoftDeleteManager but is missing UUIDNaturalKeyManagerMixin. Every other exportable manager in the codebase includes this mixin. Without it, Django serialises FK references to EnvironmentFeatureVersion (on FeatureState.environment_feature_version and FeatureSegment.environment_feature_version) as a natural-key list ["<uuid>"], but the deserialiser cannot resolve the list back to an object because get_by_natural_key does not exist on the manager.

Fix: One-line change — add the mixin:

class EnvironmentFeatureVersionManager(UUIDNaturalKeyManagerMixin, SoftDeleteManager):

This follows the exact pattern of FeatureManager, FeatureStateManager, FeatureSegmentManager, and SoftDeleteExportableManager.

Test: Use tests from #6765 to verify the correctness of the solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiIssue related to the REST API

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions