← Todas las plantillas

Despliegue gradual por porcentaje y segmento, interruptor de emergencia, limpieza de flags.

Spec — Feature flags

Status: draft · Created: 2026-11-10

1. Context and goal

Teams ship code switched off, turn features on for growing groups of users, and can turn a feature off in seconds without a deploy.

2. Functional requirements (EARS)

  • FR-1: THE SYSTEM SHALL evaluate each flag for a user from its rules in order: allow list of users, segments by attribute (for example plan or country), percentage, then the default value.
  • FR-2: WHEN a percentage rule applies, THE SYSTEM SHALL bucket users by a stable hash of the flag key and user id, so a user keeps the same value as the percentage grows.
  • FR-3: WHEN a flag changes, THE SYSTEM SHALL apply the change on every server within 30 seconds without a deploy.
  • FR-4: WHEN someone turns on the kill switch of a flag, THE SYSTEM SHALL serve its off value to everyone within 10 seconds, overriding every rule.
  • FR-5: IF the flag service is unreachable, THEN THE SYSTEM SHALL evaluate flags locally from the last known rules, or the defaults in code, in under 1 ms per evaluation.
  • FR-6: WHEN a flag is created or changed, THE SYSTEM SHALL record who changed it, the rules before and after, and the time.
  • FR-7: WHEN a flag has served one value to 100% of users for 30 days or passed its expiry date, THE SYSTEM SHALL mark it stale and ask its owner to remove it from the code.

3. Out of scope

  • Statistics for A/B experiments.
  • Flags evaluated in mobile apps while offline.