fix #9359 feat(schemas): add experiment schema to nimbus schemas (#9361)

Because

* We now have the mozilla-nimbus-schemas package for storing all Nimbus
related schemas
* We should add the experiment schema there and update all components to
use it

This commit

* Adds the Nimbus experiment schema to the nimbus schemas package
* Adds all existing test fixtures from shared
This commit is contained in:
Jared Lockhart 2023-09-06 13:30:08 -04:00 коммит произвёл GitHub
Родитель d2677d353a
Коммит 7a40728d8b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
21 изменённых файлов: 982 добавлений и 9 удалений

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

@ -292,7 +292,7 @@ schemas_test:
(cd schemas && poetry run pytest)
schemas_check: schemas_install schemas_black schemas_ruff schemas_test
(cd schemas && poetry run pydantic2ts --module mozilla_nimbus_schemas.jetstream --output /tmp/test_index.d.ts --json2ts-cmd "yarn json2ts")
(cd schemas && poetry run pydantic2ts --module mozilla_nimbus_schemas.__init__ --output /tmp/test_index.d.ts --json2ts-cmd "yarn json2ts")
diff /tmp/test_index.d.ts schemas/index.d.ts || (echo nimbus-schemas typescript package is out of sync please run make schemas_build;exit 1)
echo "Done. No problems found in schemas."
@ -308,7 +308,7 @@ schemas_deploy_pypi: schemas_install schemas_build_pypi
cd schemas; poetry run twine upload --skip-existing dist/*;
schemas_build_npm: schemas_install
(cd schemas && poetry run pydantic2ts --module mozilla_nimbus_schemas.jetstream --output ./index.d.ts --json2ts-cmd "yarn json2ts")
(cd schemas && poetry run pydantic2ts --module mozilla_nimbus_schemas.__init__ --output ./index.d.ts --json2ts-cmd "yarn json2ts")
schemas_deploy_npm: schemas_build_npm
cd schemas; yarn publish --new-version ${SCHEMAS_VERSION} --access public;

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

@ -1 +1 @@
2023.9.1
2023.9.2

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

@ -60,6 +60,72 @@ export interface Outcome {
metrics: string[];
slug: string;
}
export interface NimbusExperiment {
schemaVersion: string;
slug: string;
id: string;
appName: string;
appId: string;
channel: string;
userFacingName: string;
userFacingDescription: string;
isEnrollmentPaused: boolean;
isRollout?: boolean;
bucketConfig: ExperimentBucketConfig;
outcomes?: ExperimentOutcome[];
featureIds: string[];
branches: (
| ExperimentSingleFeatureBranch
| ExperimentMultiFeatureDesktopBranch
| ExperimentMultiFeatureMobileBranch
)[];
targeting?: string;
startDate?: string;
enrollmentEndDate?: string;
endDate?: string;
proposedDuration?: number;
proposedEnrollment?: number;
referenceBranch?: string;
featureValidationOptOut?: boolean;
localizations?: {
[k: string]: unknown;
};
locales?: string[];
}
export interface ExperimentBucketConfig {
randomizationUnit: string;
namespace: string;
start: number;
count: number;
total: number;
}
export interface ExperimentOutcome {
slug: string;
priority: string;
}
export interface ExperimentSingleFeatureBranch {
slug: string;
ratio: number;
feature: ExperimentFeatureConfig;
}
export interface ExperimentFeatureConfig {
featureId: string;
enabled?: boolean;
value: {
[k: string]: unknown;
};
}
export interface ExperimentMultiFeatureDesktopBranch {
slug: string;
ratio: number;
feature: ExperimentFeatureConfig;
features: ExperimentFeatureConfig[];
}
export interface ExperimentMultiFeatureMobileBranch {
slug: string;
ratio: number;
features: ExperimentFeatureConfig[];
}
/**
* `extra=Extra.allow` is needed for the pydantic2ts generation of
* typescript definitions. Without this, models with only a custom

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

@ -0,0 +1,2 @@
from mozilla_nimbus_schemas.experiments import *
from mozilla_nimbus_schemas.jetstream import *

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

@ -0,0 +1,3 @@
from .experiments import NimbusExperiment
__all__ = ["NimbusExperiment"]

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

@ -0,0 +1,74 @@
from typing import List, Optional, Union
from pydantic import BaseModel
class ExperimentBucketConfig(BaseModel):
randomizationUnit: str
namespace: str
start: int
count: int
total: int
class ExperimentOutcome(BaseModel):
slug: str
priority: str
class ExperimentFeatureConfig(BaseModel):
featureId: str
enabled: Optional[bool]
value: dict
class ExperimentSingleFeatureBranch(BaseModel):
slug: str
ratio: int
feature: ExperimentFeatureConfig
class ExperimentMultiFeatureDesktopBranch(BaseModel):
slug: str
ratio: int
feature: ExperimentFeatureConfig
features: List[ExperimentFeatureConfig]
class ExperimentMultiFeatureMobileBranch(BaseModel):
slug: str
ratio: int
features: List[ExperimentFeatureConfig]
class NimbusExperiment(BaseModel):
schemaVersion: str
slug: str
id: str
appName: str
appId: str
channel: str
userFacingName: str
userFacingDescription: str
isEnrollmentPaused: bool
isRollout: Optional[bool]
bucketConfig: ExperimentBucketConfig
outcomes: Optional[List[ExperimentOutcome]]
featureIds: List[str]
branches: List[
Union[
ExperimentSingleFeatureBranch,
ExperimentMultiFeatureDesktopBranch,
ExperimentMultiFeatureMobileBranch,
]
]
targeting: Optional[str]
startDate: Optional[str]
enrollmentEndDate: Optional[str]
endDate: Optional[str]
proposedDuration: Optional[int]
proposedEnrollment: Optional[int]
referenceBranch: Optional[str]
featureValidationOptOut: Optional[bool]
localizations: Optional[dict]
locales: Optional[List[str]]

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

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

@ -0,0 +1,84 @@
{
"appId": "org.mozilla.firefox",
"appName": "fenix",
"application": "org.mozilla.fenix",
"arguments": {},
"branches": [
{
"features": [
{
"enabled": false,
"featureId": "fenix-default-browser",
"value": {}
},
{
"enabled": true,
"featureId": "homescreen",
"value": {
"sections-enabled": {
"jumpBackIn": false,
"pocket": false,
"recentExplorations": false,
"recentlySaved": false,
"topSites": true
}
}
}
],
"ratio": 1,
"slug": "control"
},
{
"features": [
{
"enabled": true,
"featureId": "fenix-default-browser",
"value": {}
},
{
"enabled": true,
"featureId": "homescreen",
"value": {
"sections-enabled": {
"jumpBackIn": true,
"pocket": true,
"recentExplorations": true,
"recentlySaved": true,
"topSites": true
}
}
}
],
"ratio": 1,
"slug": "default_browser_newtab_banner"
}
],
"bucketConfig": {
"count": 10000,
"namespace": "firefox-android-multifeature-test",
"randomizationUnit": "nimbus_id",
"start": 0,
"total": 10000
},
"channel": "nightly",
"endDate": null,
"featureIds": ["fenix-default-browser", "homescreen"],
"id": "firefox-android-multifeature-test",
"isEnrollmentPaused": false,
"outcomes": [
{
"priority": "secondary",
"slug": "default-browser"
}
],
"probeSets": [],
"proposedDuration": 28,
"proposedEnrollment": 7,
"referenceBranch": "control",
"schemaVersion": "1.6.2",
"slug": "firefox-android-multifeature-test",
"startDate": "2021-11-01",
"targeting": "true",
"userFacingDescription": "firefox-android-multifeature-test",
"userFacingName": "firefox-android-multifeature-test"
}

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

@ -0,0 +1,80 @@
{
"appId": "firefox-desktop",
"appName": "firefox_desktop",
"application": "firefox-desktop",
"arguments": {},
"branches": [
{
"feature": {
"featureId": "unused-feature-id-for-legacy-support",
"enabled": false,
"value": {}
},
"features": [
{
"featureId": "pocketNewtab",
"value": { "enabled": "true" }
},
{
"featureId": "upgradeDialog",
"value": {
"enabled": false
}
}
],
"ratio": 1,
"slug": "control"
},
{
"feature": {
"featureId": "unused-feature-id-for-legacy-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": {
"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",
"featureValidationOptOut": true
}

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

@ -0,0 +1,87 @@
{
"appId": "firefox-desktop",
"appName": "firefox_desktop",
"application": "firefox-desktop",
"arguments": {},
"branches": [
{
"feature": {
"featureId": "unused-feature-id-for-legacy-support",
"enabled": false,
"value": {}
},
"features": [
{
"featureId": "nimbus-qa-1",
"value": {
"value": {
"$l10n": {
"id": "control-text",
"text": "English text",
"comment": "Text for the control branch."
}
}
}
}
],
"ratio": 1,
"slug": "control"
},
{
"feature": {
"featureId": "unused-feature-id-for-legacy-support",
"enabled": false,
"value": {}
},
"features": [
{
"featureId": "nimbus-qa-1",
"value": {
"value": {
"$l10n": {
"id": "treatment-text",
"text": "More English text",
"comment": "Text for the treatment branch."
}
}
}
}
],
"ratio": 1,
"slug": "treatment"
}
],
"bucketConfig": {
"count": 10000,
"namespace": "firefox-desktop-localization-test",
"randomizationUnit": "normandy_id",
"start": 0,
"total": 10000
},
"channel": "nightly",
"endDate": null,
"featureIds": ["nimbus-qa-1"],
"id": "firefox-desktop-localization-test",
"isEnrollmentPaused": false,
"outcomes": [],
"probeSets": [],
"proposedDuration": 63,
"proposedEnrollment": 7,
"referenceBranch": "control",
"schemaVersion": "1.7.1",
"slug": "firefox-desktop-localization-test",
"startDate": "2021-10-26",
"targeting": "true",
"userFacingDescription": "Test data for a localized experiment",
"userFacingName": "MR2 Upgrade Spotlight Holdback",
"localizations": {
"en-US": {
"control-text": "English text",
"treatment-test": "More English text"
},
"fr": {
"control-text": "Texte en français",
"treatment-text": "Plus de texte en français"
}
}
}

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

@ -0,0 +1,88 @@
{
"appId": "firefox-desktop",
"appName": "firefox_desktop",
"application": "firefox-desktop",
"arguments": {},
"branches": [
{
"feature": {
"featureId": "unused-feature-id-for-legacy-support",
"enabled": false,
"value": {}
},
"features": [
{
"featureId": "nimbus-qa-1",
"value": {
"value": {
"$l10n": {
"id": "control-text",
"text": "English text",
"comment": "Text for the control branch."
}
}
}
}
],
"ratio": 1,
"slug": "control"
},
{
"feature": {
"featureId": "unused-feature-id-for-legacy-support",
"enabled": false,
"value": {}
},
"features": [
{
"featureId": "nimbus-qa-1",
"value": {
"value": {
"$l10n": {
"id": "treatment-text",
"text": "More English text",
"comment": "Text for the treatment branch."
}
}
}
}
],
"ratio": 1,
"slug": "treatment"
}
],
"bucketConfig": {
"count": 10000,
"namespace": "firefox-desktop-localization-test",
"randomizationUnit": "normandy_id",
"start": 0,
"total": 10000
},
"channel": "nightly",
"endDate": null,
"featureIds": ["nimbus-qa-1"],
"id": "firefox-desktop-localization-test",
"isEnrollmentPaused": false,
"outcomes": [],
"probeSets": [],
"proposedDuration": 63,
"proposedEnrollment": 7,
"referenceBranch": "control",
"schemaVersion": "1.7.1",
"slug": "firefox-desktop-localization-test",
"startDate": "2021-10-26",
"targeting": "true",
"userFacingDescription": "Test data for a localized experiment",
"userFacingName": "MR2 Upgrade Spotlight Holdback",
"localizations": {
"en-US": {
"control-text": "English text",
"treatment-test": "More English text"
},
"fr": {
"control-text": "Texte en français",
"treatment-text": "Plus de texte en français"
}
},
"locales": ["en-US", "fr"]
}

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

@ -0,0 +1,84 @@
{
"appId": "firefox-desktop",
"appName": "firefox_desktop",
"application": "firefox-desktop",
"arguments": {},
"branches": [
{
"feature": {
"enabled": true,
"featureId": "privatebrowsing",
"value": {
"promoLinkUrl": "https://vpn.mozilla.org/?utm_campaign=private-browsing-vpn-link&entrypoint_experiment=firefox-vpn-test-1629&entrypoint_variation=control"
}
},
"ratio": 1,
"slug": "control"
},
{
"feature": {
"enabled": true,
"featureId": "privatebrowsing",
"value": {
"infoBody": "Firefox clears your search and browsing history when you close all private windows, but this doesn't make you anonymous.",
"infoLinkText": "Learn more",
"infoTitle": "Youre in a private window",
"infoTitleEnabled": true,
"promoHeader": "Hide your activity and location, everywhere you browse",
"promoLinkText": "Stay private with Mozilla VPN",
"promoLinkType": "button",
"promoLinkUrl": "https://vpn.mozilla.org/?utm_campaign=private-browsing-vpn-link&entrypoint_experiment=firefox-vpn-test-1629&entrypoint_variation=var1",
"promoSectionStyle": "bottom",
"promoTitleEnabled": false
}
},
"ratio": 1,
"slug": "var1"
},
{
"feature": {
"enabled": true,
"featureId": "privatebrowsing",
"value": {
"infoBody": "Private window: Firefox clears your search and browsing history when you close all private windows. This doesnt make you anonymous.",
"infoLinkText": "Learn more",
"infoTitle": "Youre in a private window",
"infoTitleEnabled": false,
"promoHeader": "Get privacy protection everywhere you browse",
"promoImageLarge": "chrome://browser/content/assets/moz-vpn.svg",
"promoLinkText": "Stay private with Mozilla VPN",
"promoLinkType": "button",
"promoLinkUrl": "https://vpn.mozilla.org/?utm_campaign=private-browsing-vpn-link&entrypoint_experiment=firefox-vpn-test-1629&entrypoint_variation=var2",
"promoSectionStyle": "below-search",
"promoTitle": "Hide browsing activity and location with Mozillas VPN. One tap creates a secure connection, even on public Wi-FI.",
"promoTitleEnabled": true
}
},
"ratio": 1,
"slug": "var2"
}
],
"bucketConfig": {
"count": 100,
"namespace": "privatebrowsing-1",
"randomizationUnit": "normandy_id",
"start": 2000,
"total": 10000
},
"channel": "release",
"endDate": null,
"featureIds": ["privatebrowsing"],
"id": "firefox-vpn-test-1629",
"isEnrollmentPaused": true,
"outcomes": [],
"probeSets": [],
"proposedDuration": 45,
"proposedEnrollment": 7,
"referenceBranch": "control",
"schemaVersion": "1.5.0",
"slug": "firefox-vpn-test-1629",
"startDate": "2021-07-27",
"targeting": "browserSettings.update.channel == \"release\" && version|versionCompare('90.!') >= 0 && 'app.shield.optoutstudies.enabled'|preferenceValue && !hasActiveEnterprisePolicies && locale in ['en-CA', 'en-GB', 'en-US'] && region in ['US']",
"userFacingDescription": "Testing out the private browsing page with different images and copy.",
"userFacingName": "firefox vpn test 1629"
}

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

@ -0,0 +1,102 @@
{
"appId": "firefox-desktop",
"appName": "firefox_desktop",
"branches": [
{
"feature": {
"featureId": "privatebrowsing",
"value": {
"promoLinkUrl": "https://vpn.mozilla.org/?utm_campaign=private-browsing-vpn-link&entrypoint_experiment=firefox-vpn-test-1629&entrypoint_variation=control"
}
},
"features": [
{
"featureId": "privatebrowsing",
"value": {
"promoLinkUrl": "https://vpn.mozilla.org/?utm_campaign=private-browsing-vpn-link&entrypoint_experiment=firefox-vpn-test-1629&entrypoint_variation=control"
}
}
],
"ratio": 1,
"slug": "control"
},
{
"feature": {
"featureId": "privatebrowsing",
"value": {
"promoLinkUrl": "https://vpn.mozilla.org/?utm_campaign=private-browsing-vpn-link&entrypoint_experiment=firefox-vpn-test-1629&entrypoint_variation=control"
}
},
"features": [
{
"featureId": "privatebrowsing",
"value": {
"infoBody": "Firefox clears your search and browsing history when you close all private windows, but this doesn't make you anonymous.",
"infoLinkText": "Learn more",
"infoTitle": "Youre in a private window",
"infoTitleEnabled": true,
"promoHeader": "Hide your activity and location, everywhere you browse",
"promoLinkText": "Stay private with Mozilla VPN",
"promoLinkType": "button",
"promoLinkUrl": "https://vpn.mozilla.org/?utm_campaign=private-browsing-vpn-link&entrypoint_experiment=firefox-vpn-test-1629&entrypoint_variation=var1",
"promoSectionStyle": "bottom",
"promoTitleEnabled": false
}
}
],
"ratio": 1,
"slug": "var1"
},
{
"feature": {
"featureId": "privatebrowsing",
"value": {
"promoLinkUrl": "https://vpn.mozilla.org/?utm_campaign=private-browsing-vpn-link&entrypoint_experiment=firefox-vpn-test-1629&entrypoint_variation=control"
}
},
"features": [
{
"featureId": "privatebrowsing",
"value": {
"infoBody": "Private window: Firefox clears your search and browsing history when you close all private windows. This doesnt make you anonymous.",
"infoLinkText": "Learn more",
"infoTitle": "Youre in a private window",
"infoTitleEnabled": false,
"promoHeader": "Get privacy protection everywhere you browse",
"promoImageLarge": "chrome://browser/content/assets/moz-vpn.svg",
"promoLinkText": "Stay private with Mozilla VPN",
"promoLinkType": "button",
"promoLinkUrl": "https://vpn.mozilla.org/?utm_campaign=private-browsing-vpn-link&entrypoint_experiment=firefox-vpn-test-1629&entrypoint_variation=var2",
"promoSectionStyle": "below-search",
"promoTitle": "Hide browsing activity and location with Mozillas VPN. One tap creates a secure connection, even on public Wi-FI.",
"promoTitleEnabled": true
}
}
],
"ratio": 1,
"slug": "var2"
}
],
"bucketConfig": {
"count": 100,
"namespace": "privatebrowsing-1",
"randomizationUnit": "normandy_id",
"start": 2000,
"total": 10000
},
"channel": "release",
"endDate": null,
"featureIds": ["privatebrowsing"],
"id": "firefox-vpn-test-1629",
"isEnrollmentPaused": true,
"outcomes": [],
"proposedDuration": 45,
"proposedEnrollment": 7,
"referenceBranch": "control",
"schemaVersion": "2.0.0",
"slug": "firefox-vpn-test-1629",
"startDate": "2021-07-27",
"targeting": "browserSettings.update.channel == \"release\" && version|versionCompare('90.!') >= 0 && 'app.shield.optoutstudies.enabled'|preferenceValue && !hasActiveEnterprisePolicies && locale in ['en-CA', 'en-GB', 'en-US'] && region in ['US']",
"userFacingDescription": "Testing out the private browsing page with different images and copy.",
"userFacingName": "firefox vpn test 1629"
}

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

@ -0,0 +1,80 @@
{
"appId": "firefox-desktop",
"appName": "firefox_desktop",
"application": "firefox-desktop",
"arguments": {},
"branches": [
{
"feature": {
"featureId": "unused-feature-id-for-legacy-support",
"enabled": false,
"value": {}
},
"features": [
{
"enabled": true,
"featureId": "pocketNewtab",
"value": {}
},
{
"featureId": "upgradeDialog",
"value": {
"enabled": false
}
}
],
"ratio": 1,
"slug": "control"
},
{
"feature": {
"featureId": "unused-feature-id-for-legacy-support",
"enabled": false,
"value": {}
},
"features": [
{
"enabled": true,
"featureId": "pocketNewtab",
"value": {
"compactLayout": true,
"lastCardMessageEnabled": true,
"loadMore": true,
"newFooterSection": true
}
},
{
"featureId": "upgradeDialog",
"value": {
"enabled": true
}
}
],
"ratio": 1,
"slug": "treatment"
}
],
"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.6.2",
"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"
}

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

@ -0,0 +1,79 @@
{
"appId": "firefox-desktop",
"appName": "firefox_desktop",
"application": "firefox-desktop",
"arguments": {},
"branches": [
{
"feature": {
"featureId": "unused-feature-id-for-legacy-support",
"enabled": false,
"value": {}
},
"features": [
{
"featureId": "pocketNewtab",
"value": { "enabled": "true" }
},
{
"featureId": "upgradeDialog",
"value": {
"enabled": false
}
}
],
"ratio": 1,
"slug": "control"
},
{
"feature": {
"featureId": "unused-feature-id-for-legacy-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": {
"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"
}

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

@ -0,0 +1,84 @@
{
"appId": "org.mozilla.ios.Firefox",
"appName": "firefox_ios",
"application": "org.mozilla.ios.Firefox",
"arguments": {},
"branches": [
{
"features": [
{
"enabled": true,
"featureId": "onboarding-default-browser",
"value": {
"should-hide-title-image": false
}
},
{
"enabled": true,
"featureId": "homescreen",
"value": {
"sections-enabled": {
"jumpBackIn": false,
"libraryShortcuts": true,
"recentlySaved": false
}
}
}
],
"ratio": 1,
"slug": "control"
},
{
"features": [
{
"enabled": true,
"featureId": "onboarding-default-browser",
"value": {
"should-hide-title-image": true
}
},
{
"enabled": true,
"featureId": "homescreen",
"value": {
"sections-enabled": {
"jumpBackIn": true,
"libraryShortcuts": false,
"recentlySaved": true
}
}
}
],
"ratio": 1,
"slug": "treatment"
}
],
"bucketConfig": {
"count": 10000,
"namespace": "firefox-ios-multifeature-test",
"randomizationUnit": "nimbus_id",
"start": 0,
"total": 10000
},
"channel": "release",
"endDate": null,
"featureIds": ["onboarding-default-browser", "homescreen"],
"id": "firefox-ios-multifeature-test",
"isEnrollmentPaused": false,
"outcomes": [
{
"priority": "secondary",
"slug": "default_browser"
}
],
"probeSets": [],
"proposedDuration": 28,
"proposedEnrollment": 7,
"referenceBranch": "control",
"schemaVersion": "1.6.2",
"slug": "firefox-ios-multifeature-test",
"startDate": "2021-11-01",
"targeting": "true",
"userFacingDescription": "firefox-ios-multifeature-test",
"userFacingName": "firefox-ios-multifeature-test"
}

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

@ -0,0 +1,46 @@
{
"schemaVersion": "0.1.0",
"id": "mobile-a-a-example",
"slug": "mobile-a-a-example",
"application": "reference_browser",
"appId": "org.mozilla.reference.browser",
"appName": "reference_browser",
"featureIds": ["bookmark-icon"],
"channel": "nightly",
"userFacingName": "Mobile A/A Example",
"userFacingDescription": "An A/A Test to validate the Rust SDK",
"isEnrollmentPaused": false,
"bucketConfig": {
"randomizationUnit": "nimbus_id",
"namespace": "mobile-a-a-example",
"start": 0,
"count": 5000,
"total": 10000
},
"targeting": null,
"startDate": null,
"endDate": null,
"proposedEnrollment": 7,
"referenceBranch": "control",
"probeSets": [],
"branches": [
{
"slug": "control",
"ratio": 1,
"feature": {
"featureId": "bookmarkId",
"enabled": true,
"value": {}
}
},
{
"slug": "treatment-variation-b",
"ratio": 1,
"feature": {
"featureId": "bookmarkId",
"enabled": true,
"value": {}
}
}
]
}

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

@ -0,0 +1,15 @@
import os
import pytest
from mozilla_nimbus_schemas.experiments import NimbusExperiment
PATH = os.path.dirname(__file__)
JSON_FILES = [
os.path.join(PATH, "fixtures", f) for f in os.listdir(os.path.join(PATH, "fixtures"))
]
@pytest.mark.parametrize("experiment_file", JSON_FILES)
def test_experiment_fixtures_are_valid(experiment_file):
NimbusExperiment.parse_file(experiment_file)

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

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

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

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

@ -1,11 +1,11 @@
[tool.poetry]
name = "mozilla-nimbus-schemas"
version = "2023.9.1"
version = "2023.9.2"
description = "Schemas used by Mozilla Nimbus and related projects."
authors = ["mikewilli"]
license = "MPL 2.0"
readme = "README.md"
packages = [{include = "mozilla_nimbus_schemas"}]
packages = [{ include = "mozilla_nimbus_schemas" }]
[tool.poetry.dependencies]
python = "^3.10"
@ -24,9 +24,7 @@ requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.pytest.ini_options]
addopts = [
"--import-mode=importlib",
]
addopts = ["--import-mode=importlib"]
[tool.ruff]
# # Enable Pyflakes `E` and `F` codes by default.
@ -46,6 +44,7 @@ ignore = [
"RET505",
"SIM102",
]
line-length = 90
[tool.ruff.pep8-naming]
classmethod-decorators = ["classmethod", "pydantic.validator"]