Skip to content

feat(experiments): add configurable baseline variants#14

Open
lordspline wants to merge 3 commits into
masterfrom
capy/configurable-experiment-baseline
Open

feat(experiments): add configurable baseline variants#14
lordspline wants to merge 3 commits into
masterfrom
capy/configurable-experiment-baseline

Conversation

@lordspline

@lordspline lordspline commented Jun 17, 2026

Copy link
Copy Markdown

This PR adds configurable baseline variant selection to PostHog experiments. Users can now choose any variant as the baseline for statistical analysis via stats_config.baseline_variant_key, instead of being forced to use a hardcoded control variant. Legacy experiments default to control or the first configured variant for backward compatibility. Variant keys are never renamed—baseline selection is analysis-only metadata that does not mutate feature flags or historical exposure.

  • Backend: resolve_baseline_variant_key validates against flag variants, handles missing/removed baselines, and updates query runners (trends/funnels/metrics) to use the selected baseline
  • Frontend: Settings tab exposes baseline dropdown with validation, wizard shows baseline badge, result tables and tooltips respect selected baseline
  • MCP tools and generated schemas updated with baseline_variant_key parameter
  • Activity logging records baseline changes
  • Validation prevents setting baselines to excluded or nonexistent variants

Open POST-036 POST-036


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

@lordspline lordspline added the capy Generated by capy.ai label Jun 17, 2026 — with Capy AI

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added 1 comment

Comment thread frontend/src/scenes/experiments/ExperimentForm/VariantsPanelCreateFeatureFlag.tsx Outdated
raise ValidationError(f"cannot exclude holdout pseudo-variants: {sorted(holdout_excluded)}")
holdout_excluded = {k for k in excluded_variants if k.startswith("holdout-")}
if holdout_excluded:
raise ValidationError(f"cannot exclude holdout pseudo-variants: {sorted(holdout_excluded)}")
lordspline and others added 2 commits June 17, 2026 15:18
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capy Generated by capy.ai

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants