Targeting version check uses whichever version was cached first: `TargetingContextFields.for_application` ignores version

Open Beginner friendly
#17,974 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@user-Param is already working on this.

Since Nov 1, 2026.

  • #18035 by @user-Param — closed without merging

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
django, python
Domain
backend, testing

Research direction

Start in experimenter/targeting/targeting_context_parser.py and inspect TargetingContextFields.for_application and its per-application cache; then trace how _validate_targeting_configs checks version ranges. Reproduce with the described Fx158–160 targeting configuration and verify the result is independent of which version is loaded first, including a warning for unsupported profileLastUse in older versions.

Written by the indexing model from the issue text.

Description

Summary

NimbusReviewSerializer._validate_targeting_configs is supposed to flag targeting attributes that aren't available in some of the Firefox versions an experiment targets ("In versions […]: Targeting field X is not supported"). In practice it never flags older versions.

Steps to reproduce
  1. Add a Desktop advanced-targeting config that uses an attribute only recorded from Fx160+, e.g.:
targeting=(
    f"{NO_ENTERPRISE.targeting} && profileLastUse > 0 && "
    "(currentDate|date - profileLastUse|date) / 86400000 >= 28"
)
  1. Create a Desktop experiment with min version 158, no max version, and that targeting. Leave "Warn only on feature schema validation failure" unchecked.
  2. Open the experiment's Summary page. You should be able to launch with no warnings.
  3. Change the max version to 160 and navigate to the experiment's summary page again. There should be no warnings.
  4. Close the old local build and make up a new build.
  5. Repeat step 3 but with max version 160. Leave "Warn only on feature schema validation failure" unchecked.
  6. There should be a warning now.
Expected

A review error, because profileLastUse isn't in features/manifests/firefox-desktop/v158.0.x/ or v159.0.x/TargetingContextRecorder.sys.mjs (it first appears in v160.0.0): In versions ['159.0.1', '159.0.0', '158.0.2', '158.0.1', '158.0.0']: Targeting field profileLastUse is not supported

Actual

The result depends on which version was loaded first since the server process started:

  • Start with Min 158, no max: no error or warning. Debug output from the version loop shows profileLastUse reported as present for every version from v161.0.0 down to v158.0.0. Even after changing max version to 158, it still shows no error or warning.

  • Start with min 158, max 158: it shows error with 158. After updating the max version to no version, it shows errors with all versions.

[Image]

[Image]

Likely Cause

I believe that TargetingContextFields.for_application(app, version) in experimenter/targeting/targeting_context_parser.py caches the parsed fields per application only (_desktop_targeting_fields) and returns them for any version.

Since nothing clears the cache at runtime, so the first version loaded in a server process is reused for every later check in that process. _validate_targeting_configs checks versions newest-first, so multi-version ranges usually compare every version against the newest version's fields I believe.

┆Issue is synchronized with this Jira Task

Dominant language
Python
Stars
152
Forks
231
Avg merge
23h 54m
Merged PRs (30d)
201

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mozilla/experimenter

All issues in mozilla/experimenter

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.