3 ms·
While very powerful, I think it's worth calling out some pitfuls. A few things we've ran into - long lived feature flags that are never cleaned up (which usuall
by nijave 8mo ago
While very powerful, I think it's worth calling out some pitfuls. A few things we've ran into
- long lived feature flags that are never cleaned up (which usually cause zombie or partially dead code)
- rollout drift where different environments or customers have different flags set and it's difficult to know who actually has the feature
- not flagging all connected functionality (i.e. one API is missing the flag that should have had it)
A good decom/cleanup strategy definitely helps
- enlyth 8mo agoYep, archiving feature flags and deleting the dead code is usually thing number 9001 on the list of priorities, so in practice most projects end up with a graveyard of them. Another issue that I've ran into a few times, is if a feature flag starts as a simple thing, but as new features get added, it evolves into a complex bifurcation of logic and many code paths become dependent on it, which can add crippling complexity to what you're developing
- nijave 8mo agoI also notice these cases tend to be missing good test coverage (at least in my experience) I think part of the assumption is "hey there's a flag I can control if something goes wrong so manual validation is ok here" but that doesn't help when the thing is left for a period of time and everyone loses context.
- Groxx 8mo agoHave them emit metrics when it's triggered. You can do a bulk "names X, Y, Z haven't used branch B in >30 days, delete?" task generator pretty easily. Un-triggered ones are also easy to catch if you force all calls to be grep-friendly (or similar), which is also an easy lint to write: unclear result? Block it, force `flag("inline constant", ...)`. Personally I've also had a lot of success requiring "expiration" dates for all flags, and when passed they emit a highly visible warning metric. You can always just bump it another month to defer it, but people eventually get sick of doing that and clean it up so it'll go away for good. Make it mildly annoying, so the cleanup is an improvement, and it happens pretty automatically.
- nijave 8mo agoSomeone at work wrote a Claude skill to clean them up which seems to work fairly well but a date check would also be helpful
- s-zeng 8mo agoIt's worth noting that a feature flag mishap is what brought down Knight Capital: https://en.wikipedia.org/wiki/Knight_Capital_Group#2012_stock_trading_disruption https://en.wikipedia.org/wiki/Knight_Capital_Group#2012_stoc...