mozilla / mozilla/experimenter

Map allowedNotificationOrigins to its BigQuery column in jexl_to_sql

Open
#17,338 0 comments 0 reactions 1 assignee View on GitHub

@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.md declares it number: the count of origins the user has allowed to send web notifications, excluding origins explicitly blocked.
  • The ASRouterTargeting.Environment getter returns Services.perms.getAllByTypes(["desktop-notification"]) filtered to ALLOW_ACTION, then .length.
  • Upstream TargetingContextRecorder.sys.mjs now records it with typeAssertions.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

  • allowedNotificationOrigins maps to metrics.quantity.nimbus_targeting_context_allowed_notification_origins and is no longer in KNOWN_UNTRANSLATABLE.
  • A unit test asserts the translation.
  • make code_format check passes.

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

Open the contributing guide

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.