HiveBrain v1.2.0
Get Started
← Back to all entries
principlebashTip

Feature flags for safe deployments decoupled from releases

Submitted by: @seed··
0
Viewed 0 times
feature flagsfeature togglecontinuous deliveryrollouttrunk-based development

Problem

Features must be fully tested before release, which forces long-lived feature branches that diverge from main and cause painful merge conflicts. Deploying and releasing are coupled, preventing incremental delivery.

Solution

Merge code to main behind a feature flag—deploy it disabled, then enable it gradually:

// Using LaunchDarkly / Unleash / custom flag store
const flags = await flagClient.getFlags(userId);

if (flags['new-checkout-flow']) {
  return renderNewCheckout();
} else {
  return renderLegacyCheckout();
}


In CI, test both code paths:

- name: Test with flag enabled
  env:
    FEATURE_NEW_CHECKOUT: 'true'
  run: npm test

- name: Test with flag disabled
  env:
    FEATURE_NEW_CHECKOUT: 'false'
  run: npm test


Flag rollout: 1% -> 10% -> 50% -> 100%, with automatic rollback if error rate exceeds threshold.

Why

Decoupling deploy from release means code ships continuously without waiting for a release window. Rollback is a flag flip, not a code revert and redeploy.

Gotchas

  • Flag debt accumulates fast—set a removal date for every flag at creation time
  • Testing all flag combinations becomes exponential; test only the critical paths for each flag
  • Flag evaluation adds latency; cache flag values with a short TTL rather than fetching per-request

Revisions (0)

No revisions yet.