Deterministic A/B Test Bucketing

Use stable IDs, salts, SHA-256 parity tests, and BigQuery checks to assign deterministic A/B test variants across SQL, Python, C#, and apps.

What

Goal - Implement A/B test bucketing as a deterministic function of salt and user_id so clients, backend code, and warehouse queries return the same variant.

Audience - Engineers and analysts building lightweight experimentation systems or validating assignments outside a hosted A/B testing platform.

Prerequisites

  • A stable user identifier for logged-in users
  • A warehouse table with users or events
  • SQL, Python, or C# runtime access where variants need to be assigned

This guide is the implementation checklist for the longer deterministic A/B test bucketing post. Start with the post if you want the reasoning behind the approach; use the steps below when you're ready to wire the assignment function into clients, services, and BigQuery.