Repository navigation
Conversation
API v2 returns the current iteration's variants, which can have keys after d (for example a, b, d, e). Creating an experiment takes only the a–d fields, so duplicate refused these experiments. It now renames the variants in order to a, b, c, d, as the dashboard does, and refuses only more than 4 variants. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The API returns variants in key order today, but that order is not part of its contract. Without a sort, a source listed as b, a would copy b's offering into the control. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
go build ./...,go test ./..., andgofmtpassMotivation
API v2
GET experimentreturns the current iteration's variants. After a new iteration, their keys can come afterd(for examplea, b, d, e). Creating an experiment still takes onlyoffering_a_id…offering_d_id, sorc experiments duplicaterefused these experiments since #218. Part of EXP-716.Description
duplicatesorts the source variants by key (shorter keys first, soaafollowsz) and renames them toa, b, c, dbefore it builds the create body: a copy ofa, b, d, ebecomesa, b, c, d. Offerings, fallback offerings and placement offerings move with their variant. The dashboard's Duplicate does the same.b, astill copiesainto the control.Tests on a test project (built from this branch)
Each copy was read back with
rc experiments show --json.mainThe 5-variant refusal is covered by a unit test only, because no test experiment has 5 variants.
🤖 Generated with Claude Code
Note
Medium Risk
Duplication now reorders and renames variants, which changes which offering lands in each slot if callers assumed literal key preservation—behavior is intentional but affects experiment configuration fidelity.
Overview
rc experiments duplicateno longer fails when the source iteration uses variant keys outsidea–d(e.g.eafter a new iteration). Before building the create payload, variants are sorted (shorter keys first, then lexicographic) and renamed to consecutivea,b,c,dvia new helperwithConsecutiveVariantKeys, so offerings, fallbacks, and placement mappings stay attached to the right variant. API response order no longer matters (e, a, bcopies as controlaplus treatmentsbandc).The old hard error for keys after
dis replaced by a cap of at most four variants. Tests were updated for remapping (including placements) and for the new “at most 4” rejection path.Reviewed by Cursor Bugbot for commit 0abd7f0. Bugbot is set up for automated code reviews on this repo. Configure here.