Open Bug 2095839 Opened 3 days ago Updated 17 hours ago

Document each targeting environment and how they build on each other

Categories

(Firefox :: Messaging System, enhancement, P1)

enhancement
Points:
3

Tracking

()

ASSIGNED

People

(Reporter: aminomancer, Assigned: aminomancer)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

(Whiteboard: [OMC_KTLO] [omc])

Targeting expressions are evaluated against several environments layered on top of each other, but the docs only describe one of them. targeting-attributes.md covers the attributes implemented by ASRouterTargeting.Environment, plus a few that only exist in other environments.

The environments are:

  • TargetingEnvironment in Targeting.sys.mjs (locale, localeLanguageCode, region, userId, version, channel, platform, os), which is part of every targeting context. It has no docs of its own.
  • ASRouter's attributes, documented in targeting-attributes.md.
  • Nimbus's attributes from ExperimentManager.createTargetingContext() (isFirstStartup, activeExperiments, enrollmentsMap and so on), which only recipe targeting can use. Some of these are documented in targeting-attributes.md, which suggests messages can use them. They can't, so this forces us to add a warning above those attributes.
  • Trigger context, documented per trigger in TriggerActionSchemas/index.md.
  • Remote Settings filter_expressions, which see ClientEnvironmentBase as env.*. These have no docs.

Proposal:

  • Give each environment its own doc, next to the code that implements it.
  • Have each doc include the docs of the environments it builds on, using MyST {include} with :start-after: / :end-before: markers and :heading-offset:, so the docs are structured the same way the environments are combined.
  • Start each doc with a short section explaining where that environment is used, with links to the others. In particular, explain that a messaging experiment or rollout involves two kinds of targeting: the recipe's advanced targeting, which is evaluated against the Nimbus environment and decides enrollment for the recipe, and each payload message's targeting, which ASRouter evaluates with the context of the trigger that fired, combined with the ASRouterTargeting environment.
  • In the Nimbus docs, note that recipes may only use attributes recorded by TargetingContextRecorder, plus the keys Experimenter allows as exceptions. Those exceptions unfortunately live on the experimenter repo, so the firefox-source-docs can't dynamically fetch them. We might be able to move them into the firefox tree though. I'll look into that. For the time being, we can just add a note that any attributes included in the exceptions list (link to the list) are also allowed, and then link to targeting-attributes.md to find those attributes, since we won't be able to embed them directly in the page.
  • Move the Nimbus-only attributes out of targeting-attributes.md, and update TargetingDocs.test.js accordingly.

Included docs need root-relative links, because relative links in included text resolve against the including page.

Points: --- → 3
Priority: -- → P1
Whiteboard: [OMC_KTLO] [omc]
You need to log in before you can comment on or make changes to this bug.