# Feature Lab

**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 column
  - `breachedGuardrails`
  - `decisionLog`
- **Roles:**
  - `admin`
  - `engineer`: flags, starting and halting experiments
  - `analyst`: metrics, guardrails, readouts, concluding experiments
  - `product`: 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

```bash
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!`.

## Reselling

This is an original ISDG product. It has no customer data and no third-party branding.
