This video uses as a motivating example a bug this person (fasterthanlime) once ran into when the feature flag management software they were using (LaunchDarkly) read the staging-environment feature flag values in production. That caused all experimental code to be turned on in production, which led to many customers being affected by bugs in the experimental code.
After talking about the difficulty of debugging this, fasterthanlime talks about how it’s important to prevent errors automatically and not rely on humans to configure things correctly. They say this particular issue is unusually hard to prevent automatically. They note that the error could have been avoided if the LaunchDarkly API didn’t conflate the API key and the environment, but that LaunchDarkly would probably not be willing to change the API now. They eventually conclude that the easiest way to prevent that bug is to create a new feature flag called “environment” that just duplicates the name of the environment these feature flag values are for, then assert on application startup that the application environment matches the feature flag environment.