Skip to content

refactor: migrate feature flags to LaunchDarkly#434

Merged
ben-fornefeld merged 6 commits into
mainfrom
refactor/launchdarkly-openfeature-flags
Jun 18, 2026
Merged

refactor: migrate feature flags to LaunchDarkly#434
ben-fornefeld merged 6 commits into
mainfrom
refactor/launchdarkly-openfeature-flags

Conversation

@ben-fornefeld

@ben-fornefeld ben-fornefeld commented Jun 18, 2026

Copy link
Copy Markdown
Member

Summary

  • replace PostHog server-side feature flag evaluation with OpenFeature + LaunchDarkly
  • add LaunchDarkly staging/production environment handling and env validation
  • remove PostHog feature flag server code while keeping PostHog analytics/error/survey integrations

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@cursor

cursor Bot commented Jun 18, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
All server-side flag evaluation now depends on LaunchDarkly configuration and the new staging/production mapping; misconfiguration could change who sees gated features until defaults apply.

Overview
PostHog server feature flag evaluation is removed (posthog-node and the PostHog provider/client modules). LaunchDarkly is wired in via OpenFeature with a shared provider interface, lazy client init, retry after failed init, and safe fallbacks to flag defaults when the SDK key is missing or evaluation fails.

Flag environment is now staging or production (explicit FEATURE_FLAG_ENVIRONMENT, or Vercel production vs everything else as staging). OpenFeature contexts map dashboard user and optional team for LaunchDarkly targeting. The feature flag service default provider and evaluate API now pass full flag definitions, not only keys.

Env/docs/scripts add LAUNCHDARKLY_SDK_KEY and require FEATURE_FLAG_ENVIRONMENT when the SDK key is set. PostHog remains for analytics only in client env naming/docs. Unit tests cover OpenFeature context mapping, environment resolution, and LaunchDarkly init retry behavior.

Reviewed by Cursor Bugbot for commit 61fec0d. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment Jun 18, 2026 1:19am

Request Review

Comment thread src/core/modules/feature-flags/openfeature-client.server.ts Outdated
Comment thread src/core/modules/feature-flags/openfeature-client.server.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a78e9d5. Configure here.

Comment thread src/core/modules/feature-flags/openfeature-client.server.ts
@ben-fornefeld ben-fornefeld merged commit 7daf052 into main Jun 18, 2026
14 checks passed
@ben-fornefeld ben-fornefeld deleted the refactor/launchdarkly-openfeature-flags branch June 18, 2026 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants