Skip to content
This repository has been archived by the owner on Jan 29, 2025. It is now read-only.

Commit

Permalink
EXP-1865 add isRollout boolean property to Experiment type
Browse files Browse the repository at this point in the history
Because:

* we want to implement support for an isRollout flag in experiments

This commit:

* adds an isRollout boolean to the NimbusExperiment type

* introduces example recipes for both mobile and desktop for testing

* adds a test for boolean property schema validation for experiments
  • Loading branch information
lmorchard committed Dec 6, 2021
1 parent 4dfcc2a commit d880b64
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
41 changes: 41 additions & 0 deletions data/experiment-recipe-samples/desktop-97-rollout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"slug": "rollout-desktop-example",
"appId": "firefox-desktop",
"appName": "firefox_desktop",
"channel": "",
"endDate": null,
"branches": [
{
"slug": "control",
"ratio": 1,
"feature": {
"value": {},
"enabled": true,
"featureId": "no-feature-firefox-desktop"
}
}
],
"outcomes": [],
"arguments": {},
"probeSets": [],
"startDate": null,
"targeting": "version|versionCompare('95.!') >= 0 && 'app.shield.optoutstudies.enabled'|preferenceValue",
"featureIds": ["no-feature-firefox-desktop"],
"application": "firefox-desktop",
"bucketConfig": {
"count": 5000,
"start": 0,
"total": 10000,
"namespace": "firefox-desktop-no-feature-firefox-desktop-rollout-1",
"randomizationUnit": "normandy_id"
},
"userFacingName": "Testing Rollout Desktop",
"referenceBranch": "control",
"proposedDuration": 28,
"isRollout": true,
"isEnrollmentPaused": false,
"proposedEnrollment": 7,
"userFacingDescription": "Testing Rollout Desktop",
"id": "testing-rollout-desktop",
"last_modified": 1636503830647
}
37 changes: 37 additions & 0 deletions data/experiment-recipe-samples/mobile-rollout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"id": "rollout-mobile-example",
"slug": "rollout-mobile-example",
"application": "reference_browser",
"appId": "org.mozilla.reference.browser",
"appName": "reference_browser",
"featureIds": ["bookmark-icon"],
"channel": "nightly",
"userFacingName": "Mobile Rollout Example",
"userFacingDescription": "An A/A Test to validate rollout in the Rust SDK",
"isRollout": true,
"isEnrollmentPaused": false,
"bucketConfig": {
"randomizationUnit": "nimbus_id",
"namespace": "rollout-mobile-example-rollout-1",
"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": {}
}
}
]
}
8 changes: 8 additions & 0 deletions test/test-experiment-recipe-firefox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ describe("experiment schemas", () => {
assert.equal(result.ok, false, "validation should fail");
assert.propertyVal(result.errors[0], "message", 'should match format "date"');
});
it("should fail on a non-boolean for a boolean", async () => {
const result = typeGuards.experiments_checkNimbusExperiment({
...TEST_EXPERIMENT,
isRollout: "foo",
});
assert.equal(result.ok, false, "validation should fail");
assert.propertyVal(result.errors[0], "message", "should be boolean");
});
it("should fail on a non-integer value for a number", async () => {
const result = typeGuards.experiments_checkNimbusExperiment({
...TEST_EXPERIMENT,
Expand Down
8 changes: 8 additions & 0 deletions types/experiments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ export interface NimbusExperiment {
*/
isEnrollmentPaused: boolean;

/**
* When this property is set to true, treat this experiment as a rollout.
* Rollouts are currently handled as single-branch experiments separated
* from the bucketing namespace for normal experiments.
* See also: https://mozilla-hub.atlassian.net/browse/SDK-405
*/
isRollout?: boolean;

/** Bucketing configuration */
bucketConfig: BucketConfig;

Expand Down

0 comments on commit d880b64

Please sign in to comment.