Skip to content

Feature toggles live in config.yaml, off by default

  • Deciders: Julian Bäume
  • Date: 2026-09-18

Status

Accepted

Context

Booking page appearance (issue #8) is the first feature large enough that we want it on a deployment before we want it on every deployment: a coloured, branded public page changes what every booker sees, and the shape of the editor is worth feedback before it becomes the product's default look. The service has no way to express that. A feature is either merged and live everywhere or not merged, so the branch outlives the work.

Two mechanisms are already in the codebase, neither of them general:

  • mcp.enabled (ADR-0012) is a per-feature config key that the route checks per request. It does exactly the right thing, for exactly one feature, under a name that says nothing about being a toggle.
  • conflictCheckAvailable in GET /booking/v1/config is a capability boolean the frontends branch on. It reports what the deployment can do (is a free/busy source configured), not what it has chosen to switch on.

App Suite also has a per-user mechanism, the middleware capability that hasCapability() already reads for booking itself. Capabilities are granted per user and can be upsold, which is the right tool for a feature that distinguishes between users of one deployment. They are the wrong tool for trying a feature out: every deployment and every MR preview would need middleware configuration before the branch could be looked at, and middleware configuration is not ours to change.

The AI Service already keeps its toggles in a features block in its own configuration, on the same SDK config registry. No project records that as a decision, so there is no house rule here, but it is the closest thing to a precedent and we reached the same shape independently.

Decision

Add a features block to config.yaml, hot-reloaded with everything else (ADR-0007), named and shaped after the AI Service's, where each key is one toggle and every toggle defaults to false:

features:
  aFeature: true

src/services/features.ts is the only reader of that block. Call sites ask isFeatureEnabled(name), or requireFeature(name) for a route that should not exist while its feature is off. A toggle is read per request, never at route registration, so flipping one in the ConfigMap takes effect on the running process. GET /booking/v1/config reports the whole block as features, and the frontends treat an unknown toggle as off, so an older frontend against a newer service hides what it does not know about rather than calling routes that are not there.

The mechanism lands on its own, with no toggle declared. A feature adds its name to FeatureName and to the Joi schema in the same change as the code that reads it, so the toggles the service has and the ones it enforces stay one set. A name the service does not know is a config error rather than a silently ignored line, so a typo in a ConfigMap is loud.

A toggle is a rule about the whole feature, not about one call site. While one is off:

  • routes that exist only for the feature answer 404, the same answer an unknown path gets;
  • input the feature owns is ignored rather than refused, so a client that still sends it saves the rest of the request;
  • payloads present what they presented before the feature existed;
  • configuration that only shapes the feature is withheld, so a deployment default cannot reach users through the back door.

Data the feature already wrote is left alone. Columns and tables stay, rows keep their values, and turning the toggle back on brings them back. A toggle changes what the service serves, never what it holds.

Toggles are deployment-wide. A per-user grant stays available as a later refinement: because services/features.ts is the single reader, a middleware capability can be folded into isFeatureEnabled without touching a call site.

A toggle is temporary. Once a feature is the way the product works, its key goes and the branches go with it.

Consequences

Positive

  • A feature can be merged before it is switched on, so the branch stops being long-lived and the work lands in main in reviewable pieces.
  • Operators get an off switch for a feature that misbehaves, without a rollback and without a restart.
  • The mechanism reuses the config system whole: ConfigMap, Joi validation, hot reload, and the existing GitOps path for changing it.
  • A toggle costs one call in each layer, as long as the feature already funnels its behaviour through few enough places.

Negative

  • Both states have to work, which doubles what the tests have to cover for as long as the toggle exists. Left in place indefinitely, toggles accumulate into exactly the conditional sprawl they were meant to avoid, so removing one is part of finishing a feature.
  • Autoloaded routes read their own instance of the config module, so a suite that exercises a toggle has to register its routes directly rather than go through the SDK test app.
  • Deployment-wide granularity means a deployment cannot try a feature with a subset of its users. That is what a middleware capability is for, and it is deliberately not built yet.
  • Until a feature declares one, the block takes no keys at all, so a ConfigMap that sets a toggle ahead of the image that has it is refused.

References