Define Desktop's preserved targeting keys in Firefox instead of Experimenter?
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 20/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- javascript, python
- Domain
- backend, documentation
Research direction
Start with experimenter/targeting/constants.py (PRESERVED_TARGETING_KEYS_BY_APPLICATION) and targeting_context_parser.py, then follow how ATTRIBUTE_TRANSFORMS is imported from Firefox's TargetingContextRecorder.sys.mjs. Read test_validate_targeting_config_fields to see how allowed attributes are enforced. Done means Firefox exports the Desktop exception list, Experimenter parses it the same way, the DESKTOP entry is removed, and the docs can list all allowed attributes dynamically.
Written by the indexing model from the issue text.
Description
Experimenter decides which attributes a Desktop targeting config may use from two sources:
- The attributes Firefox records, which
targeting_context_parser.pyparses out ofATTRIBUTE_TRANSFORMSin Firefox'sTargetingContextRecorder.sys.mjs. PRESERVED_TARGETING_KEYS_BY_APPLICATION[Application.DESKTOP]inexperimenter/targeting/constants.py, for attributes that are allowed even though Firefox doesn't record them.
test_validate_targeting_config_fields fails any config that uses an attribute in neither.
In Firefox, we're documenting which attributes Nimbus recipe targeting can use (bug 2095839). We have multiple targeting contexts, but only one is documented. It makes it difficult for users to know which attributes will be available in the environment they're writing a targeting expression for. So we're adding a doc for each targeting context that has different attributes, and linking them together so it's easy to find the docs appropriate for whatever expression you're working on.
The Nimbus targeting context "inherits" many targeting attributes from ASRouterTargeting (documented in targeting-attributes.md), in addition to providing its own. So the plan is to have Sphinx import the list of "inherited" attributes from targeting-attributes.md and filter it with ATTRIBUTE_TRANSFORMS, so it stays up to date automatically, and the document structure matches the actual targeting context structure.
Otherwise, we would have to manually maintain the shared targeting attributes in two separate docs, one for message-level targeting (the one that already exists) and one for Nimbus targeting. The latter would certainly fall out of date. By filtering the attributes dynamically, the documentation for every shared attribute would automatically be drawn from the OMC doc (where these attributes are most assiduously maintained) into the Nimbus targeting doc, without including any of the attributes that are disallowed in Nimbus targeting.
But the exceptions in PRESERVED_TARGETING_KEYS_BY_APPLICATION live here on the Experimenter repo, not in the Firefox source code. So the Firefox source doc can't include them, and copying them between repos would very likely go stale. So for now, we'll have to make a note at the top of the doc mentioning that there are exceptions, linking to that list, and telling users to search targeting-attributes.md for any excepted attributes. That's better than docs falling out of sync, but it makes it more difficult to see at a glance what's available to you.
Proposal: move the Desktop exceptions into Firefox, e.g. as an exported list next to ATTRIBUTE_TRANSFORMS in TargetingContextRecorder.sys.mjs. Experimenter would then parse them the same way it parses ATTRIBUTE_TRANSFORMS, and the DESKTOP entry would go away from PRESERVED_TARGETING_KEYS_BY_APPLICATION. Firefox would then be the single source of truth for which attributes Desktop targeting can use, and the docs could list all of them dynamically.
The Desktop exceptions today are defaultProfile, newtabAddonVersion, newtabSettings, userId, searchEngines, isBackgroundTaskMode, isNonStubFirstRun, localeLanguageCode, attachedFxAOAuthClients and isFxASignedInMozilla.
Doing it this way seemed ideal, because Sphinx is not really capable of importing remote data like that, whereas Experimenter is already importing the TargetingContextRecorder stuff from Firefox source for essentially the same purpose. So adding one more fx source import didn't seem like it would be too drastic a step. But is there any reason the exceptions would have to live in the Experimenter repo, or can we move them?
┆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
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mozilla/experimenter
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
mozilla/experimenter#18288 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mozilla/experimenter#18281 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
mozilla/experimenter#18132 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
mozilla/experimenter#18079 ·
Maintainers usually reply within 1 day
-
Targeting version check uses whichever version was cached first: `TargetingContextFields.for_application` ignores versionMay be free again @user-Param claimed this 21 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mozilla/experimenter#17974 · 1 comment ·
Maintainers usually reply within 1 day
All issues in mozilla/experimenter
Similar issues
-
eegprep-lean: set channel types from the Zarr group's channel_typePossibly taken @claude claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
sccn/eegprep#668 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
blacklanternsecurity/bbot#3679 ·
Maintainers usually reply within 2 days
-
Link Checker ReportOpenBot Type: Bug Type: Documentation
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
speakeasy-api/speakeasy#2159 ·
Maintainers usually reply within 1 day