fix(schemas): Allow firefoxLabsTitle and firefoxLabsDescription to be null in json schema (#11750)

Because

- Json schemas were incorrectly failing validation on `firefoxLabsTitle`
and `firefoxLabsDescription` fields. We need to allow them to be `null`
(omitted).

This commit

- Updates `DesktopNimbusExperiment` and `DesktopNimbusExperiment`
classes' fields mentioned above.
- Updates schema version.
- Generates new TS schema.
- Adds new test (fixture) for this use case.

Fixes #11749
This commit is contained in:
Herraj Luhano 2024-11-12 14:42:20 -05:00 коммит произвёл GitHub
Родитель d2dfb06d50
Коммит 902e80c57d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
9 изменённых файлов: 151 добавлений и 52 удалений

Просмотреть файл

@ -1 +1 @@
2024.11.4
2024.11.5

12
schemas/index.d.ts поставляемый
Просмотреть файл

@ -162,11 +162,11 @@ export interface DesktopAllVersionsNimbusExperiment {
/**
* An optional string containing the Fluent ID for the title of the opt-in
*/
firefoxLabsTitle?: string;
firefoxLabsTitle?: string | null;
/**
* An optional string containing the Fluent ID for the description of the opt-in
*/
firefoxLabsDescription?: string;
firefoxLabsDescription?: string | null;
/**
* Opt out of feature schema validation.
*/
@ -228,7 +228,7 @@ export interface DesktopAllVersionsExperimentBranch {
/**
* An optional string containing the title of the branch
*/
firefoxLabsTitle?: string;
firefoxLabsTitle?: string | null;
feature: DesktopPre95FeatureConfig;
}
export interface ExperimentFeatureConfig {
@ -493,11 +493,11 @@ export interface DesktopNimbusExperiment {
/**
* An optional string containing the Fluent ID for the title of the opt-in
*/
firefoxLabsTitle?: string;
firefoxLabsTitle?: string | null;
/**
* An optional string containing the Fluent ID for the description of the opt-in
*/
firefoxLabsDescription?: string;
firefoxLabsDescription?: string | null;
/**
* Opt out of feature schema validation.
*/
@ -525,7 +525,7 @@ export interface DesktopExperimentBranch {
/**
* An optional string containing the title of the branch
*/
firefoxLabsTitle?: string;
firefoxLabsTitle?: string | null;
}
/**
* The SDK-specific feature manifest.

Просмотреть файл

@ -79,7 +79,7 @@ class DesktopExperimentBranch(BaseExperimentBranch):
# Firefox Desktop-specific fields should be added to *this* schema. They will be
# inherited by the stricter DesktopAllVersionsExperimentBranch schema.
firefoxLabsTitle: str | SkipJsonSchema[None] = Field(
firefoxLabsTitle: str | None = Field(
description="An optional string containing the title of the branch", default=None
)
@ -289,12 +289,12 @@ class DesktopNimbusExperiment(BaseExperiment):
),
default=None,
)
firefoxLabsTitle: str | SkipJsonSchema[None] = Field(
firefoxLabsTitle: str | None = Field(
description="An optional string containing the Fluent ID "
"for the title of the opt-in",
default=None,
)
firefoxLabsDescription: str | SkipJsonSchema[None] = Field(
firefoxLabsDescription: str | None = Field(
description="An optional string containing the Fluent ID "
"for the description of the opt-in",
default=None,

Просмотреть файл

@ -0,0 +1,85 @@
{
"appId": "firefox-desktop",
"appName": "firefox_desktop",
"application": "firefox-desktop",
"arguments": {},
"branches": [
{
"feature": {
"featureId": "this-is-included-for-desktop-pre-95-support",
"enabled": false,
"value": {}
},
"features": [
{
"featureId": "pocketNewtab",
"value": { "enabled": "true" }
},
{
"featureId": "upgradeDialog",
"value": {
"enabled": false
}
}
],
"ratio": 1,
"slug": "control",
"firefoxLabsTitle": null
},
{
"feature": {
"featureId": "this-is-included-for-desktop-pre-95-support",
"enabled": false,
"value": {}
},
"features": [
{
"featureId": "pocketNewtab",
"value": {
"enabled": true,
"compactLayout": true,
"lastCardMessageEnabled": true,
"loadMore": true,
"newFooterSection": true
}
},
{
"featureId": "upgradeDialog",
"value": {
"enabled": true
}
}
],
"ratio": 1,
"slug": "treatment",
"firefoxLabsTitle": null
}
],
"bucketConfig": {
"count": 10000,
"namespace": "firefox-desktop-multifeature-test",
"randomizationUnit": "normandy_id",
"start": 0,
"total": 10000
},
"channel": "nightly",
"endDate": null,
"featureIds": ["upgradeDialog", "pocketNewtab"],
"id": "mr2-upgrade-spotlight-holdback",
"isEnrollmentPaused": false,
"outcomes": [],
"probeSets": [],
"proposedDuration": 63,
"proposedEnrollment": 7,
"referenceBranch": "control",
"schemaVersion": "1.7.1",
"slug": "firefox-desktop-multifeature-test",
"startDate": "2021-10-26",
"targeting": "true",
"userFacingDescription": "Experimenting on onboarding content when you upgrade Firefox.",
"userFacingName": "MR2 Upgrade Spotlight Holdback",
"isFirefoxLabsOptIn": false,
"firefoxLabsTitle": null,
"firefoxLabsDescription": null,
"isRollout": false
}

Просмотреть файл

@ -25,34 +25,6 @@
],
"ratio": 1,
"slug": "control"
},
{
"firefoxLabsTitle": "branch-one-fx-labs_title",
"feature": {
"featureId": "this-is-included-for-desktop-pre-95-support",
"enabled": false,
"value": {}
},
"features": [
{
"featureId": "pocketNewtab",
"value": {
"enabled": true,
"compactLayout": true,
"lastCardMessageEnabled": true,
"loadMore": true,
"newFooterSection": true
}
},
{
"featureId": "upgradeDialog",
"value": {
"enabled": true
}
}
],
"ratio": 1,
"slug": "treatment"
}
],
"bucketConfig": {

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "@mozilla/nimbus-schemas",
"version": "2024.11.4",
"version": "2024.11.5",
"description": "Schemas used by Mozilla Nimbus and related projects.",
"main": "index.d.ts",
"repository": {

Просмотреть файл

@ -1,6 +1,6 @@
[tool.poetry]
name = "mozilla-nimbus-schemas"
version = "2024.11.4"
version = "2024.11.5"
description = "Schemas used by Mozilla Nimbus and related projects."
authors = ["mikewilli"]
license = "MPL 2.0"

Просмотреть файл

@ -166,12 +166,26 @@
"type": "boolean"
},
"firefoxLabsTitle": {
"description": "An optional string containing the Fluent ID for the title of the opt-in",
"type": "string"
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "An optional string containing the Fluent ID for the title of the opt-in"
},
"firefoxLabsDescription": {
"description": "An optional string containing the Fluent ID for the description of the opt-in",
"type": "string"
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "An optional string containing the Fluent ID for the description of the opt-in"
},
"featureValidationOptOut": {
"description": "Opt out of feature schema validation.",
@ -271,8 +285,15 @@
"type": "array"
},
"firefoxLabsTitle": {
"description": "An optional string containing the title of the branch",
"type": "string"
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "An optional string containing the title of the branch"
},
"feature": {
"$ref": "#/$defs/DesktopPre95FeatureConfig",

Просмотреть файл

@ -166,12 +166,26 @@
"type": "boolean"
},
"firefoxLabsTitle": {
"description": "An optional string containing the Fluent ID for the title of the opt-in",
"type": "string"
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "An optional string containing the Fluent ID for the title of the opt-in"
},
"firefoxLabsDescription": {
"description": "An optional string containing the Fluent ID for the description of the opt-in",
"type": "string"
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "An optional string containing the Fluent ID for the description of the opt-in"
},
"featureValidationOptOut": {
"description": "Opt out of feature schema validation.",
@ -271,8 +285,15 @@
"type": "array"
},
"firefoxLabsTitle": {
"description": "An optional string containing the title of the branch",
"type": "string"
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "An optional string containing the title of the branch"
}
},
"required": [