mozilla / shield-studies-addon-utils

Mozilla Public License 2.0
6 stars 21 forks source link

Add normandy unenroll listener #287

Closed motin closed 5 years ago

motin commented 5 years ago

Automatic tests (which could be modeled after https://searchfox.org/mozilla-central/source/toolkit/components/normandy/test/unit/test_addon_unenroll.js) have been omitted since this is merely a stop-gap fix to support study add-ons until study utils are added to tree.

Please review and advice on how we can test this manually.

Fixes 1 out of 2 outstanding issues outlined in https://github.com/mozilla/shield-studies-addon-utils/issues/246 Fixes https://github.com/mozilla/shield-studies-addon-utils/issues/267 Fixes #154

mythmon commented 5 years ago

For manual testing, you'll need to actually enroll an add-on in a study that contains this code. The easiest way to currently do this would be to create a recipe on the Normandy Stage server, and point a Firefox profile to that server. I can help with this on Slack, if you don't already have what you need for that.

motin commented 5 years ago

@mythmon Great! Will ping on Skype regarding manual testing.

Another question: based on a quick source code inspection, the reason sent when the study gets unenrolled by Normandy is "shield-study-ended". A user clicking unenroll yields "individual-opt-out".

What reason is sent if Normandy pulls back a study? For studies that open up a survey, it is important to be able to skip opening up the survey in such a case.

motin commented 5 years ago

@mythmon I see that the docs mention the following reasons, but none seem to correspond to "the study was pulled back", and why is not "shield-study-ended" mentioned in this list?

reason

    The reason for unenrollment. Possible values are:

        "install-failure": The add-on failed to install.
        "individual-opt-out": The user opted-out of this particular study.
        "general-opt-out": The user opted-out of studies in general.
        "recipe-not-seen": The recipe was no longer applicable to this client. This can be because the recipe was disabled, or the user no longer matches the recipe’s filter.
        "uninstalled": The study’s add-on as uninstalled by some mechanism. For example, this could be a user action or the add-on self-uninstalling.
        "uninstalled-sideload": The study’s add-on was uninstalled while Normandy was inactive. This could be that the add-on is no longer compatible, or was manually removed from a profile.
        "unknown": A reason was not specified. This should be considered a bug.
mythmon commented 5 years ago

"The study was pulled back" would be seen as recipe-not-seen, since the client does not see or execute disabled recipes. I'm not sure what you mean by shield-study-ended.

motin commented 5 years ago

Summary of our conversation on Slack: Currently recipe-not-seen is what the client sees upon natural study end (which I though corresponded to shield-study-ended) and in case the study was pulled pack, thus we will not be opening any surveys upon recipe-not-seen.