Logo
Logo
Home
Archive
AI Agent Notes
Advertise
YouTube
Login
Sign Up
Logo
  • Home
  • Posts
  • 🦥 Feature Flags

🦥 Feature Flags

Jul 1, 2025

Hello friends!

Welcome to this week’s Sloth Bytes. I hope you had a fun week 😄

Build Real Apps in Minutes

I'll be honest. I used to think no-code was for people who "couldn't really code."

But I realized I was missing the entire point.

While I was stuck planning, others were already launching with Bubble — no code, no team, just their idea and a browser.

How many ideas stall at the blank page? Bubble AI turns plain English into real apps — so you can skip the overwhelm and start building.

All that work that has nothing to do with solving real problems

Bubble AI handles the boring stuff so you can:

  • Launch real apps in hours, not months.

  • Start making money with built-in payments and login flows.

  • Focus on your idea — Bubble AI handles the rest.

  • Apps built on Bubble scale — just ask companies like HubSpot and Amazon.

You don’t need to be technical to build. With Bubble AI, your idea is the blueprint.

Stop waiting for the perfect moment or the perfect dev team. Start building with Bubble AI today.

Feature Flags

I’ve been curious about feature flags for a while and wanted to share what I learned 😄

Next week I’ll do a more beginner/fundamental topic! Let me know if you have a topic in mind.

Imagine you have a job (already unrealistic.)

The non-technical CEO wants to launch their brand new “one of a kind never been done before” feature on Friday.

The problem?

This feature has a chance of breaking everything and they want to deploy on a Friday…

That's a dumpster fire waiting to happen.

But there is a way to reduce the potential damage and embarrassment.

Feature flags.

What Are Feature Flags?

Feature flags are basically runtime configuration controlling which code path executes. They often look like an if statement with superpowers:

if feature_flag("new_checkout"):
    return new_checkout_experience()
else:
    return old_checkout_experience()

That separation lets you:

  • deploy code before releasing the feature to users

  • enable a feature for specific environments, accounts, cohorts, or percentages of traffic

  • turn certain behavior off quickly without shipping another code change

The Real Power: Gradual Rollouts

Feature flags aren’t ONLY switches (on/off), you can also “roll out” features intelligently.

Slowly increase the amount of users that have access to these features:

import hashlib

def feature_enabled(flag, user_id, rollout_percent):
    # Stable across processes, machines, and restarts.
    value = f"{flag}:{user_id}".encode()
    digest = hashlib.sha256(value).digest()
    bucket = int.from_bytes(digest[:8], "big") % 100

    return bucket < rollout_percent

# 1% -> buckets 0 only
# 50% -> buckets 0..49
# 100% -> everyone
  • The same user stays in the same bucket as the rollout changes.

  • You can gradually increase exposure without maintaining a giant allow-list.

  • If something breaks, the initial blast radius can be much smaller.

  • Use a stable hash; language-level hashes such as Python’s built-in hash() are not guaranteed to stay stable across processes or restarts.

Common Feature Flag Patterns/Use Cases

Kill Switches:

If a feature, integration, or optional behavior has a critical bug, you can design a flag as a kill switch and disable that path quickly. This only works if the system can safely operate with that path disabled—feature flags are not magic rollback buttons for every change.

Good kill switches are planned in advance for behavior that actually has a safe fallback.

A/B Testing:

Flags can also assign users to experiment variants, but A/B testing needs more than “show this to 10%.” You need stable assignment, clean exposure tracking, a defined metric, enough sample size, and care around users switching variants mid-experiment.

if feature_variant("button_color") == "green":
    color = "#00ff00"
else:
    color = "#ff0000"

track_conversion(variant=feature_variant("button_color"))

User Targeting:

def should_enable(flag, user):
    # Explicit beta cohort
    if user.id in BETA_USER_IDS:
        return True

    # Example regional rollout
    if flag == "new_payment" and user.country == "CA":
        return True

    return percentage_rollout(flag, user.id)

Targeting rules should use the minimum user data necessary. Avoid sending sensitive attributes into client-side flag payloads, and never use a client-visible feature flag as an authorization check. “Button hidden” is not security. Enforce permissions on the server.

Feature flags create debt too

Flags are supposed to be temporary surprisingly often. Once a rollout is complete, stale branches leave two versions of reality in your codebase.

  • Name an owner: someone should know why the flag exists.

  • Give temporary flags an expiration/removal date: launch flags should not become archaeological artifacts.

  • Test both paths while both paths matter: the “off” branch can rot just as easily as the new branch.

  • Decide your failure behavior: if your flag service is unavailable, should this particular flag fail open, fail closed, or use a cached/default value?

  • Be consistent during one request/workflow: evaluating the same flag differently halfway through checkout is a fun way to invent ghosts.

Wait this sounds complicated?

Yep. The if statement is easy; consistent evaluation, targeting, experiments, auditing, cleanup, and safe defaults are where flag systems become real infrastructure.

Some Popular Services

  • PostHog

  • LaunchDarkly

  • Unleash

  • GrowthBook

You’re a nerd and wanna learn more?

Check this article out:

Feature Flags 101: Use Cases, Benefits, and Best Practices

Feature flags are a software development concept that allow you to enable or disable a feature without modifying the source code or requiring a redeploy.

If you want to keep learning

  • CI/CD explained — feature flags separate deploying code from actually releasing a feature to users.

  • Environment variables and secrets — another important part of managing application configuration safely across environments.

  • 5 system design resources — go deeper on reliability, scalability, rollouts, and production architecture.

Vercel Ship 2025 recap - Vercel

Vercel Ship 2025 added new building blocks for an AI era: Fast, flexible, and secure by default.

Gemini CLI: your open-source AI agent

Free and open source, Gemini CLI brings Gemini directly into developers’ terminals — with unmatched access for individuals.

Introducing 11.ai - Personal AI Voice Assistants | ElevenLabs

Build and customise your own AI voice assistant with unique names and voices. Connect to hundreds of tools and integrations, powered by MCP.

Project Vend: Can Claude run a small shop? (And why does that matter?)

We let Claude run a small shop in the Anthropic office. Here's what happened.

7 People Now Have Elon Musk's Neuralink Brain Implant

The brain-computer interface lets those with cervical spinal cord injuries or ALS control a computer with their thoughts. This year, Neuralink has more than doubled the number of patients.

Thanks to everyone how submitted!

AspenTheRoyal, BraedenAlonge, dganesh05, emil-case, plantaeart, mau-estradiote, cre-w, spenpal, Fireboy086.

Special shout out to SabhyaAggarwal. I forgot to include his submission last week and it was also his birthday (I felt really bad.)

Feel free to comment Happy late birthday to Sabhya!

How Many Digits between 1 and N

Imagine you took all the numbers between 0 and n and concatenated them together into a long string.

How many digits are there between 0 and n? Write a function that can calculate this.

There are 0 digits between 0 and 1, there are 9 digits between 0 and 10 and there are 189 digits between 0 and 100.

Examples

digits(1)
output = 0

digits(10)
output = 9

digits(100)
output = 189

digits(2020)
output = 6969

How To Submit Answers

Reply with

  • A link to your solution (github, twitter, personal blog, portfolio, replit, etc)

  • or if you’re on the web version leave a comment!

  • If you want to be mentioned here, I’d prefer if you sent a GitHub link or Replit!

That’s all from me!

Have a great week, be safe, make good choices, and have fun coding.

If I made a mistake or you have any questions, feel free to comment below or reply to the email!

See you all next week.

What'd you think of today's email?

  • 🦥 Amazing! Keep it up
  • 🦥 Good, not great
  • 🦥 It sucked

Login or Subscribe to participate

Want to advertise in Sloth Bytes?

If your company is interested in reaching an audience of developers and programming enthusiasts, you may want to advertise with us here.

Keep Reading

Read all
arrow-right
envelope-simple

Join 50k+ developers and become a better programmer and stay up to date in just 5 minutes.

© 2026 Sloth Bytes.
beehiivPowered by beehiiv