Feature Lab
Feature flags and controlled experiments enforcing pre-registered hypotheses, control variants, guardrail metrics, and minimum sample sizes before conclusion.
- Resources (8)
- project, flag, metric, experiment, variant, guardrail, readout, decision
- Roles (4)
- analyst, engineer, product, admin
- Features (9)
- suitepermissionsstate_machinevalidationrules_engineviewsaudithistory_eventsindexes
feature-lab.infinity-sdg.com — feature flags and controlled experiments with the discipline built in.
project → flag → experiment (pre-registered hypothesis, goal metric, minimum sample)
├─ variants (exactly one control)
├─ guardrails (metrics that must not get worse)
├─ readouts (lift + confidence interval per variant)
└─ decision (ship variant / keep control / iterate) → approved
What it enforces
| Rule | Why |
|---|---|
| Hypothesis, goal metric and minimum sample are frozen once an experiment starts | No moving the goalposts |
| Start needs ≥ 2 variants, exactly one control, ≥ 1 guardrail | No experiment without a baseline and a safety metric |
| Conclude only at the pre-registered minimum sample | Peeking and stopping early inflates false positives |
| Conclude only with a passing sample-ratio check (p ≥ 0.001) | A sample-ratio mismatch means assignment is broken |
| A breached guardrail blocks concluding — halt instead, with a reason | Wins that hurt latency or errors don’t ship |
Readout interval must contain the estimate; significant must equal “interval excludes zero” | Results can’t be mislabeled |
| Shipping names a winning variant; decisions are approved only for finished experiments | Every rollout traces to a decision |
Resources, views, roles
- Resources: project, flag, metric, experiment, variant, guardrail, readout, decision. All are audited.
- Views:
runningExperiments, with a ready-to-call columnbreachedGuardrailsdecisionLog
- Roles:
adminengineer: flags, starting and halting experimentsanalyst: metrics, guardrails, readouts, concluding experimentsproduct: experiments, approving decisions
Demo data
The demo has 10 product areas: checkout, onboarding, search, scheduling, messaging, pricing, mobile, notifications, billing and help center. It runs 12 experiments:
- 8 concluded: 5 ship, 2 keep control, 1 iterate
- 2 halted by a guardrail breach (unsubscribe rate; p95 latency)
- 1 running, below its minimum sample
- 1 in draft
There are also 2 release/ops flags that aren’t tied to an experiment.
To regenerate the data, run python3 seeds/gen_seed.py.
Run it
scripts/kalos.sh validate # static checks
scripts/kalos.sh start # kalosd on :9211
scripts/kalos.sh verify # live checks
By default, KALOS_REPO is ../kalos.
Sign in with admin / Admin123!. The other users are engineer1, analyst1 and product1, all with password Demo123!.
Domain Resource Summary
| Resource | Purpose & Lifecycle |
|---|---|
project | A product area or application that owns flags and experiments. |
flag | A feature flag. Experiment flags are driven by an experiment; release flags roll out by percentage. (States: active, archived) |
metric | A measurable outcome, and which direction is good. |
experiment | A controlled experiment. The hypothesis, primary metric and minimum sample are pre-registered and frozen once it starts. (States: draft, running, concluded, halted) |
variant | One arm of an experiment. Exactly one is the control. |
guardrail | A metric that must not get worse. A breach halts the experiment. |
readout | The measured effect of one variant on one metric versus control, with its confidence interval. |
decision | What was decided and why: ship a variant, keep control, or iterate. (States: draft, approved) |
Domain definition
Download rawdomain.yaml (379 lines)
Inspect domain.yaml (379 lines)
# feature-lab/backend/domain.yaml
#
# Feature Lab — feature flags and controlled experiments.
#
# project → flag → experiment (pre-registered hypothesis, primary metric,
# minimum sample) → variants (one control) → guardrails → readouts → decision
#
# The rules encode experimentation discipline: nothing starts without two
# variants, exactly one control and at least one guardrail; an experiment
# concludes only after reaching its minimum sample, with a passing
# sample-ratio check and no breached guardrail (breaches HALT instead); and
# a decision is approved only for a finished experiment. Hypotheses and
# primary metrics are frozen once an experiment starts — no moving the
# goalposts.
#
# An ISDG product for any software team that ships behind flags.
# query() filter keys are single lowercase words.
domain:
name: featurelab
version: "1.0.0"
description: >
Feature flags and A/B experiments with pre-registered hypotheses,
guardrail metrics, sample-ratio checks, readouts and decision records.
resources:
project:
description: "A product area or application that owns flags and experiments."
object:
id: { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
key: { type: string, required: true, unique: true, maxLength: 40, pattern: "^[a-z][a-z0-9-]*$" }
name: { type: string, required: true, maxLength: 120 }
team: { type: string, required: true, maxLength: 80 }
permissions:
list: [engineer, analyst, product, admin]
get: [engineer, analyst, product, admin]
create: [admin]
update: [admin]
delete: [admin]
features: { audit: true }
flag:
description: "A feature flag. Experiment flags are driven by an experiment; release flags roll out by percentage."
object:
id: { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
project:
type: reference
references: "adl.featurelab.featurelab.project"
required: true
key: { type: string, required: true, unique: true, maxLength: 60, pattern: "^[a-z][a-z0-9_.-]*$" }
description: { type: text, required: true }
kind: { type: string, required: true, enum: [release, experiment, ops, permission] }
rolloutPercent: { type: percentage, required: true, default: 0 }
owner: { type: string, required: true, maxLength: 100 }
status: { type: string, required: true, default: active }
stateMachine:
field: status
initial: active
states:
active:
transitions:
archive: { to: archived, guards: [engineer, admin] }
archived: {}
permissions:
list: [engineer, analyst, product, admin]
get: [engineer, analyst, product, admin]
create: [engineer, admin]
update: [engineer, admin]
delete: [admin]
features: { audit: true }
history:
events:
rolloutChanged: { trigger: fieldChange, field: rolloutPercent, label: "Rollout set to {rolloutPercent}%", severity: info }
indexes:
- { fields: [project] }
metric:
description: "A measurable outcome, and which direction is good."
object:
id: { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
key: { type: string, required: true, unique: true, maxLength: 60 }
name: { type: string, required: true, maxLength: 120 }
kind: { type: string, required: true, enum: [conversion, revenue, latency, error_rate, retention, count] }
direction: { type: string, required: true, enum: [increase, decrease] }
unit: { type: string, required: true, maxLength: 20 }
permissions:
list: [engineer, analyst, product, admin]
get: [engineer, analyst, product, admin]
create: [analyst, admin]
update: [analyst, admin]
delete: [admin]
features: { audit: true }
experiment:
description: >
A controlled experiment. The hypothesis, primary metric and minimum
sample are pre-registered and frozen once it starts.
object:
id: { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
project:
type: reference
references: "adl.featurelab.featurelab.project"
required: true
flag:
type: reference
references: "adl.featurelab.featurelab.flag"
required: true
goalMetric:
type: reference
references: "adl.featurelab.featurelab.metric"
required: true
key: { type: string, required: true, unique: true, maxLength: 60 }
hypothesis: { type: text, required: true }
minSampleSize: { type: integer, required: true, min: 100 }
trafficPercent: { type: percentage, required: true }
exposures: { type: integer, min: 0, default: 0 }
srmPValue: { type: decimal, precision: 8, scale: 6, min: 0, max: 1 }
startedAt: { type: datetime }
endedAt: { type: datetime }
haltReason: { type: text }
owner: { type: string, required: true, maxLength: 100 }
status: { type: string, required: true, default: draft }
validation:
noMovingGoalposts:
rule: "isCreate() || status == 'draft'
|| (!fieldChanged('hypothesis') && !fieldChanged('goalMetric') && !fieldChanged('minSampleSize'))"
message: "The hypothesis, primary metric and minimum sample are frozen once the experiment starts."
stateMachine:
field: status
initial: draft
states:
draft:
transitions:
start: { to: running, guards: [engineer, product, admin], sets: { startedAt: now() } }
running:
transitions:
conclude: { to: concluded, guards: [analyst, admin], sets: { endedAt: now() } }
halt: { to: halted, guards: [engineer, analyst, admin], requiredFields: [haltReason], sets: { endedAt: now() } }
concluded: {}
halted: {}
permissions:
list: [engineer, analyst, product, admin]
get: [engineer, analyst, product, admin]
create: [product, engineer, admin]
update: [product, engineer, analyst, admin]
delete: [admin]
features: { audit: true }
history:
events:
experimentStarted: { trigger: transition, transition: start, severity: info }
experimentConcluded: { trigger: transition, transition: conclude, severity: success }
experimentHalted: { trigger: transition, transition: halt, capture: [haltReason], label: "Halted: {haltReason}", severity: error }
indexes:
- { fields: [project] }
- { fields: [status] }
variant:
description: "One arm of an experiment. Exactly one is the control."
object:
id: { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
experiment:
type: reference
references: "adl.featurelab.featurelab.experiment"
required: true
key: { type: string, required: true, maxLength: 40 }
description: { type: text, required: true }
weight: { type: integer, required: true, min: 1, max: 100 }
control: { type: boolean, required: true, default: false }
permissions:
list: [engineer, analyst, product, admin]
get: [engineer, analyst, product, admin]
create: [product, engineer, admin]
update: [product, engineer, admin]
delete: [admin]
features: { audit: true }
indexes:
- { fields: [experiment] }
- { fields: [experiment, key], unique: true }
guardrail:
description: "A metric that must not get worse. A breach halts the experiment."
object:
id: { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
experiment:
type: reference
references: "adl.featurelab.featurelab.experiment"
required: true
metric:
type: reference
references: "adl.featurelab.featurelab.metric"
required: true
maxDegradePercent: { type: decimal, required: true, precision: 6, scale: 2, min: 0 }
observedPercent: { type: decimal, precision: 6, scale: 2 }
breached: { type: boolean, required: true, default: false }
validation:
breachMatchesObservation:
rule: "observedPercent == null || breached == (observedPercent > maxDegradePercent)"
message: "breached must equal observed degradation > allowed degradation."
permissions:
list: [engineer, analyst, product, admin]
get: [engineer, analyst, product, admin]
create: [analyst, engineer, admin]
update: [analyst, admin]
delete: [admin]
features: { audit: true }
indexes:
- { fields: [experiment] }
readout:
description: "The measured effect of one variant on one metric versus control, with its confidence interval."
object:
id: { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
experiment:
type: reference
references: "adl.featurelab.featurelab.experiment"
required: true
variant:
type: reference
references: "adl.featurelab.featurelab.variant"
required: true
metric:
type: reference
references: "adl.featurelab.featurelab.metric"
required: true
liftPercent: { type: decimal, required: true, precision: 8, scale: 3 }
ciLow: { type: decimal, required: true, precision: 8, scale: 3 }
ciHigh: { type: decimal, required: true, precision: 8, scale: 3 }
significant: { type: boolean, required: true }
computedAt: { type: datetime, required: true }
validation:
intervalContainsEstimate:
rule: "ciLow <= liftPercent && liftPercent <= ciHigh"
message: "The confidence interval must contain the estimate."
significanceMatchesInterval:
rule: "significant == (ciLow > 0 || ciHigh < 0)"
message: "significant must equal 'the interval excludes zero'."
permissions:
list: [engineer, analyst, product, admin]
get: [engineer, analyst, product, admin]
create: [analyst, admin]
update: [admin]
delete: [admin]
features: { audit: true }
indexes:
- { fields: [experiment] }
decision:
description: "What was decided and why: ship a variant, keep control, or iterate."
object:
id: { type: uuid, primaryKey: true, protected: true, allowUserProvided: true }
experiment:
type: reference
references: "adl.featurelab.featurelab.experiment"
required: true
outcome: { type: string, required: true, enum: [ship_variant, keep_control, iterate] }
winner:
type: reference
references: "adl.featurelab.featurelab.variant"
rationale: { type: text, required: true }
approvedBy: { type: string, maxLength: 100 }
status: { type: string, required: true, default: draft }
validation:
shippingNamesAWinner:
rule: "outcome != 'ship_variant' || winner != null"
message: "Name the winning variant to ship."
stateMachine:
field: status
initial: draft
states:
draft:
transitions:
approve: { to: approved, guards: [product, admin], sets: { approvedBy: $user.id } }
approved: {}
permissions:
list: [engineer, analyst, product, admin]
get: [engineer, analyst, product, admin]
create: [analyst, product, admin]
update: [analyst, product, admin]
delete: [admin]
features: { audit: true }
indexes:
- { fields: [experiment] }
rules:
twoVariantsToStart:
description: "An experiment needs at least two variants."
trigger: { resource: experiment, events: [transition], transition: start }
condition: "len(query('variant', { experiment: $record.id })) < 2"
action: reject
severity: error
message: "Add at least two variants before starting."
exactlyOneControl:
description: "Exactly one variant is the control."
trigger: { resource: experiment, events: [transition], transition: start }
condition: "len(query('variant', { experiment: $record.id, control: true })) != 1"
action: reject
severity: error
message: "Mark exactly one variant as the control."
guardrailBeforeStart:
description: "No experiment runs without at least one guardrail metric."
trigger: { resource: experiment, events: [transition], transition: start }
condition: "len(query('guardrail', { experiment: $record.id })) == 0"
action: reject
severity: error
message: "Add a guardrail metric before starting."
concludeOnlyAtMinimumSample:
description: "Peeking and stopping early inflates false positives."
trigger: { resource: experiment, events: [transition], transition: conclude }
condition: "$record.exposures < $record.minSampleSize"
action: reject
severity: error
message: "The experiment has not reached its pre-registered minimum sample."
concludeOnlyWithAHealthySplit:
description: "A sample-ratio mismatch means the assignment is broken and the results cannot be trusted."
trigger: { resource: experiment, events: [transition], transition: conclude }
condition: "$record.srmPValue == null || $record.srmPValue < 0.001"
action: reject
severity: error
message: "Sample-ratio check is failing or missing. Fix assignment before concluding."
breachesHaltNotConclude:
description: "An experiment with a breached guardrail is halted, not concluded."
trigger: { resource: experiment, events: [transition], transition: conclude }
condition: "len(query('guardrail', { experiment: $record.id, breached: true })) > 0"
action: reject
severity: error
message: "A guardrail is breached. Halt the experiment instead."
decideOnlyFinishedExperiments:
description: "A decision is approved only for an experiment that concluded or halted."
trigger: { resource: decision, events: [transition], transition: approve }
condition: "some(query('experiment', { id: $record.experiment }), e => e.status != 'concluded' && e.status != 'halted')"
action: reject
severity: error
message: "The experiment is still running."
views:
runningExperiments:
description: "What is live, how far along, and whether the split is healthy."
source: experiment
filter: "status == 'running'"
permissions: [engineer, analyst, product, admin]
columns:
- { field: key, label: "Experiment" }
- { field: exposures, label: "Exposures" }
- { field: minSampleSize, label: "Needed" }
- { field: srmPValue, label: "SRM p-value" }
- name: readyToCall
label: "Ready to call"
computed: "exposures >= minSampleSize"
defaultLimit: 200
breachedGuardrails:
description: "Guardrails that tripped."
source: guardrail
filter: "breached == true"
permissions: [engineer, analyst, product, admin]
columns:
- { field: maxDegradePercent, label: "Allowed %" }
- { field: observedPercent, label: "Observed %" }
defaultLimit: 200
decisionLog:
description: "Every decision and its rationale."
source: decision
permissions: [engineer, analyst, product, admin]
columns:
- { field: outcome, label: "Outcome" }
- { field: rationale, label: "Why" }
- { field: approvedBy, label: "Approved by" }
- { field: status, label: "State" }
defaultLimit: 200