Skip to main content

Feature Flag Dependencies

Feature flag dependencies allow you to create targeting rules based on the evaluation results of other feature flags. This enables you to build complex flag relationships and control feature rollouts based on other features.

How Feature Flag Rules Work

The Feature flag option is similar to Prerequisites, as both are based on other feature flags' evaluations. The difference is in when they're evaluated:

  • Prerequisites are checked at the beginning of the evaluation order (step 2)
  • Feature flag rules are checked within Custom Rules (step 4)

The rule's condition is satisfied if the user is evaluated with the expected variation on the specified feature flag.

Example: Flag Dependency

Consider you created a custom rule within the Feature flag context. If the referenced flag returns the True variation, the user will receive the value-4 variation for the current flag.

The image below shows this configuration:

Custom rule based on feature flag
Performance impact

When defining targeting rules based on other feature flags, consider the impact on performance. If a flag has many dependencies, evaluating one flag may also evaluate many other flags, potentially affecting the evaluation duration and the client's network load.

Common Use Cases

  • Progressive feature rollout - Enable advanced features only when basic features are enabled
    • Example: analytics_enabled = True → Enable advanced_analytics
  • Feature bundling - Group related features together
    • Example: premium_ui = Enabled → Enable dark_mode
  • Gradual migration - Control multiple flags based on a master flag
    • Example: new_architecture = True → Enable new_api, new_cache, etc.
  • A/B test variations - Different flag behavior based on experiment assignment
    • Example: experiment_group = VariantA → Show feature_v2
  • Safety controls - Disable dependent features when parent feature is off
    • Example: payment_processing = Disabled → Disable subscriptions, checkout

Prerequisites vs Feature Flag Rules

Understanding when to use each:

FeaturePrerequisitesFeature Flag Rules
Evaluation OrderStep 2 (early)Step 4 (with custom rules)
Failure BehaviorReturns OFF variationContinues to next rule
Use CaseHard dependenciesConditional targeting
Multiple ConditionsMust ALL pass (AND)Can combine with other conditions

When to Use Prerequisites

Use prerequisites when a flag must not be evaluated unless other flags return specific values. If any prerequisite fails, the flag immediately returns the OFF variation.

When to Use Feature Flag Rules

Use feature flag rules when you want to conditionally target based on other flags, but still allow evaluation to continue if the condition isn't met (e.g., fall through to other rules or the default rule).

Combining with Other Conditions

Combine conditions

You can combine feature flag conditions with user attributes, user segments, and date conditions to create sophisticated targeting strategies.

Example: Show advanced_dashboard only if:

  • premium_subscription = Active (Feature flag rule)
  • AND app_version >= 2.0.0 (User attribute)
  • AND user is in Beta Testers segment (User segment)

Best Practices

  1. Avoid circular dependencies - Don't create loops where Flag A depends on Flag B, and Flag B depends on Flag A
  2. Limit dependency depth - Keep dependency chains short (2-3 levels max) for better performance
  3. Document relationships - Use flag descriptions to note dependencies
  4. Monitor performance - Track evaluation times for flags with many dependencies
  5. Consider prerequisites first - Use prerequisites for true hard dependencies, feature flag rules for conditional logic