Loading…
D1 tables experiments and experiment_assignments (migration 0041) store the registry and the sticky session-to-variant assignments.
Helper functions/_lib/eo-experiment.js exposes assign(env, name, sessionId) — deterministic variant pick (FNV-1a hash of name:sessionId), idempotent INSERT into experiment_assignments. Returns null if the experiment is missing or not active.
To launch an experiment: INSERT INTO experiments (name, description, variants_json, allocation_json, status, started_at) VALUES ('home_hero_v2','...','[\"control\",\"v1\"]','[50,50]','active', datetime('now')); then call assign() from the relevant Function and branch on the returned variant.