Skip to content

[AIMOD-1432] Propagate variant id to content items - #1699

Open
mlplyler wants to merge 6 commits into
mainfrom
variant_id
Open

[AIMOD-1432] Propagate variant id to content items#1699
mlplyler wants to merge 6 commits into
mainfrom
variant_id

Conversation

@mlplyler

@mlplyler mlplyler commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

References

JIRA: AIMOD-1432

Description

Section ExerimentVariantId is now VariantId. VariantId currently handles the base, ml-experiment, and editorial section variants. This variant field is propagated through the sections and to the articles sent to the client. The items in Popular Today have the variant_id from the section the item was sampled from.

The original front-end ticket just mentions variant-id. https://mozilla-hub.atlassian.net/browse/HNT-2716
We should also consider passing through source_section_id. This would give us the full picture of what section caused an impression.

PR Review Checklist

Put an x in the boxes that apply

  • [x ] This PR conforms to the Contribution Guidelines
  • [x ] The PR title starts with the JIRA issue reference, format example [DISCO-####], and has the same title (if applicable)
  • [load test: (abort|skip|warn)] keywords are applied to the last commit message (if applicable)
  • Documentation has been updated (if applicable)
  • Metric documentation has been updated (if applicable)
  • Functional and performance test coverage has been expanded and maintained (if applicable)

┆Issue is synchronized with this Jira Task

@mlplyler
mlplyler requested a review from rolf-moz July 28, 2026 17:02

def parse_section_external_id(raw_external_id: str) -> tuple[str, int]:

def parse_section_variant(raw_external_id: str, source: str) -> tuple[str, int]:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@rolf-moz

This function returns 0/1/5050. Ideally I would know the exact source section for an article in Popular Today. For example, an article could be sampled from Politics or Headlines. I want to know which one is showing up more in Popular Today.

I could make variantId a string. I could then have variantId be:
$section_id-$source-$experiment-name

government-ml-exp5050
or
government-ml-base
or
photojournalism-editorial-base

@mlplyler mlplyler Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

An alternative is to add two fields to the telemetry: variant_id and source_section.

Edit: ok the latest commit has that as well.

@mlplyler

Copy link
Copy Markdown
Contributor Author

Don't send source section unless Popular Today, the FE should deduce otherwise.
Variant should section be level unless Popular Today.

Preference is to have source section and variant as separate fields. Don't worry about mapping source section to integer.

Do analysis for BQ etc cost of these new fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant