Spec the flag SDK every service calls per request
Your task
Your company built its own feature-flag service: a TypeScript admin API over a Postgres store, with percentage rollouts and targeting rules. The evaluator, evaluate(flag, context), is written and tested. Now about 40 services need an SDK to read flags, some on every request at 5,000 requests a second. A coding agent will build the TypeScript SDK first.
Write the spec you would hand the agent.
What you know:
- the flag service returns the full config as JSON from
GET /v1/config, with anETag, and streams changes as server-sent events fromGET /v1/stream - in an incident, turning a flag off must reach every running service within 30 seconds
- the flag service has been down twice this year, for about 10 minutes each time
- SDKs in Go and Python come later, and they must put each user in the same rollout bucket
Then, in a few sentences: what does "write an SDK for our flag service" get subtly wrong?