Skip to content

Commit ea09113

Browse files
authored
Merge branch 'main' into nz-non-auxia-sign-in-gate
2 parents fa53652 + aa7d19e commit ea09113

65 files changed

Lines changed: 6041 additions & 521 deletions

File tree

Some content is hidden

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

ab-testing/config/abTests.ts

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,26 @@ const ABTests: ABTest[] = [
144144
groups: ["control", "variant"],
145145
shouldForceMetricsCollection: false,
146146
},
147+
/**
148+
* Puzzles & Games rollout, tier v0 (the master switch).
149+
*
150+
* Gates the baseline Puzzles & Games experience: the new Puzzles Hub
151+
* page, and the 6 V0 puzzle pages (sudoku easy/medium/hard/killer,
152+
* word-wheel, wordiply). At v0, there is no archive, no calendar, no
153+
* progress indicators, no sign-in-to-track-progress prompt, no "more
154+
* from puzzles" rail, and the hub's sub-nav has no links yet.
155+
*
156+
* This is the master switch for the whole Puzzles & Games experience:
157+
* turning it off (or down to 0%) hides everything: the hub, the V0
158+
* puzzle pages, and (by the cumulative design below) every later tier
159+
* too, since v1/v2 only take effect when this is also enabled.
160+
*
161+
* See `puzzles-new-hub-v1`/`puzzles-new-hub-v2` below for the later
162+
* rollout tiers, and `src/lib/puzzlesHubVersionExperiment.ts` /
163+
* `src/lib/puzzlesHubExperiment.ts` in dotcom-rendering for the
164+
* corresponding cumulative gate-check helpers
165+
* (`isPuzzlesHubEnabled`/`isPuzzlesHubV1Enabled`/`isPuzzlesHubV2Enabled`).
166+
*/
147167
{
148168
name: "puzzles-new-hub",
149169
description: "Rollout of the new Puzzles Hub experience",
@@ -156,6 +176,68 @@ const ABTests: ABTest[] = [
156176
groups: ["control", "variant"],
157177
shouldForceMetricsCollection: false,
158178
},
179+
/**
180+
* Puzzles & Games rollout, tier v1 (w/c 12 Oct launch).
181+
*
182+
* Only takes effect when `puzzles-new-hub` (v0) is ALSO enabled for the
183+
* reader. This test does nothing on its own, by design, so the
184+
* rollout can never end up in an inconsistent state (e.g. v1 features
185+
* showing while the v0 baseline they build on is switched off).
186+
*
187+
* On top of v0, this tier activates: the full hub sub-nav links (to
188+
* /word-games, /logic-puzzles, /trivia-and-quizzes), a
189+
* sign-in-to-track-progress message, a calendar/archive view for
190+
* crosswords/logic-puzzles/word-games (not Wordiply, which has no
191+
* archive), progress indicators (Available/Completed), the "More from
192+
* Puzzles & Games" related-content rail, newsletter signup, and
193+
* changes to the existing crossword page (print CTA repositioning, a
194+
* "play other puzzles" container).
195+
*
196+
* To roll back from v1 to v0 without a deploy: flip this test's
197+
* `audienceSize` to `0 / 100` (or `status` to `"OFF"`) while leaving
198+
* `puzzles-new-hub` untouched.
199+
*/
200+
{
201+
name: "puzzles-new-hub-v1",
202+
description:
203+
"Rollout of the v1 Puzzles & Games features (w/c 12 Oct), on top of the puzzles-new-hub v0 baseline",
204+
owners: ["puzzles.team@guardian.co.uk"],
205+
status: "ON",
206+
expirationDate: "2026-12-31",
207+
type: "server",
208+
audienceSize: 0 / 100,
209+
audienceSpace: "A",
210+
groups: ["control", "variant"],
211+
shouldForceMetricsCollection: false,
212+
},
213+
/**
214+
* Puzzles & Games rollout, tier v2 (future, no launch date confirmed
215+
* yet as of this writing).
216+
*
217+
* Only takes effect when BOTH `puzzles-new-hub` (v0) AND
218+
* `puzzles-new-hub-v1` are ALSO enabled for the reader, same
219+
* cumulative-by-design principle as v1 above, applied one tier further.
220+
*
221+
* On top of v0+v1, this tier activates: the On the Ball and Film Reveal
222+
* iframe games (Trivia and Quizzes group), a "Most played" container,
223+
* EventKit-driven navigation, migrating existing crossword pages onto
224+
* the new Puzzle Page template, and search-engine mobile app nudges.
225+
*
226+
* Kept at 0% until that work begins; there is nothing to roll back yet.
227+
*/
228+
{
229+
name: "puzzles-new-hub-v2",
230+
description:
231+
"Rollout of the v2 Puzzles & Games features (no date confirmed yet), on top of the puzzles-new-hub/puzzles-new-hub-v1 baseline",
232+
owners: ["puzzles.team@guardian.co.uk"],
233+
status: "ON",
234+
expirationDate: "2026-12-31",
235+
type: "server",
236+
audienceSize: 0 / 100,
237+
audienceSpace: "A",
238+
groups: ["control", "variant"],
239+
shouldForceMetricsCollection: false,
240+
},
159241
{
160242
name: "identity-and-trust-consent-rr-banner-us",
161243
description:
@@ -215,7 +297,7 @@ const ABTests: ABTest[] = [
215297
status: "ON",
216298
audienceSize: 0 / 100,
217299
audienceSpace: "B",
218-
groups: ["control", "variant"],
300+
groups: ["control", "variant", "variant2"],
219301
shouldForceMetricsCollection: true,
220302
},
221303
{

dotcom-rendering/cdk/bin/cdk.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { App } from 'aws-cdk-lib';
1+
import { App, Duration } from 'aws-cdk-lib';
22
import { InstanceClass, InstanceSize, InstanceType } from 'aws-cdk-lib/aws-ec2';
33
import type { RenderingCDKStackProps } from '../lib/renderingStack';
44
import { RenderingCDKStack } from '../lib/renderingStack';
@@ -115,6 +115,15 @@ export const TagPageRenderingPropsCODE: RenderingCDKStackProps = {
115115
imageIdentifier: getImageIdentifier(),
116116
taskCpu: 1024,
117117
taskMemoryLimitMiB: 2048,
118+
scaling: {
119+
minimumTasks: 1,
120+
maximumTasks: 9,
121+
cpuScaling: {
122+
targetValue: 20,
123+
scaleInCooldown: Duration.seconds(60),
124+
scaleOutCooldown: Duration.seconds(60),
125+
},
126+
},
118127
},
119128
};
120129

@@ -158,6 +167,17 @@ export const TagPageRenderingPropsPROD: RenderingCDKStackProps = {
158167
imageIdentifier: getImageIdentifier(),
159168
taskCpu: 2048,
160169
taskMemoryLimitMiB: 4096,
170+
scaling: {
171+
minimumTasks: 9,
172+
maximumTasks: 90,
173+
cpuScaling: {
174+
targetValue: 20,
175+
// TODO: Tune cooldown values.
176+
// https://docs.aws.amazon.com/autoscaling/application/userguide/target-tracking-scaling-policy-overview.html#target-tracking-cooldown
177+
scaleInCooldown: Duration.seconds(60),
178+
scaleOutCooldown: Duration.seconds(60),
179+
},
180+
},
161181
},
162182
};
163183

dotcom-rendering/cdk/lib/__snapshots__/renderingStack.test.ts.snap

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2109,7 +2109,7 @@ exports[`The RenderingCDKStack matches the snapshot for Tag Page Rendering CODE
21092109
"EcsTaskDefinitionTaskRoleB7B6D8DD",
21102110
],
21112111
"Properties": {
2112-
"MaxCapacity": 2,
2112+
"MaxCapacity": 9,
21132113
"MinCapacity": 1,
21142114
"ResourceId": {
21152115
"Fn::Join": [
@@ -3667,6 +3667,24 @@ systemctl start tag-page-rendering",
36673667
},
36683668
"Type": "AWS::IAM::InstanceProfile",
36693669
},
3670+
"tagpagerenderingCpuScaling1742C101": {
3671+
"Properties": {
3672+
"PolicyName": "TagPageRenderingCODEtagpagerenderingCpuScalingAFEBC723",
3673+
"PolicyType": "TargetTrackingScaling",
3674+
"ScalingTargetId": {
3675+
"Ref": "EcsServiceTaskCountTarget02FCCE22",
3676+
},
3677+
"TargetTrackingScalingPolicyConfiguration": {
3678+
"PredefinedMetricSpecification": {
3679+
"PredefinedMetricType": "ECSServiceAverageCPUUtilizationHighResolution",
3680+
},
3681+
"ScaleInCooldown": 60,
3682+
"ScaleOutCooldown": 60,
3683+
"TargetValue": 20,
3684+
},
3685+
},
3686+
"Type": "AWS::ApplicationAutoScaling::ScalingPolicy",
3687+
},
36703688
"tagpagerenderingEcsClusterE7696595": {
36713689
"Properties": {
36723690
"ClusterSettings": [
@@ -4260,8 +4278,8 @@ exports[`The RenderingCDKStack matches the snapshot for Tag Page Rendering PROD
42604278
"EcsTaskDefinitionTaskRoleB7B6D8DD",
42614279
],
42624280
"Properties": {
4263-
"MaxCapacity": 2,
4264-
"MinCapacity": 1,
4281+
"MaxCapacity": 90,
4282+
"MinCapacity": 9,
42654283
"ResourceId": {
42664284
"Fn::Join": [
42674285
"",
@@ -6261,6 +6279,24 @@ systemctl start tag-page-rendering",
62616279
},
62626280
"Type": "AWS::IAM::InstanceProfile",
62636281
},
6282+
"tagpagerenderingCpuScaling1742C101": {
6283+
"Properties": {
6284+
"PolicyName": "TagPageRenderingPRODtagpagerenderingCpuScaling4582D272",
6285+
"PolicyType": "TargetTrackingScaling",
6286+
"ScalingTargetId": {
6287+
"Ref": "EcsServiceTaskCountTarget02FCCE22",
6288+
},
6289+
"TargetTrackingScalingPolicyConfiguration": {
6290+
"PredefinedMetricSpecification": {
6291+
"PredefinedMetricType": "ECSServiceAverageCPUUtilizationHighResolution",
6292+
},
6293+
"ScaleInCooldown": 60,
6294+
"ScaleOutCooldown": 60,
6295+
"TargetValue": 20,
6296+
},
6297+
},
6298+
"Type": "AWS::ApplicationAutoScaling::ScalingPolicy",
6299+
},
62646300
"tagpagerenderingEcsClusterE7696595": {
62656301
"Properties": {
62666302
"ClusterSettings": [

dotcom-rendering/cdk/lib/renderingStack.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
} from '@guardian/cdk/lib/constructs/core';
99
import { GuCname } from '@guardian/cdk/lib/constructs/dns/dns-records';
1010
import { GuAllowPolicy } from '@guardian/cdk/lib/constructs/iam';
11+
import type { GuLoadBalancedAppExperimentalProps } from '@guardian/cdk/lib/experimental/patterns/gu-load-balanced-app';
1112
import { GuLoadBalancedAppExperimental } from '@guardian/cdk/lib/experimental/patterns/gu-load-balanced-app';
1213
import type { GuAsgCapacity } from '@guardian/cdk/lib/types';
1314
import { aws_cloudwatch, type App as CDKApp, Duration } from 'aws-cdk-lib';
@@ -67,6 +68,10 @@ export interface RenderingCDKStackProps extends Omit<GuStackProps, 'stack'> {
6768
* Memory in MB for ECS task
6869
*/
6970
taskMemoryLimitMiB: number;
71+
72+
scaling: NonNullable<
73+
GuLoadBalancedAppExperimentalProps['ecsProps']
74+
>['scaling'];
7075
};
7176
}
7277

@@ -296,10 +301,7 @@ export class RenderingCDKStack extends CDKStack {
296301

297302
memoryLimitMiB: ecsProps.taskMemoryLimitMiB,
298303
cpu: ecsProps.taskCpu,
299-
scaling: {
300-
minimumTasks: 1,
301-
maximumTasks: 2,
302-
},
304+
scaling: ecsProps.scaling,
303305
},
304306

305307
// Route all traffic to EC2
@@ -312,7 +314,6 @@ export class RenderingCDKStack extends CDKStack {
312314

313315
if (app.ecsService) {
314316
const { taskDefinition } = app.ecsService;
315-
316317
const ecsEnvVars: Record<string, string> = {
317318
// Custom environment variables needed by the application
318319
NODE_ENV: 'production',

0 commit comments

Comments
 (0)