Skip to main content

Core Concepts

This page defines the minimum vocabulary you need to read and write Konditional features.

Terms

  • Namespace: A registry that owns a set of features.
  • Feature: A typed configuration value with rules and a default.
  • Context: Runtime inputs used for evaluation (locale, platform, appVersion, stableId).
  • Rule: Criteria -> value mapping. All criteria must match for the rule to apply.
  • Specificity: A numeric measure of how constrained a rule is. Higher specificity wins.
  • Bucketing: Deterministic assignment of a stableId to a ramp-up bucket.

Compile-time vs runtime

AspectGuarantee LevelMechanism
Property accessCompile-timeProperty delegation on Namespace
Return typesCompile-timeGeneric type propagation (Feature<T, C, M>)
Rule valuesCompile-timeTyped DSL builders (boolean, string, enum, custom)
Non-null returnsCompile-timeRequired defaults
Rule matchingRuntimeDeterministic evaluation over Context
Business logic correctnessNot guaranteedHuman responsibility

Typed values in practice

enum class Theme { LIGHT, DARK }

object AppFeatures : Namespace("app") {
val darkMode by boolean<Context>(default = false)
val theme by enum<Theme, Context>(default = Theme.LIGHT)
val retries by integer<Context>(default = 3)
}

val theme: Theme = AppFeatures.theme.evaluate(ctx)

Type-safety guarantee

  • Guarantee: Feature access and return types are compile-time safe for statically-defined features.

  • Mechanism: Feature properties are declared with explicit type parameters and enforced by the Kotlin type system.

  • Boundary: Dynamically-generated features are outside this guarantee.