diff --git a/toolkit/components/normandy/actions/MessagingExperimentAction.sys.mjs b/toolkit/components/normandy/actions/MessagingExperimentAction.sys.mjs deleted file mode 100644 index 393d2cc3f28c..000000000000 --- a/toolkit/components/normandy/actions/MessagingExperimentAction.sys.mjs +++ /dev/null @@ -1,34 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -import { BaseStudyAction } from "resource://normandy/actions/BaseStudyAction.sys.mjs"; - -const lazy = {}; - -ChromeUtils.defineESModuleGetters(lazy, { - ActionSchemas: "resource://normandy/actions/schemas/index.sys.mjs", - ExperimentManager: "resource://nimbus/lib/ExperimentManager.sys.mjs", -}); - -const RECIPE_SOURCE = "normandy"; - -export class MessagingExperimentAction extends BaseStudyAction { - constructor() { - super(); - this.manager = lazy.ExperimentManager; - } - get schema() { - return lazy.ActionSchemas["messaging-experiment"]; - } - - async _run(recipe) { - if (recipe.arguments) { - await this.manager.onRecipe(recipe.arguments, RECIPE_SOURCE); - } - } - - async _finalize() { - this.manager.onFinalize(RECIPE_SOURCE); - } -} diff --git a/toolkit/components/normandy/actions/schemas/index.sys.mjs b/toolkit/components/normandy/actions/schemas/index.sys.mjs index 7ef006e90558..b21eeb092a4a 100644 --- a/toolkit/components/normandy/actions/schemas/index.sys.mjs +++ b/toolkit/components/normandy/actions/schemas/index.sys.mjs @@ -17,62 +17,6 @@ export const ActionSchemas = { }, }, - "messaging-experiment": { - $schema: "http://json-schema.org/draft-04/schema#", - title: "Messaging Experiment", - type: "object", - required: ["slug", "branches", "isEnrollmentPaused"], - properties: { - slug: { - description: "Unique identifier for this experiment", - type: "string", - pattern: "^[A-Za-z0-9\\-_]+$", - }, - isEnrollmentPaused: { - description: "If true, new users will not be enrolled in the study.", - type: "boolean", - default: true, - }, - branches: { - description: "List of experimental branches", - type: "array", - minItems: 1, - items: { - type: "object", - required: ["slug", "value", "ratio", "groups"], - properties: { - slug: { - description: - "Unique identifier for this branch of the experiment.", - type: "string", - pattern: "^[A-Za-z0-9\\-_]+$", - }, - value: { - description: "Message content.", - type: "object", - properties: {}, - }, - ratio: { - description: - "Ratio of users who should be grouped into this branch.", - type: "integer", - minimum: 1, - }, - groups: { - description: - "A list of experiment groups that can be used to exclude or select related experiments. May be empty.", - type: "array", - items: { - type: "string", - description: "Identifier of the group", - }, - }, - }, - }, - }, - }, - }, - "preference-rollout": { $schema: "http://json-schema.org/draft-04/schema#", title: "Change preferences permanently", diff --git a/toolkit/components/normandy/lib/ActionsManager.sys.mjs b/toolkit/components/normandy/lib/ActionsManager.sys.mjs index 6f811613afd7..504d1209f3a5 100644 --- a/toolkit/components/normandy/lib/ActionsManager.sys.mjs +++ b/toolkit/components/normandy/lib/ActionsManager.sys.mjs @@ -14,8 +14,6 @@ ChromeUtils.defineESModuleGetters(lazy, { BranchedAddonStudyAction: "resource://normandy/actions/BranchedAddonStudyAction.sys.mjs", ConsoleLogAction: "resource://normandy/actions/ConsoleLogAction.sys.mjs", - MessagingExperimentAction: - "resource://normandy/actions/MessagingExperimentAction.sys.mjs", PreferenceExperimentAction: "resource://normandy/actions/PreferenceExperimentAction.sys.mjs", PreferenceRollbackAction: @@ -49,7 +47,6 @@ export class ActionsManager { "addon-rollout": lazy.AddonRolloutAction, "branched-addon-study": lazy.BranchedAddonStudyAction, "console-log": lazy.ConsoleLogAction, - "messaging-experiment": lazy.MessagingExperimentAction, "multi-preference-experiment": lazy.PreferenceExperimentAction, "preference-rollback": lazy.PreferenceRollbackAction, "preference-rollout": lazy.PreferenceRolloutAction, diff --git a/toolkit/components/normandy/test/browser/browser.toml b/toolkit/components/normandy/test/browser/browser.toml index 1114750fafb9..ff539a8a306e 100644 --- a/toolkit/components/normandy/test/browser/browser.toml +++ b/toolkit/components/normandy/test/browser/browser.toml @@ -66,8 +66,6 @@ https_first_disabled = true ["browser_actions_ConsoleLogAction.js"] -["browser_actions_MessagingExperimentAction.js"] - ["browser_actions_PreferenceExperimentAction.js"] ["browser_actions_PreferenceRollbackAction.js"] diff --git a/toolkit/components/normandy/test/browser/browser_actions_MessagingExperimentAction.js b/toolkit/components/normandy/test/browser/browser_actions_MessagingExperimentAction.js deleted file mode 100644 index 0f16ff1436fe..000000000000 --- a/toolkit/components/normandy/test/browser/browser_actions_MessagingExperimentAction.js +++ /dev/null @@ -1,67 +0,0 @@ -"use strict"; - -const { BaseAction } = ChromeUtils.importESModule( - "resource://normandy/actions/BaseAction.sys.mjs" -); -const { Uptake } = ChromeUtils.importESModule( - "resource://normandy/lib/Uptake.sys.mjs" -); -const { MessagingExperimentAction } = ChromeUtils.importESModule( - "resource://normandy/actions/MessagingExperimentAction.sys.mjs" -); - -const { _ExperimentManager, ExperimentManager } = ChromeUtils.importESModule( - "resource://nimbus/lib/ExperimentManager.sys.mjs" -); - -decorate_task( - withStudiesEnabled(), - withStub(Uptake, "reportRecipe"), - async function arguments_are_validated({ reportRecipeStub }) { - const action = new MessagingExperimentAction(); - - is( - action.manager, - ExperimentManager, - "should set .manager to ExperimentManager singleton" - ); - // Override this for the purposes of the test - action.manager = new _ExperimentManager(); - await action.manager.onStartup(); - const onRecipeStub = sinon.spy(action.manager, "onRecipe"); - - const recipe = { - id: 1, - arguments: { - slug: "foo", - isEnrollmentPaused: false, - branches: [ - { - slug: "control", - ratio: 1, - groups: ["green"], - value: { title: "hello" }, - }, - { - slug: "variant", - ratio: 1, - groups: ["green"], - value: { title: "world" }, - }, - ], - }, - }; - - ok(action.validateArguments(recipe.arguments), "should validate arguments"); - - await action.processRecipe(recipe, BaseAction.suitability.FILTER_MATCH); - await action.finalize(); - - Assert.deepEqual(reportRecipeStub.args, [[recipe, Uptake.RECIPE_SUCCESS]]); - Assert.deepEqual( - onRecipeStub.args, - [[recipe.arguments, "normandy"]], - "should call onRecipe with recipe args and 'normandy' source" - ); - } -);