Skip to content

Parse targeting context source files to extract field names #14923

@data-sync-user

Description

@data-sync-user

Write a parser class that extracts valid targeting context field names from each platform's stored source file, with version awareness.

Following the pattern of experimenter/outcomes/init.py (lazy-loading class with caching), create a class in experimenter/targeting/ that:

  • Reads each platform's targeting context file from the local manifests path (configured in settings.py, pointing into features/manifests//)
  • Extracts field names using regex or simple string parsing:
  • Desktop (JS): Keys from the ATTRIBUTE_TRANSFORMS object (camelCase: activeExperiments, addressesSaved, etc.)
  • Android (Kotlin): Field names from RecordedNimbusContext (snake_case: app_version, is_first_run, etc.)
  • iOS (Swift): Dictionary keys from the context dictionary (snake_case: is_first_run, region, etc.)
  • Supports versioned lookup: TargetingContextFields.for_application(app, version=None) — defaults to latest (unversioned) if no version specified
  • Caches results like Outcomes._outcomes

Acceptance Criteria:

  • A parser class exists that extracts field names for each of the three platforms
  • Field lists are accessible per application, optionally per version
  • Parsers are tested with the current upstream file contents
  • Parsers handle minor formatting changes (whitespace, comments) gracefully

┆Issue is synchronized with this Jira Task

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions