mozilla / mozilla/experimenter
Map allowedNotificationOrigins to its BigQuery column in jexl_to_sql
@jaredlockhart is already working on this.
Since Sep 16, 2026.
- Dominant language
- Python
- Stars
- 151
- Forks
- 229
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 212
Description
allowedNotificationOrigins is listed in KNOWN_UNTRANSLATABLE in experimenter/experiments/jexl_to_sql.py, annotated # not yet recorded to the targeting context. That entry landed in #17256 as a stopgap. The attribute now has a nimbus_targeting_context column, so it should be a real column mapping instead.
Why this matters
HAS_ALLOWED_NOTIFICATIONS in experimenter/targeting/constants.py ships targeting="allowedNotificationOrigins > 0" to Desktop. Because the attribute is in KNOWN_UNTRANSLATABLE, jexl_to_sql emits a warning and drops that clause instead of translating it, so the exported predicate no longer means what the targeting config says. The per-config attribute tests accept any attribute present in KNOWN_UNTRANSLATABLE, so nothing currently flags this; CI is green and the exported SQL is silently wrong.
This is the degrade-instead-of-fail case: the entry is present, green, and drops a clause the targeting config relies on.
Field semantics
browser/components/asrouter/docs/targeting-attributes.mddeclares itnumber: the count of origins the user has allowed to send web notifications, excluding origins explicitly blocked.- The
ASRouterTargeting.Environmentgetter returnsServices.perms.getAllByTypes(["desktop-notification"])filtered toALLOW_ACTION, then.length. - Upstream
TargetingContextRecorder.sys.mjsnow records it withtypeAssertions.quantity, which asserts the value is already a number rather than deriving a count, so a plain scalar column mapping is correct. - Glean metric:
nimbus_targeting_context.allowed_notification_origins, type quantity.
The destination column metrics.quantity.nimbus_targeting_context_allowed_notification_origins exists on the Desktop nimbus_targeting_context table with type INTEGER. It is not populated yet: the attribute landed upstream in bug 2069104 and is currently Nightly-only, so the exported predicate will match nothing until that rides out to release. That is preferable to the current behaviour, where the clause is dropped from the expression entirely and the exported predicate is silently over-broad.
Proposed change
Move the attribute out of KNOWN_UNTRANSLATABLE and into JEXL_TO_BQ_COLUMN, after addressesSaved:
"allowedNotificationOrigins": (
"metrics.quantity.nimbus_targeting_context_allowed_notification_origins"
),
Plus a case in the test_attribute_translates_to_column parameterized table.
Leaving the KNOWN_UNTRANSLATABLE entry in place alongside the mapping is not an option: test_all_known_untranslatable_produce_warnings asserts every member of that set produces a warning, which a translatable attribute no longer does.
Out of scope
The matching stopgap in targeting/constants.py, annotated # Remove once the recorded targeting context manifest includes this attribute (Bug 2069104), stays for now. The in-repo features/manifests/firefox-desktop/TargetingContextRecorder.sys.mjs has not yet picked up the upstream field, so that entry is still load-bearing. It can be removed once an Update External Configs PR lands the new recorder.
Acceptance criteria
allowedNotificationOriginsmaps tometrics.quantity.nimbus_targeting_context_allowed_notification_originsand is no longer inKNOWN_UNTRANSLATABLE.- A unit test asserts the translation.
make code_format checkpasses.
The PRESERVED_TARGETING_KEYS_BY_APPLICATION entry for this attribute stays until the manifest records it, tracked by #17342.
┆Issue is synchronized with this Jira Task
Contributor 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.
Assessment
This issue has not been assessed yet.