Mark Seemann starts with a reader’s design: fetch permissions, choose a command in a pure function, then execute it. The middle step is easy to test because it works entirely from its inputs. But when a feature flag is off, the default command doesn’t need the permissions at all.
- A cheap lookup can be worth keeping if most requests need it anyway. If the flag is temporary, the redundant call may disappear when the rollout ends.
- If the extra call causes measurable delays, check the flag before fetching. Keep the branch next to the network call so the command selection stays easy to test.
- A cache can make the lookup cheaper, but it also sets a window in which a revoked permission may still be used.
Measure what the lookup adds to a real request, then ask what happens when the permissions service is down. A fast redundant call can still be a poor trade if it breaks a default path that could have worked on its own.