Skip to content

Use variant headlines when in an Editorial Test - #16577

Open
emma-imber wants to merge 9 commits into
mainfrom
ei/use-variant-headlines-in-test
Open

Use variant headlines when in an Editorial Test#16577
emma-imber wants to merge 9 commits into
mainfrom
ei/use-variant-headlines-in-test

Conversation

@emma-imber

Copy link
Copy Markdown
Contributor

What does this change?

Uses test variant headlines on a card when the following conditions are met:

  • The page is in the 'fronts-and-curation-editorial-headline-test' server side test
  • There is an active (eg. not expired or manually ended) editorial test on the card
  • The front the card is being rendered on is included in the frontsThisTestCanRunOn property on the editorial test definition
  • The variantMeta for the test variant is defined, and the headline variant is a string

In order to make these checks, serverSideABTests and pageId need to be passed in to the enhancer code.

Why?

This is part of the rendering layer implementation of fronts A/B testing, for the editorial A/B testing mission. This follows up on the model changes made here: #16486

How has this change been tested?

This has been tested locally end to end. Unit tests have also been added to make sure the decideHeadline logic is producing the expected behaviour in different scenarios with different combinations of conditions.

@emma-imber emma-imber self-assigned this Aug 19, 2026
@emma-imber
emma-imber requested a review from a team as a code owner August 19, 2026 15:38
@emma-imber emma-imber added the feature Departmental tracking: work on a new feature label Aug 19, 2026
@github-actions

Copy link
Copy Markdown

Hello 👋! When you're ready to run Chromatic, please apply the run_chromatic label to this PR.

You will need to reapply the label each time you want to run Chromatic.

Click here to see the Chromatic project.

@emma-imber emma-imber added the run_chromatic Runs chromatic when label is applied label Aug 19, 2026
@github-actions github-actions Bot removed the run_chromatic Runs chromatic when label is applied label Aug 19, 2026

@abeddow91 abeddow91 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great and is working as expected! My only request for change is that we drop tests for now on the returned object from enhancedCards. Otherwise it looks good to go.

I've left a few nits but these are non-blocking so I'll leave them up to you.

Comment thread dotcom-rendering/src/model/enhanceCards.ts Outdated
Comment thread dotcom-rendering/src/model/enhanceCards.ts Outdated
Comment on lines +238 to +239
// make sure the variant headline isn't undefined and that it is of type string
if (typeof variantMeta?.meta.headline !== 'string') return defaultHeadline;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thanks for tightening this check

Comment thread dotcom-rendering/src/model/enhanceCards.ts Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for being so thorough with this test suite ✨

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown

@emma-imber emma-imber added the run_chromatic Runs chromatic when label is applied label Aug 21, 2026
@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown

@github-actions github-actions Bot removed the run_chromatic Runs chromatic when label is applied label Aug 21, 2026
@github-actions

Copy link
Copy Markdown

🚀 Image pushed to AWS ECR

Image digest: sha256:aba8eee311bd31dc3ed27bd6ac14bb6b51650b51019fc68eca749ec6c6ce9a3f

🐛 Run the image locally

The following can be used to run the image locally:

# Refer to image using the immutable digest. Find alternatives below.
IMAGE_IDENTIFIER="@sha256:aba8eee311bd31dc3ed27bd6ac14bb6b51650b51019fc68eca749ec6c6ce9a3f"

# Refer to image using branch tag
# IMAGE_IDENTIFIER=":branch-ei-use-variant-headlines-in-test"

# Refer to image using build tag
# IMAGE_IDENTIFIER=":build-30316"

# Refer to image via the GitHub commit SHA tag
# IMAGE_IDENTIFIER=":sha-274bee90dcdc341c7387ac2f7e663f85a5bb552f"

# Set environment variables for the AWS CLI
AWS_PROFILE="<A_PROFILE_FROM_JANUS>"
AWS_DEFAULT_REGION="eu-west-1"

IMAGE_ACCOUNT_ID=$(aws ssm get-parameter --name /organisation/accounts/deployTools --query "Parameter.Value" --output text)
REGISTRY="${IMAGE_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com"
IMAGE="${REGISTRY}/guardian/dotcom-rendering${IMAGE_IDENTIFIER}"

# Login to AWS ECR https://docs.aws.amazon.com/AmazonECR/latest/userguide/registry_auth.html
aws ecr get-login-password | docker login --username AWS --password-stdin $REGISTRY

# Pull the image
docker pull $IMAGE

# Run the image. You'll likely need to set additional flags. See https://docs.docker.com/reference/cli/docker/container/run.
docker run $IMAGE

From guardian/actions-publish-image.

@emma-imber emma-imber added the run_chromatic Runs chromatic when label is applied label Aug 24, 2026
@github-actions github-actions Bot removed the run_chromatic Runs chromatic when label is applied label Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Departmental tracking: work on a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DCR: Render correct headline based on participation group

2 participants