Skip to content

Commit 2940598

Browse files
Merge branch 'main' into rjr-investigate-looping-video-in-articles
2 parents abd631d + 10fa906 commit 2940598

File tree

102 files changed

+4417
-1500
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+4417
-1500
lines changed

.github/workflows/ab-testing-checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
run: deno task build
4646

4747
- if: ${{ inputs.save_build_artifact }}
48-
uses: actions/upload-artifact@v4.6.2
48+
uses: actions/upload-artifact@v5
4949
with:
5050
name: ab-testing-build
5151
path: ab-testing/dist

.github/workflows/ab-testing-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
deno-version: v2.3
3333

3434
- name: Download build artifact
35-
uses: actions/download-artifact@v5.0.0
35+
uses: actions/download-artifact@v6.0.0
3636
with:
3737
name: ab-testing-build
3838
path: ab-testing/dist

.github/workflows/ab-testing-ui.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Build
3333
run: deno run build
3434
- name: Save build
35-
uses: actions/upload-artifact@v4.6.2
35+
uses: actions/upload-artifact@v5
3636
with:
3737
name: ui-build
3838
path: ab-testing/frontend/output/ab-tests.html
@@ -57,7 +57,7 @@ jobs:
5757
uses: ./.github/actions/setup-node-env
5858

5959
- name: Fetch build
60-
uses: actions/download-artifact@v5.0.0
60+
uses: actions/download-artifact@v6.0.0
6161
with:
6262
name: ui-build
6363
path: output/ab-tests.html

.github/workflows/bundle-analyser.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ jobs:
2020
working-directory: dotcom-rendering
2121

2222
- name: Archive code coverage results for web bundle
23-
uses: actions/upload-artifact@v4
23+
uses: actions/upload-artifact@v5
2424
with:
2525
name: bundle-analyser-report-web-bundles
2626
path: dotcom-rendering/dist/stats/client.web-bundles.html
2727
if-no-files-found: error
2828

2929
- name: Archive code coverage results for web variant bundle
30-
uses: actions/upload-artifact@v4
30+
uses: actions/upload-artifact@v5
3131
with:
3232
name: bundle-analyser-report-web
3333
path: dotcom-rendering/dist/stats/client.web.variant-bundles.html
3434
if-no-files-found: warn # Variant bundle only exists when an active experiment is going on
3535

3636
- name: Archive code coverage results for apps bundle
37-
uses: actions/upload-artifact@v4
37+
uses: actions/upload-artifact@v5
3838
with:
3939
name: bundle-analyser-report-apps
4040
path: dotcom-rendering/dist/stats/client.apps-bundles.html

.github/workflows/playwright.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
env:
4242
NODE_ENV: production
4343

44-
- uses: actions/upload-artifact@v4
44+
- uses: actions/upload-artifact@v5
4545
if: always()
4646
with:
4747
name: playwright-report-${{ matrix.group }}

ab-testing/README.md

Lines changed: 2 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,6 @@
1-
# AB Testing
1+
# Beta AB Test framework
22

3-
This directory contains the code and configuration for the AB testing framework used on theguardian.com.
4-
5-
The [`abTest.ts`](./abTest.ts) module is where you should define your AB tests.
6-
7-
Add your AB tests to the `abTests` array in the `abTest.ts` file. Each test should have a unique name.
8-
9-
```ts
10-
{
11-
name: 'webex-example-test',
12-
description:
13-
'Test something interesting on the site',
14-
owners: ['[email protected]'],
15-
status: 'ON',
16-
expirationDate: '2050-12-30',
17-
type: 'client',
18-
audienceSize: 10 / 100,
19-
groups: ['control', 'variant'],
20-
shouldForceMetricsCollection: true
21-
}
22-
```
23-
24-
When you create a PR that modifies the `abTest.ts` file, a git hook and CI will run checks to ensure that your AB test is valid (not expired, enough space for the test etc.).
25-
26-
When your PR is merged, the AB test will be automatically deployed to Fastly and be available at the same time as your changes.
27-
28-
## Guidelines for AB Tests
29-
30-
### Naming Conventions
31-
32-
AB tests should be prefixed with the team associated with the test, for example `webex-example-test`. This helps to identify the team responsible for the test and is enforce by typescript validation.
33-
34-
### Test Size and Groups
35-
36-
The `audienceSize` is the size of the whole test and is divided between the test groups that you specify. The "resolution" of sizing is down to 0.1%, so groups will be rounded to the nearest 0.1%.
37-
38-
Convention is to have groups named control and variant, but you can name them as you wish.
39-
40-
A single group is also possible, for example if you're rolling out a new feature and don't need a control.
41-
42-
### Client vs Server Side Tests
43-
44-
All requests are processed by Fastly at the edge, however, ab testing of server-side logic in Frontend or DCR will need to be cached separately. Client side tests do not need to be cached separately, as they are applied in the browser after the response is delivered.
45-
46-
Ensure that the `type` field is set to either `client` or `server` to indicate the type of test so that server side tests can be cached correctly, and client side tests are not splitting the cache unnecessarily.
47-
48-
There's a limit of the number of concurrent server-side tests that can be run, enforce by the validation script, so it's important to use client-side tests where possible.
49-
50-
### Test Expiration
51-
52-
AB tests should have an expiration date set in the future. This is to ensure that tests do not run indefinitely.
53-
54-
Expired tests will cause the ab testing validation to fail, and will not be deployed.
55-
56-
Tests that expire while they are are in-flight will not be served by fastly, and should be removed from the `abTest.ts` file as soon as possible.
57-
58-
### Audience Spaces
59-
60-
Ideally AB tests would never overlap (users being in multiple tests), but sometimes this is unavoidable, for example when running a very large 50+% test without interrupting existing tests.
61-
62-
To add a test where there is not enough space in the default audience space (`A`), you can specify a different `audienceSpace` in the test definition.
63-
64-
For example if there are already 3 25% tests in space `A` totalling 75%, and you want to run a 50% test, you can set the `audienceSpace` to `B` to allow this test to overlap with the existing tests.
65-
66-
### Test Status
67-
68-
Tests can be set to `ON` or `OFF` using the `status` field. Only tests with status `ON` will be validated and deployed.
3+
This directory contains the code and configuration for the AB testing framework used on theguardian.com. If you're looking to set up a new server or client side AB test using the new framework then please visit the docs [here](https://github.com/guardian/dotcom-rendering/blob/main/dotcom-rendering/docs/development/ab-testing-in-dcr.md#beta-ab-test-framework).
694

705
## How it works
716

ab-testing/abTest.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,19 @@ import type { ABTest } from './types';
1919
* - 100% Test variant MVT 500-999
2020
*/
2121

22-
const ABTests: ABTest[] = [];
22+
const ABTests: ABTest[] = [
23+
{
24+
name: 'commercial-prebid-v10',
25+
description: 'Testing Prebid.js v10 integration on DCR',
26+
owners: ['[email protected]'],
27+
status: 'ON',
28+
expirationDate: '2025-12-30',
29+
type: 'client',
30+
audienceSize: 0 / 100,
31+
groups: ['control', 'variant'],
32+
shouldForceMetricsCollection: true,
33+
},
34+
];
2335

2436
const activeABtests = ABTests.filter((test) => test.status === 'ON');
2537

0 commit comments

Comments
 (0)