Skip to content

fix(multivariate): persist variant key in DynamoDB environment document#7915

Merged
gagantrivedi merged 2 commits into
mainfrom
fix/multivariate-option-key-in-environment-document
Jun 30, 2026
Merged

fix(multivariate): persist variant key in DynamoDB environment document#7915
gagantrivedi merged 2 commits into
mainfrom
fix/multivariate-option-key-in-environment-document

Conversation

@gagantrivedi

Copy link
Copy Markdown
Member

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

  • I have read the Contributing Guide.
  • 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.

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 no key.

The cause was in flagsmith-common: the environment document is validated against EnvironmentCompressed during compression, and the MultivariateFeatureOption schema there only declared id and value, so Pydantic silently dropped key.

This PR:

How did you test this code?

  • test_map_environment_to_compressed_environment_document__mv_option_with_key__key_preserved fails on flagsmith-common 3.9.1 (KeyError: 'key') and passes on 3.10.1.
  • Full tests/unit/util/mappers/test_unit_mappers_dynamodb.py suite passes (8 passed).

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.
@gagantrivedi gagantrivedi requested a review from a team as a code owner June 30, 2026 10:10
@gagantrivedi gagantrivedi requested review from khvn26 and removed request for a team June 30, 2026 10:10
@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Jun 30, 2026 10:11am
flagsmith-frontend-preview Ignored Ignored Preview Jun 30, 2026 10:11am
flagsmith-frontend-staging Ignored Ignored Preview Jun 30, 2026 10:11am

Request Review

@github-actions github-actions Bot added api Issue related to the REST API fix labels Jun 30, 2026
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-7915 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-7915 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api-test:pr-7915 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-7915 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-7915 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7915 Finished ✅ Results

@gagantrivedi gagantrivedi merged commit fe840c5 into main Jun 30, 2026
23 of 26 checks passed
@gagantrivedi gagantrivedi deleted the fix/multivariate-option-key-in-environment-document branch June 30, 2026 10:12
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  5 passed

Details

stats  5 tests across 3 suites
duration  11.2 seconds
commit  a904d4e
info  🔄 Run: #17958 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  5 passed

Details

stats  5 tests across 3 suites
duration  34.9 seconds
commit  b095083
info  🔄 Run: #17959 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  39 seconds
commit  b095083
info  🔄 Run: #17959 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  5 passed

Details

stats  5 tests across 4 suites
duration  45 seconds
commit  a904d4e
info  🔄 Run: #17958 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  6 passed

Details

stats  6 tests across 5 suites
duration  47.4 seconds
commit  a904d4e
info  🔄 Run: #17958 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  5 passed

Details

stats  5 tests across 4 suites
duration  40.2 seconds
commit  a904d4e
info  🔄 Run: #17958 (attempt 1)

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.56%. Comparing base (772b9cb) to head (b095083).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7915      +/-   ##
==========================================
- Coverage   98.62%   98.56%   -0.07%     
==========================================
  Files        1488     1488              
  Lines       58578    58561      -17     
==========================================
- Hits        57772    57720      -52     
- Misses        806      841      +35     

☔ View full report in Codecov by Harness.
📢 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.

@github-actions

Copy link
Copy Markdown
Contributor

Visual Regression

17 screenshots compared. See report for details.
View full report

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 fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants