Skip to content

fix(LaunchDarkly): resolve served variation for boolean flag import - #8135

Open
bardock-2393 wants to merge 1 commit into
Flagsmith:mainfrom
bardock-2393:fix/launch-darkly-boolean-import-inverted-value
Open

fix(LaunchDarkly): resolve served variation for boolean flag import#8135
bardock-2393 wants to merge 1 commit into
Flagsmith:mainfrom
bardock-2393:fix/launch-darkly-boolean-import-inverted-value

Conversation

@bardock-2393

Copy link
Copy Markdown

Boolean flags imported from LaunchDarkly can evaluate to the opposite of what they do in LD. LD separates "is the flag on" from "what does it serve" (the fallthrough variation when on, or the off variation when off), but the importer mapped the raw on toggle straight to Flagsmith's enabled state. Any project using the common "flag on, default off, enable via targeting/segments" pattern imports with an inverted default, silently, since nothing is written to error_messages and the import still reports success.

Changes

  • Boolean flag import now resolves the actual served variation (fallthrough when on, off variation when off) from LD's per-flag _summary, matching how the existing string/multivariate import paths already resolve their served value, instead of taking the on toggle at face value.
  • Added a regression test reproducing both directions of the bug (on-but-serving-false, and off-but-serving-true).

Contributes to #8047

How did you test this code?

  • Added test_process_import_request__success__expected_status coverage: the flag1 fixture now has a boolean flag that is on in one environment but resolves to the false variation, and off in another environment but resolves to true. Confirmed the test fails on the old code and passes with the fix.
  • Ran the full tests/unit/integrations/launch_darkly suite (47 passed).
  • make lint (pre-commit) and mypy pass on the changed files.

Review effort: 2/5

… of served variation

LD separates "is the flag on" from "what does it serve" (fallthrough/offVariation),
but the importer mapped `on` directly to Flagsmith's `enabled`, which silently
inverted any boolean flag using the "on, defaulting to false, enable via
targeting" pattern.
@bardock-2393
bardock-2393 requested a review from a team as a code owner July 28, 2026 13:36
@bardock-2393
bardock-2393 requested review from khvn26 and removed request for a team July 28, 2026 13:36
@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

@bardock-2393 is attempting to deploy a commit to the Flagsmith Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7ce7a9ce-3520-4e04-8951-8bef8589b017

📥 Commits

Reviewing files that changed from the base of the PR and between 1201efd and 0b95189.

📒 Files selected for processing (3)
  • api/integrations/launch_darkly/services.py
  • api/tests/unit/integrations/launch_darkly/client_responses/get_flags.json
  • api/tests/unit/integrations/launch_darkly/test_services.py

📝 Walkthrough

Walkthrough

The LaunchDarkly boolean feature import now resolves FeatureState.enabled from the served fallthrough or off variation in _summary, using the variation’s underlying value and retaining the raw on value as a default. Production and test fixture metadata now identify different off and fallthrough variations, with success-path expectations updated accordingly.

Estimated code review effort: 2 (Simple) | ~10 minutes


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the api Issue related to the REST API label Jul 28, 2026
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.

1 participant