Repository navigation
feat(blocks): split one arm of an A/B test with a nested test (parent/child) - #837
Conversation
…/child)
A test named `<parent>/<child>`, where `<parent>` is a test of the same
`experiments` block, is drawn only among `<parent>`'s visitors and is off
outside it, given or not. `{ "plp-optimizer": 50, "plp-optimizer/b": 50 }`
is 50% control, 25% A, 25% B, and ramping the parent keeps its arm split.
`assign`, the built-in `split-traffic` and the analytics client apply the
rule (src/v8/nested.ts); the analytics client sends a child only while its
parent is on, so `plp-optimizer/b` compares B with A with no filter.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
tlgimenes
left a comment
There was a problem hiding this comment.
Reviewed the nested-test rule (nested.ts, assign, split-traffic, analytics armsOf): the 50/25/25 split and the ramp behavior hold, and CI is green. Two things to confirm before merge: existing test names containing / whose prefix becomes a test, and that / survives in the __test and __at preview params.
|
Verdict: BLOCK: this changes the meaning of content sites have already saved and gives no signal when it does. The PR's own merge gate (docs page and PO ok) is still open. (round 1) Blocking
Worth fixing
Checked, fine
|
…ep its child's roll - `deco check` warns on every test of `experiments` it reads as within another, so a name saved earlier with a `/` doesn't change meaning silently. - `split-traffic` applies the client's overrides over each test's own roll before nesting: a preview switching on the parent alone shows the visitor's own arm of the child, wherever they rolled for the parent. - Tests: the warning, exp-17 (a visitor's own arm under a previewed parent), the tag-booted-first path dropping a child of an off parent. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Verdict: LGTM: no code finding still needs fixing here. The docs page and the PO's ok are a merge gate, already listed in the PR body, and the human who merges owns them. (round 2) Previously raised
Worth fixing
Checked, fineThe per-test |
…h __at) exp-18: parseVersion keeps `plp-optimizer/b` in `__test`, percent-encoded or not, next to `__at`, on a draft pointer and on a release id. exp-19: the same link inside a page URL's `__draft` reads the same and its client shows both tests on. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Valeu, @tlgimenes! Os dois pontos: 1. Nomes com
2. O
O Para o merge continuam faltando a página |
|
🎉 This PR is included in version 8.22.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Why
The plp-optimizer A/B test has to split our arm, not the traffic in thirds: 50% control (the store's PLP), and our 50% split into 25% internal test A and 25% internal test B. The analytics has to say both things cleanly: us against the control, and A against B.
v8's tests have two arms each, and a multi-way test is several tests. Two independent tests (
plp-optimizer: 50,plp-optimizer-b: 50) give the right shares, butplp-optimizer-bis also on for a quarter of the control, who never see B. Anyone reading it without the right filter mixes control visitors into the A/B comparison, with no error anywhere.What changes
<parent>/<child>, where<parent>is a test of the sameexperimentsblock, is drawn only among<parent>'s visitors and is off outside it:{ "__resolveType": "split-traffic", "plp-optimizer": 50, "plp-optimizer/b": 50 }plp-optimizer/b:id), so ramping the parent to 80 gives 20/40/40 and keeps everyone already in A or B where they were./-prefix that is a test of the block (a/b/cfalls back toawithouta/b). A/in a name whose prefix is no test changes nothing, so existing names behave as before.src/v8/nested.ts(internal), applied byassign(so the browser gives the same answer as the server), the built-insplit-traffic(after the client's overrides) and the analytics client.startAnalytics({ experiments })sends a child only while its parent is on. A control visitor's events carry{ "plp-optimizer": "off" }; ours carryplp-optimizerandplp-optimizer/b. Soplp-optimizercompares us with the control, andplp-optimizer/bcompares B with A with no filter. Onlyclient.tschanges, notruntime/orshared/: the standalone tag's bundles are untouched, and no decocms/analytics PR is needed.Record<string, number>, so the Studio form,deco check, thex-deco-assignmentsheader,assignmentsKeyand the__testpreview link carry the child as one more test.split-trafficdescription mentionsparent/child; the examples'schema.gen.jsonare regenerated (one line each).deco-variants(a "test within a test" section with the PLP slot's nestedmultivariate, and "Reading the results" updated forstartAnalytics) andCLAUDE.md.Tests
experiments.test.ts: over 100,000 ids, the split is 50/25/25; nobody outside the parent has the child; inside it, the child is its own roll; ramping the parent keeps A and B even and moves nobody between arms; nesting at any depth, to the nearest prefix that is a test; a/without a parent test changes nothing.__conformance__/experiments.test.ts:analytics/client.test.ts: theexpof each of the three arms.bun run checkpasses, andbun run testpasses (3400 tests). The Biome warnings left are onmaintoo.Before merging
/next/*page onsplit-trafficneeds the same rule, since exp-14 to exp-16 encode it. It also needs the PO's ok, since it extends "two arms per test"."plp-optimizer": { "control": 50, "a": 25, "b": 25 }with one label per arm inexp). That would touch the assignments type, the header, the cache key, the bindings' parsing, the preview, the Studio form anddeco check. More internal arms are possible here by chaining (plp-optimizer/b: 66,plp-optimizer/b/c: 50), not with siblings, which overlap.🤖 Generated with Claude Code
Summary by cubic
Adds nested A/B tests: a test named
<parent>/<child>is drawn only among<parent>'s visitors, so one test can split its own arm.{ "plp-optimizer": 50, "plp-optimizer/b": 50 }gives 50% control, 25% A, 25% B; two independent tests previously putplp-optimizer-bon a quarter of the control too, mixing control visitors into the A/B comparison./-prefix that is a test of the same block; a/in a name whose prefix is no test changes nothing.deco checkwarns on each name it reads as nested, so a name saved earlier with a/doesn't change meaning silently.src/v8/nested.ts, applied byassign, the built-insplit-traffic, and the analytics client, which sends a child only while its parent is on soplp-optimizercompares us with the control andplp-optimizer/bcompares B with A without filtering.__testpreview links keep the child name's/on drafts and releases.Written for commit 4362604. Summary will update on new commits.