feat: upgrade flagsmith-flag-engine to v10#6653
Conversation
Temporary vendoring of Pydantic models to maintain compatibility during migration to flag-engine v10. These models will be removed once the codebase is fully migrated to use the TypedDict-based evaluation API. Includes: - Identity, Trait, and Feature state models - Segment models with rule evaluation - Environment and Project models - Context mappers bridging Pydantic models to v10 TypedDicts
…dels - Bump flagsmith-flag-engine from fix/missing-export branch to ^10.0.3 - Bump flagsmith SDK from ^3.10.0 to ^5.1.1 - Add pydantic-collections dependency Update all imports to use vendored Pydantic models from util/engine_models instead of flag_engine (which removed Pydantic models in v7+). Clean up unused code from vendored models: - Remove EnvironmentAPIKeyModel.is_valid property - Remove FeatureModel.__eq__ and __hash__ methods - Remove OrganisationModel.unique_slug property - Remove SegmentRuleModel.none() and matching_function Add pragma: no cover for unreachable edge cases: - FeatureStateModel._get_multivariate_value fallback return - get_hashed_percentage_for_object_ids hash collision case Add tests for full coverage: - test_get_segment_ids_with_segment_feature_overrides - test_map_any_value_to_trait_value
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Docker builds report
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6653 +/- ##
==========================================
+ Coverage 98.20% 98.21% +0.01%
==========================================
Files 1298 1313 +15
Lines 47108 47417 +309
==========================================
+ Hits 46262 46572 +310
+ Misses 846 845 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Update trait_value type ordering and remove maxLength constraint to match the ContextValue type definition in flag-engine v10.
| - type: integer | ||
| - maxLength: 2000 | ||
| type: string | ||
| - type: number |
There was a problem hiding this comment.
ContextValue type changed in flag-engine v10:
Before (fix/missing-export branch):
ContextValue = Annotated[
Union[None, StrictBool, float, int, Annotated[str, StringConstraints(max_length=2000)]],
BeforeValidator(map_any_value_to_trait_value),
]
After (v10.0.3):
ContextValue = Union[None, int, float, bool, str]
```
This changes the OpenAPI schema for trait_value - different type ordering and the maxLength: 2000 constraint on strings is gone.
---
|
There are still indirect changes to coverage, which is interesting to me: https://app.codecov.io/gh/Flagsmith/flagsmith/pull/6653/indirect-changes |
Testing hypothesis that merged coverage from private packages workflow is affecting the codecov/project check.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
07739da to
246aaf8
Compare
246aaf8 to
07739da
Compare
…s workflow" This reverts commit 07739da.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Contributes to #5991
Upgrade
flagsmith-flag-enginefromfix/missing-exportbranch to^10.0.3and migrate to vendored Pydantic models.Background: Flag-engine v7+ removed all Pydantic models in favour of TypedDicts. Since the Flagsmith API relies on these Pydantic models for DynamoDB document handling and identity management, we vendor the models temporarily until the codebase can be fully migrated to the TypedDict-based API.
Key changes:
flagsmith-flag-engineto^10.0.3flagsmithSDK to^5.1.1pydantic-collectionsdependencyutil/engine_models/from thefix/missing-exportbranchutil/engine_models/context/mappers.pyto bridge Pydantic models to v10 TypedDictsHow did you test this code?