Feature Flags — Guidelines
Rules for every ION service using the platform feature-flag substrate.
Substrate
MUST
- Store flags in Azure App Configuration — one instance per environment.
- Read flags via the Feature Management SDK with UAMI auth (App Config data reader role).
- Cache with the SDK’s default refresh window; do not roll a custom cache.
MUST NOT
- Read flags from a service-local config file in Beta / Prod.
- Store secrets in App Configuration.
- Use static connection strings to App Configuration.
Flag definition
MUST
- Define every flag in IaC (name, default, targeting rules, owner, target removal date).
- Give the flag a clear owner (team + individual reviewer).
- Set a target removal date at creation (typical 90 days post full rollout).
SHOULD
- Name flags for behaviour they enable, not implementation
details (
enable-cursor-pagination-v2, notuse-new-code).
MUST NOT
- Reuse a retired flag name for a new purpose.
- Ship a flag without an owner or removal target.
Targeting
MUST
- Use deterministic targeting — a given (flag, user) pair evaluates the same on repeat requests.
- Include tenant / region / user attributes in the request context passed to the SDK.
MUST NOT
- Randomise flag evaluation per request (breaks user experience continuity).
- Target on PII fields (emails, phone numbers) — use stable IDs.
Change control
MUST
- Change flag definitions through IaC + Runway.
- Change flag runtime values through the approved automation (App Config write scoped to the CI/CD SP and on-call role).
- Log emergency toggles with elevated audit severity; post-hoc review the next business day.
MUST NOT
- Toggle flags from the Azure portal above Alpha under normal operations.
- Bypass the audit trail for a toggle.
Code discipline
MUST
- Wrap flag reads at the outermost decision point — do not
scatter
if (flag)throughout deep code. - Keep both on and off paths tested — CI runs both where feasible.
- Tolerate SDK cache staleness (short window) in flag evaluations.
MUST NOT
- Depend on tight synchrony of flag changes — flags are eventually consistent.
- Introduce flag-controlled branches that can never be cleaned up.
Lifecycle
MUST
- Track flags with target removal dates and remove them on time.
- Retire a flag by: setting the value permanently, then removing the code branch, then removing the flag from IaC.
SHOULD
- Retire stale flags aggressively — flags left in code are technical debt.
MUST NOT
- Leave a flag in code past its removal target without an updated target date.
Degraded mode
MUST
- Expose a sheddable-mode branch for every sheddable
service surface, gated on the platform
degraded-modeflag (see DR — Architecture). - Return 503 + banner when sheddable-mode is active.
MUST NOT
- Fail critical-path operations when
degraded-modeis on.
Audit
MUST
- Rely on the platform audit event for flag value changes — do not roll your own.
- For security-critical toggles (auth, authorisation logic), emit an additional service-side audit event when the flag path is taken.
Anti-patterns
- Flags without owners — orphans that never retire.
- Secrets in App Config — belongs in Key Vault.
- Flag-controlled architecture — long-term flags that keep two behaviours alive forever.
- Portal-toggled flags on Prod — untracked, unreviewed.
- Random per-request evaluation — breaks UX and tests.
- Flag on a critical-path failure mode — critical must not degrade.
Related
- Architecture, Implementation
- ADRs: 0012, 0024
- Principles: § 17, § 21, § 25
- Capabilities: DR, Audit Logs, Observability