OSS-first docs
These docs teach the open system first: contracts, generated surfaces, runtimes, governance, and incremental adoption. Studio shows up as the operating layer on top, not as the source of truth.
Create an A/B test experiment.
Goal
Set up an experiment with variants.
Context
Called when setting up A/B testing.
Source Definition
import { defineCommand, defineQuery } from '@lssm-tech/lib.contracts-spec';
import { defineSchemaModel, ScalarTypeEnum } from '@lssm-tech/lib.schema';
export const CreateExperimentContract = defineCommand({
meta: {
key: 'experiment.create',
version: '1.0.0',
stability: 'stable',
owners: ['platform.feature-flags'],
tags: ['feature-flags', 'experiment', 'create'],
description: 'Create an A/B test experiment.',
goal: 'Set up an experiment with variants.',
context: 'Called when setting up A/B testing.',
},
io: {
input: CreateExperimentInput,
output: ExperimentModel,
errors: {
FLAG_NOT_FOUND: {
description: 'Flag does not exist',
http: 404,
gqlCode: 'FLAG_NOT_FOUND',
when: 'Flag ID is invalid',
},
EXPERIMENT_KEY_EXISTS: {
description: 'Experiment key already exists',
http: 409,
gqlCode: 'EXPERIMENT_KEY_EXISTS',
when: 'An experiment with this key already exists',
},
INVALID_VARIANTS: {
description: 'Invalid variant configuration',
http: 400,
gqlCode: 'INVALID_VARIANTS',
when: 'Variant percentages must sum to 100',
},
},
},
policy: {
auth: 'admin',
},
});