ABTestManager (ab-test.ts)

helix · analytics

Strategy A/B Testing manager. Tracks control vs. variant strategy performance for each failure type. /

/**
 * Strategy A/B Testing manager.
 * Tracks control vs. variant strategy performance for each failure type.
 */

export interface ABTest {
  id: string;
  failureCode: string;
  failureCategory: string;
  controlStrategy: string;
  variantStrategy: string;
  variantTrafficRatio: number;
  minTrials: number;
  state: 'running' | 'variant_wins' | 'control_wins' | 'inconclusive';
  controlSuccesses: number;
  controlTrials: number;
  variantSuccesses: number;
  variantTrials: number;
  startedAt: number;
  concludedAt?: number;
}

export interface CreateABTestParams {
  failureCode: string;
  failureCategory: string;
  controlStrategy: string;
  variantStrategy: string;
  variantTrafficRatio?: number;
  minTrials?: number;
}

function makeKey(failureCode: string, failureCategory: string): 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key