Skip to content

feat(flags): add cohort-aware gradual rollout evaluation (#1354) - #1598

Merged
github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
JohnMabas:issue-1354-flag-cohorts
Nov 23, 2026
Merged

github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
JohnMabas:issue-1354-flag-cohorts

Conversation

@JohnMabas

Copy link
Copy Markdown
Contributor

What this PR does

  • Adds deterministic cohort A/B targeting to the feature flag service and exposes it through the SDK.
  • No breaking SDK changes: existing /flags/* endpoints and payloads are unchanged.

Changes

  • backend/src/services/featureFlags.ts: cohort registration, explicit/percentage membership, variant overrides, force-enabled cohorts and combined evaluation.
  • backend/src/routes/flags.ts: opt-in includeCohort=true metadata on GET /api/v1/flags/evaluate.
  • packages/sdk/: FeatureFlagsApi.evaluateWithCohort(), typed responses and SDK export.
  • Unit tests plus backend/docs/FEATURE_FLAGS_COHORTS.md.

Why

  • Supports gradual rollout schedules and reproducible A/B cohort assignment without changing existing clients.

How to test

  • npx vitest run backend/src/services/__tests__/featureFlags-cohort.test.ts packages/sdk/src/__tests__/featureFlags.test.ts (8 tests pass locally).
  • Call GET /api/v1/flags/evaluate?flag=X&identifier=Y&includeCohort=true for a registered flag.

Notes

@vercel

vercel Bot commented Nov 23, 2026

Copy link
Copy Markdown

@JohnMabas is attempting to deploy a commit to the smartdevs17's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Nov 23, 2026

Copy link
Copy Markdown

@JohnMabas Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@github-actions
github-actions Bot merged commit 0acfbad into Smartdevs17:main Nov 23, 2026
13 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build feature flag system with gradual rollout and cohort A/B testing

1 participant