Skip to content

fix(LaunchDarkly importer): Update API version to 20240415 - #6603

Merged
emyller merged 12 commits into
mainfrom
feat/migrate-to-launch-darkly-20240415-api-version
Jan 30, 2026
Merged

emyller merged 12 commits into
mainfrom
feat/migrate-to-launch-darkly-20240415-api-version

Conversation

@Zaimwa9

@Zaimwa9 Zaimwa9 commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

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.

Closes #6476

We migrate from LD API versions from 20220603 to 20240415
Main differences:

  • GET /api/v2/flags/{projectKey} max limit reduced from 1000 to 100
  • environments are only returned when explicitly filtering by env query param (returned by default before)
  • Related to the above, we have max 3 envs in query per request

Changes

  • Updated LAUNCH_DARKLY_API_VERSION to 20240415
  • Added constant for flags limit LAUNCH_DARKLY_API_FLAGS_LIMIT_PER_PAGE = 100
  • Added environment_keys parameter to get_flags() to pass required env filter
  • Request flags by batch of 3 environments if > to 3
  • Fixed parsing for LD JSON values

How did you test this code?

  • Curl requests
  curl -X POST "http://localhost:8000/api/v1/projects/{PROJECT_ID}/imports/launch-darkly/" \
    -H "Authorization: Token {user_token_from_frontend}" \
    -H "Content-Type: application/json" \
    -d '{"token": "{LD_TOKEN}", "project_key": "default"}'
  • Import from frontend

@Zaimwa9
Zaimwa9 requested a review from a team as a code owner January 27, 2026 18:27
@Zaimwa9
Zaimwa9 requested review from emyller and removed request for a team January 27, 2026 18:27
@vercel

vercel Bot commented Jan 27, 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 Jan 30, 2026 7:49pm
flagsmith-frontend-preview Ignored Ignored Preview Jan 30, 2026 7:49pm
flagsmith-frontend-staging Ignored Ignored Preview Jan 30, 2026 7:49pm

Request Review

@Zaimwa9
Zaimwa9 marked this pull request as draft January 27, 2026 18:27
@github-actions github-actions Bot added api Issue related to the REST API feature New feature or request labels Jan 27, 2026
@github-actions

github-actions Bot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

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

@codecov

codecov Bot commented Jan 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.18%. Comparing base (a0d5aa9) to head (27c3ef6).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6603   +/-   ##
=======================================
  Coverage   98.18%   98.18%           
=======================================
  Files        1295     1295           
  Lines       46920    46968   +48     
=======================================
+ Hits        46067    46115   +48     
  Misses        853      853           

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

@Zaimwa9
Zaimwa9 marked this pull request as ready for review January 28, 2026 14:52
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jan 28, 2026
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jan 28, 2026
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jan 28, 2026
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jan 29, 2026
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jan 29, 2026

@emyller emyller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rationale looks solid, but the implementation needs attention in its design.

Comment thread api/integrations/launch_darkly/client.py Outdated
Comment thread api/integrations/launch_darkly/client.py Outdated
Comment thread api/integrations/launch_darkly/constants.py Outdated
Comment thread api/tests/unit/integrations/launch_darkly/test_client.py Outdated
Comment thread api/tests/unit/integrations/launch_darkly/test_client.py Outdated
@emyller

emyller commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

Additionally, I think it is important that the PR title represents what this is, rather than how it was accomplished. Suggestion as follows:

fix(LaunchDarkly importer): Update API version to 20240415

This is how it displays in the CHANGELOG, and I believe it looks clearer and more accurate than current:

feat: added-limits-and-envs-in-ld-import-query-params

Co-authored-by: Evandro Myller <22429+emyller@users.noreply.github.com>
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jan 30, 2026
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jan 30, 2026
@Zaimwa9
Zaimwa9 requested a review from emyller January 30, 2026 11:00
@Zaimwa9 Zaimwa9 changed the title feat: added-limits-and-envs-in-ld-import-query-params fix(LaunchDarkly importer): Update API version to 20240415 Jan 30, 2026

@emyller emyller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks much better, thank you!

I've observed a couple improvements we can make to performance and memory, which leads me to think all the import process could be improved too. Absolutely not a blocker, though I'm curious to how big a LD import can be — we'll wait and see I think.

Comment thread api/integrations/launch_darkly/client.py Outdated
Comment thread api/integrations/launch_darkly/client.py Outdated
…github.com:Flagsmith/flagsmith into feat/migrate-to-launch-darkly-20240415-api-version
@Zaimwa9
Zaimwa9 requested a review from emyller January 30, 2026 19:49
@github-actions github-actions Bot added fix and removed feature New feature or request labels Jan 30, 2026

@emyller emyller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@emyller
emyller merged commit 2d31fb4 into main Jan 30, 2026
31 checks passed
@emyller
emyller deleted the feat/migrate-to-launch-darkly-20240415-api-version branch January 30, 2026 20:45
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.

LaunchDarkly import crashes due to API errors

2 participants