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.

experiment.create

Create an A/B test experiment.

  • Type: operation (command)
  • Version: 1.0.0
  • Stability: stable
  • Owners: platform.feature-flags
  • Tags: feature-flags, experiment, create
  • File: packages/libs/feature-flags/src/contracts/index.ts
  • field.key.label
    experiment.create
    field.version.label
    1.0.0
    field.type.label
    operation (command)
    field.title.label
    experiment.create
    field.description.label

    Create an A/B test experiment.

  • Type: operation (command)
  • Version: 1.0.0
  • Stability: stable
  • Owners: platform.feature-flags
  • Tags: feature-flags, experiment, create
  • File: packages/libs/feature-flags/src/contracts/index.ts
  • field.tags.label
    feature-flags,experiment,create
    field.owners.label
    platform.feature-flags
    field.stability.label
    stable

    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',
    	},
    });