Skip to content

Commit 7dd7c46

Browse files
committed
Merge remote-tracking branch 'origin/main' into jlk/ab-testing-deploy-lambda
2 parents 35e6107 + 77a4a14 commit 7dd7c46

File tree

20 files changed

+201
-85
lines changed

20 files changed

+201
-85
lines changed

.github/workflows/ab-testing-lambda-ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ jobs:
8181
roleArn: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }}
8282
githubToken: ${{ secrets.GITHUB_TOKEN }}
8383
projectName: dotcom:ab-testing-deployment-lambda
84-
configPath: ab-testing/cd/cdk.out/deployment-lambda/riff-raff.yaml
84+
configPath: ab-testing/cdk/cdk.out/deployment-lambda/riff-raff.yaml
8585
contentDirectories: |
8686
ab-testing-deployment-lambda:
8787
- ab-testing/deploy-lambda/dist/lambda.zip
88-
cdk.out/cdk/deployment-lambda:
89-
- ab-testing/cdk.out/deployment-lambda
88+
cdk.out/deployment-lambda:
89+
- ab-testing/cdk/cdk.out/deployment-lambda

ab-testing/config/abTests.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ const ABTests: ABTest[] = [
2525
description: "Testing Prebid.js v10 integration on DCR",
2626
owners: ["[email protected]"],
2727
status: "ON",
28-
expirationDate: "2025-12-30",
28+
expirationDate: "2025-12-10",
2929
type: "client",
30-
audienceSize: 0 / 100,
30+
audienceSize: 10 / 100,
31+
audienceSpace: "A",
3132
groups: ["control", "variant"],
3233
shouldForceMetricsCollection: true,
3334
},
@@ -44,6 +45,18 @@ const ABTests: ABTest[] = [
4445
groups: ["control", "variant"],
4546
shouldForceMetricsCollection: true,
4647
},
48+
{
49+
name: "thefilter-product-element",
50+
description:
51+
"A hold back test to measure uplift of the product element",
52+
owners: ["[email protected]"],
53+
status: "ON",
54+
expirationDate: "2025-12-30",
55+
type: "server",
56+
audienceSize: 0 / 100,
57+
groups: ["control", "variant"],
58+
shouldForceMetricsCollection: false,
59+
},
4760
];
4861

4962
const activeABtests = ABTests.filter((test) => test.status === "ON");

ab-testing/config/tsconfig.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
{
2-
"extends": "../tsconfig.json",
2+
"extends": "@guardian/tsconfig/tsconfig.json",
3+
"compilerOptions": {
4+
"noEmit": true,
5+
"skipLibCheck": true,
6+
"allowImportingTsExtensions": true,
7+
"moduleResolution": "nodenext",
8+
"module": "nodenext"
9+
},
10+
"exclude": ["node_modules", "index.ts"]
311
}

ab-testing/config/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ type AudienceSpace = Map<string, FastlyTestParams>;
44

55
type AllSpace = Map<string, FastlyTestParams[]>;
66

7-
type Team = "commercial" | "webex";
7+
type Team = "commercial" | "webex" | "thefilter";
88

99
type TestName = `${Team}-${string}`;
1010

ab-testing/deploy-lambda/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,25 @@
1313
},
1414
"dependencies": {
1515
"@aws-sdk/client-s3": "3.931.0",
16+
"@aws-sdk/client-ssm": "3.621.0",
1617
"superstruct": "2.0.2"
1718
},
1819
"devDependencies": {
1920
"@guardian/cdk": "62.0.1",
2021
"@guardian/eslint-config": "12.0.1",
2122
"@guardian/tsconfig": "1.0.1",
2223
"@rollup/plugin-commonjs": "29.0.0",
23-
"@rollup/plugin-node-resolve": "16.0.3",
2424
"@rollup/plugin-json": "6.1.0",
25+
"@rollup/plugin-node-resolve": "16.0.3",
2526
"@types/aws-lambda": "8.10.158",
2627
"@types/node": "22.17.0",
2728
"aws-cdk-lib": "2.220.0",
2829
"aws-lambda": "1.0.7",
30+
"esbuild": "0.27.0",
2931
"eslint": "9.39.1",
3032
"prettier": "3.0.3",
3133
"rollup": "4.53.2",
32-
"typescript": "5.9.3",
33-
"esbuild": "0.27.0",
34-
"rollup-plugin-esbuild": "6.2.1"
34+
"rollup-plugin-esbuild": "6.2.1",
35+
"typescript": "5.9.3"
3536
}
3637
}

ab-testing/frontend/src/lib/components/OphanLink.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
<a
1010
href={`https://dashboard.ophan.co.uk/graph/breakdown?day=today&ab=${testName}`}
11+
target="_blank"
1112
>
1213
graph
1314
</a>

ab-testing/tsconfig.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

dotcom-rendering/docs/development/ab-testing-in-dcr.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ When your PR is merged, the A/B test will be automatically deployed to Fastly an
119119

120120
#### Naming Conventions
121121

122-
A/B 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, you can inspect & edit the allowed team name definitions [here](https://github.com/guardian/dotcom-rendering/blob/main/ab-testing/types.ts#L9).
122+
A/B 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 enforced by typescript validation, you can inspect & edit the allowed team name definitions [here](https://github.com/guardian/dotcom-rendering/blob/main/ab-testing/types.ts#L9).
123123

124124
#### Test Size and Groups
125125

@@ -135,7 +135,7 @@ All requests are processed by Fastly at the edge, however, A/B testing of server
135135

136136
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.
137137

138-
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.
138+
There's a limit of the number of concurrent server-side tests that can be run, enforced by the validation script, so it's important to use client-side tests where possible.
139139

140140
#### Test Expiration
141141

@@ -178,13 +178,13 @@ const someComponent = () => {
178178
const abTests = useBetaAB();
179179

180180
// Am I in the test at all?
181-
const isInTest = abTests?.isUserInTest('AbTestTest') ?? false;
181+
const isInTest = abTests?.isUserInTest('webex-example-test') ?? false;
182182

183183
const isInControlGroup =
184-
(abTests?.isUserInTestGroup('AbTestTest', 'control') ?? false);
184+
(abTests?.isUserInTestGroup('webex-example-test', 'control') ?? false);
185185

186186
const isInVariantGroup =
187-
abTests?.isUserInTestGroup('AbTestTest', 'variant') ?? false;
187+
abTests?.isUserInTestGroup('webex-example-test', 'variant') ?? false;
188188

189189
if (isInControlGroup) {
190190
return (
@@ -223,16 +223,16 @@ const abTests = useBetaAB();
223223
// Get all of the user's server/client-side A/B test participations
224224
const abTestParticipations = abTests?.getParticipations(); // EG. { commercial-dev-client-side-test: 'variant', commercial-dev-server-side-test: 'variant' }
225225

226-
// Is user in the AbTestTest test (any cohort)
227-
const isInTest = abTests?.isUserInTest('AbTestTest') ?? false;
226+
// Is user in the webex-example-test test (any cohort)
227+
const isInTest = abTests?.isUserInTest('webex-example-test') ?? false;
228228

229-
// Is user in the AbTestTest test (control cohort)
229+
// Is user in the webex-example-test test (control cohort)
230230
const isInControlGroup =
231-
abTests?.isUserInTestGroup('AbTestTest', 'control') ?? false;
231+
abTests?.isUserInTestGroup('webex-example-test', 'control') ?? false;
232232

233-
// Is user in the AbTestTest test (variant cohort)
233+
// Is user in the webex-example-test test (variant cohort)
234234
const isInVariantGroup =
235-
abTests?.isUserInTestGroup('AbTestTest', 'variant') ?? false;
235+
abTests?.isUserInTestGroup('webex-example-test', 'variant') ?? false;
236236
```
237237

238238
#### On the Client

dotcom-rendering/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@guardian/identity-auth": "6.0.1",
3939
"@guardian/identity-auth-frontend": "8.1.0",
4040
"@guardian/libs": "26.1.0",
41-
"@guardian/ophan-tracker-js": "2.6.2",
41+
"@guardian/ophan-tracker-js": "2.6.3",
4242
"@guardian/react-crossword": "11.1.0",
4343
"@guardian/shimport": "1.0.2",
4444
"@guardian/source": "11.3.0",

dotcom-rendering/src/components/ProductCardButtons.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ export const ProductCardButtons = ({
2424
minimisePadding={true}
2525
priority={index === 0 ? 'primary' : 'tertiary'}
2626
fullwidth={true}
27-
data-component={`${
28-
dataComponent ?? 'product-card-button'
29-
}-${index}`}
27+
dataComponent={
28+
dataComponent
29+
? `${dataComponent}-${index + 1}`
30+
: undefined
31+
}
3032
/>
3133
);
3234
})}

0 commit comments

Comments
 (0)