-
Notifications
You must be signed in to change notification settings - Fork 220
Open
Description
When a user creates an experiment, they select an application, a version range (min/max), and a targeting config. We should validate that the JEXL targeting expression only references targeting context fields that exist within the selected version range, similar to how we validate feature configs against versioned feature definitions.
Follow the pattern of feature config version-range validation:
- NimbusFeatureConfig.get_versioned_schema_range() queries versioned schemas between min/max version
- _validate_feature_configs() in NimbusReviewSerializer checks feature compatibility within the version range
- Unsupported versions produce errors or warnings depending on warn_feature_schema
For targeting configs:
- Use the versioned targeting context files fetched by the manifesttool (ticket 1) and parsed by the targeting context parser (ticket 2)
- When an experiment is submitted for review, extract the identifiers from the targeting config's JEXL expression
- For the selected application and version range, check that all referenced fields exist in the targeting context for every version in the range
- If a field exists in some versions but not others, report which versions are unsupported (similar to ERROR_FEATURE_CONFIG_UNSUPPORTED_IN_VERSIONS)
- Respect the warn_feature_schema flag for error vs warning behavior
Key files to reference:
- Serializer validation: experiments/api/v5/serializers.py (_validate_feature_configs, _validate_feature_value)
- Version range query: experiments/models.py (get_versioned_schema_range, schemas_between_versions)
- Constants: experiments/constants.py (MIN_VERSIONED_FEATURE_VERSION, error messages)
Acceptance Criteria:
- When an experiment is submitted for review, the targeting config JEXL is validated against the targeting context fields available in the selected version range
- If a targeting field is missing in some versions within the range, an error (or warning) identifies the unsupported versions
- If a targeting field is missing in all versions within the range, an error (or warning) reports the field is unsupported in the range
- Validation respects the existing warn_feature_schema flag
- Existing tests are extended or new tests cover version-range targeting validation
┆Issue is synchronized with this Jira Task
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels