fix(multivariate): persist variant key in DynamoDB environment document#7915
Conversation
Bump flagsmith-common to 3.10.1, which adds the key field to the MultivariateFeatureOption schema. Without it, the EnvironmentCompressed validation dropped the variant key during DynamoDB compression, so it never reached the environment document. Add a regression test covering the compressed serialisation path.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
for more information, see https://pre-commit.ci
Docker builds report
|
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Visual Regression17 screenshots compared. See report for details. |
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
When a multivariate option is created with a
key, the key is correctly threaded into the engine model (MultivariateFeatureOptionModel.key), but it never reached the DynamoDB environment document — documents looked like{"id": 29176, "value": "variant_1"}with nokey.The cause was in
flagsmith-common: the environment document is validated againstEnvironmentCompressedduring compression, and theMultivariateFeatureOptionschema there only declaredidandvalue, so Pydantic silently droppedkey.This PR:
flagsmith-commonto3.10.1, which addskeyto theMultivariateFeatureOptionschema (fix(schemas): preserve multivariate option key in DynamoDB document flagsmith-common#242).map_environment_to_compressed_environment_document), which is the one that writes to DynamoDB and was previously untested forkey.How did you test this code?
test_map_environment_to_compressed_environment_document__mv_option_with_key__key_preservedfails onflagsmith-common3.9.1 (KeyError: 'key') and passes on 3.10.1.tests/unit/util/mappers/test_unit_mappers_dynamodb.pysuite passes (8 passed).