-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvements sourced from several shield add-on repositories #49
Conversation
57ad937
to
57d78eb
Compare
Thanks for these. I am PTO until Tuesday.
…On Thu, Feb 15, 2018 at 9:21 AM Fredrik Wollsén ***@***.***> wrote:
This PR currently includes commits from several open PRs in this repo.
They can be approved in this order: First #37
<#37> then
#41 <#41>.
Don't approve #35
<#35> (since
it's change is already included in #41
<#41>).
Approve #39
<#39> and #30
<#30> in any
order.
After that, I'll rebase this PR on top of the current master.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#49 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAKAj63gMLoyfCAqOQ7WqtBIIWR3XmPfks5tVFmEgaJpZM4SHGSV>
.
|
.eslintrc.js
Outdated
"eqeqeq": "error", | ||
"indent": ["warn", 2, {SwitchCase: 1}], | ||
eqeqeq: "error", | ||
indent: ["warn", 2, { SwitchCase: 1 }], | ||
"mozilla/no-aArgs": "warn", | ||
"mozilla/balanced-listeners": 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this should be "off"
, for consistency.
.eslintrc.js
Outdated
"eqeqeq": "error", | ||
"indent": ["warn", 2, {SwitchCase: 1}], | ||
eqeqeq: "error", | ||
indent: ["warn", 2, { SwitchCase: 1 }], | ||
"mozilla/no-aArgs": "warn", | ||
"mozilla/balanced-listeners": 0, | ||
"no-console": "warn", | ||
"no-shadow": ["error"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this could just be "error"
, and doesn't need to be wrapped in an array.
DEV.md
Outdated
|
||
Repositories that should no longer be used as templates for new studies: | ||
|
||
[https://github.com/gregglind/template-shield-study]() - The incubation repo for the updated structure and contents of this repo, implemented in late 2017. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks "off". Not sure if we should duplicate the URL in the parens, or just use the <https://github.com/gregglind/template-shield-study>
syntax since the URL and label are the same.
Same w/ the hello world example link below.
README.md
Outdated
During FIRST INSTALL and EVERY OTHER STARTUP, users see: | ||
|
||
- a 'toolbar button' (webExtension BrowserAction) | ||
**Note**: This is toy / demonstration [Shield Study](https://wiki.mozilla.org/Firefox/Shield/Shield_Studies) Legacy Addon. Use this as a template for yours |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit "Add-on", for consistency.
TESTPLAN.md
Outdated
|
||
Click on the 'x' button. | ||
* notice closes | ||
* addon uninstalls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add-on
TESTPLAN.md
Outdated
1. Open a 2nd firefox window. | ||
2. Close the initial window. | ||
* notice closes | ||
* addon uninstalls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add-on
TESTPLAN.md
Outdated
--- | ||
## Helper code and tips | ||
* notice closes | ||
* addon uninstalls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add-on
TESTPLAN.md
Outdated
} | ||
|
||
printPings() | ||
Example log output after installing the addon: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add-on (probably worth a global search and see what needs to be updated).
183f995
to
451a796
Compare
Btw, this PR also fixes #38 |
addon/bootstrap.js
Outdated
* - note first seen, | ||
* - check eligible | ||
*/ | ||
if (reason === REASONS.ADDON_INSTALL || reason === REASONS.ADDON_UPGRADE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see how this would be useful for testing, but what about in deployment? @motin, @gregglind , If we have already deployed an addon, and we have to patch it, is that an upgrade or a fresh install?
If we do upgrade addons after deployment, do we want the addon to completely reset? I.e. there would multiple firstSeen
and other initial pings from the old version and the user might see an "install" UI element more than once.
This point is moot if we never see the ADDON_UPGRADE
reason when the study is re-deployed through Normandy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on @mythmon's comments:
The add-on manager calls something an upgrade when an add-on with the same ID as an existing add-on is installed, and a greater or equal version
Normandy generally doesn't trigger upgrades, because Normandy doesn't change studies in practice. Instead it installs the add-on once, and then doesn't touch it until unenrollment time. In the future, when Normandy supports changing add-ons in place, it will trigger upgrades.
In light of this, my vote is that we future-proof the template and not equate ADDON_INSTALL
with ADDON_UPGRADE
. QA may have to remove the old version before re-installing a new version, but that seems a small price to pay to avoid potential unintended consequences of studies resetting on upgrade in the future. I think what happens on ADDON_UPGRADE
will vary by study. @mythmon , @gregglind , @raymak, @motin , any feelings one way or the other?
It varies by addon, alas, and the author has to be aware of it. Normandy
tends to do new installs that pave over the old one. I don’t know if that
is what they *desire* to do.
…On Sat, Feb 17, 2018 at 11:12 AM Bianca Danforth ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In addon/bootstrap.js
<#49 (comment)>
:
> @@ -62,14 +62,14 @@ async function startup(addonData, reason) {
studyUtils.setVariation(variation);
log.debug(`studyUtils has config and variation.name: ${variation.name}. Ready to send telemetry`);
-
- /** addon_install ONLY:
- * - note first seen,
- * - check eligible
- */
- if ((REASONS[reason]) === "ADDON_INSTALL") {
- // telemetry "enter" ONCE
+ /** addon_install and addon_upgrade (which is considered a new study) ONLY:
+ * - note first seen,
+ * - check eligible
+ */
+ if (reason === REASONS.ADDON_INSTALL || reason === REASONS.ADDON_UPGRADE) {
I can see how this would be useful for testing, but what about in
deployment? @motin <https://github.com/motin>, @gregglind
<https://github.com/gregglind> , If we have already deployed an addon,
and we have to patch it, is that an upgrade or a fresh install?
If we do upgrade addons after deployment, do we want the addon to
completely reset? I.e. there would multiple firstSeen and other initial
pings from the old version and the user might see an "install" UI element
more than once.
This point is moot if we never see the ADDON_UPGRADE reason when the
study is re-deployed through Normandy.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#49 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAKAjwo4_tSkGKR1TP521uPQ5dxPGs1Mks5tVxaHgaJpZM4SHGSV>
.
|
The add-on manager calls something an upgrade when an add-on with the same ID as an existing add-on is installed, and a greater or equal version Normandy generally doesn't trigger upgrades, because Normandy doesn't change studies in practice. Instead it installs the add-on once, and then doesn't touch it until unenrollment time. In the future, when Normandy supports changing add-ons in place, it will trigger upgrades. |
package.json
Outdated
@@ -20,6 +20,9 @@ | |||
"bugs": { | |||
"url": "https://github.com/mozilla/shield-studies-addon-template/issues" | |||
}, | |||
"engines": { | |||
"node": ">=8.9.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we require Node 7.6+ for async/await, but is there a specific reason why we require >= 8.9.0? I read that it's the LTS for Node v8. Just curious mostly.
test/utils.js
Outdated
@@ -33,6 +33,9 @@ const FIREFOX_PREFERENCES = { | |||
// NECESSARY for all 57+ builds | |||
"extensions.legacy.enabled": true, | |||
|
|||
// Include log output in browser console | |||
"shield.testing.logging.level": 10, // Trace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look to be used in bootstrap.js
any longer. In this PR's bootstrap
, you pull the logging level from Config.jsm
instead in initLog()
. We should probably do one or the other, but not both.
I'm actually in favor of a pref in utils.js
, since then we wouldn't have to remember to turn off logging in Config.jsm
when shipping the addon. SSAU also pulls the logging level from Config.jsm, so we'd need a patch for it to read the pref instead as well.
Can you update this PR to read the logging level for initLog()
from this pref in bootstrap.js
and in any other files like Feature.jsm
as well?
Install and Upgrade are different, and the behaviours for each should be
described / differ by study. Do not equate them.
…On Tue, Feb 20, 2018 at 11:58 AM, Bianca Danforth ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In addon/bootstrap.js
<#49 (comment)>
:
> @@ -62,14 +62,14 @@ async function startup(addonData, reason) {
studyUtils.setVariation(variation);
log.debug(`studyUtils has config and variation.name: ${variation.name}. Ready to send telemetry`);
-
- /** addon_install ONLY:
- * - note first seen,
- * - check eligible
- */
- if ((REASONS[reason]) === "ADDON_INSTALL") {
- // telemetry "enter" ONCE
+ /** addon_install and addon_upgrade (which is considered a new study) ONLY:
+ * - note first seen,
+ * - check eligible
+ */
+ if (reason === REASONS.ADDON_INSTALL || reason === REASONS.ADDON_UPGRADE) {
Based on @mythmon <https://github.com/mythmon>'s comments:
The add-on manager calls something an upgrade when an add-on with the same
ID as an existing add-on is installed, and a greater or equal version
Normandy generally doesn't trigger upgrades, because Normandy doesn't
change studies in practice. Instead it installs the add-on once, and then
doesn't touch it until unenrollment time. In the future, when Normandy
supports changing add-ons in place, it will trigger upgrades.
In light of this, my vote is that we future-proof the template and not
equate ADDON_INSTALL with ADDON_UPGRADE. QA may have to remove the old
version before re-installing a new version, but that seems a small price to
pay to avoid potential unintended consequences of studies resetting on
upgrade in the future. I think what happens on ADDON_UPGRADE will vary by
study. @mythmon <https://github.com/mythmon> , @gregglind
<https://github.com/gregglind> , @raymak <https://github.com/raymak>,
@motin <https://github.com/motin> , any feelings one way or the other?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#49 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAKAj5u0oueYBj7Oh3AesCY2jKjk22-Hks5tWwfQgaJpZM4SHGSV>
.
|
4f76af7
to
9d7fdaa
Compare
@biancadanforth I removed the configuration of study-specific logging since this should not belong in the template to begin with. We should expect a studyUtils.log API, like pioneerUtils has. Good target for mozilla/shield-studies-addon-utils#101 Lazy-loading StudyUtils makes it unavailable outside startup(), this affects when and where logging and REASONS is available. @gregglind Do we have to do a straight Cu.import to make this available in all of bootstrap.js? |
@motin That's a great point about the logging. Could you add a link to the pioneerUtils as a comment in that issue as a great example of how to do that? |
addon/bootstrap.js
Outdated
// Start up your feature, with specific variation info. | ||
this.feature = new Feature({variation, studyUtils, reasonName: REASONS[reason]}); | ||
// start up the chrome-privileged part of the study | ||
this.feature.privilegedStartup(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, why is this better than instantiating the feature once and having its constructor method startup the feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally, I separated them for the ability to have to extension startup hooks - one for when the webextension had loaded asynchronously, and one at the end of startup() for privileged startup logic. Currently, there is only one startup method but it is anyway clearer to not have side-effects happen in a constructor event.
package.json
Outdated
@@ -45,7 +45,6 @@ | |||
"npm-run-all": "^4.1.1", | |||
"nsp": "^2.8.1", | |||
"onchange": "^3.2.1", | |||
"path": "^0.12.7", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use this devDependency in run-firefox.js; can you add it back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That removal comes from #41 - comment that this dependency is used, close the pr and I will rebase this pr to not include this removal :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The path
module is the built in Node.js module. Adding it in package.json includes a module from npm — which could potentially be dangerous.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted, and I have merged #41. Thank you Peter for clarifying!
addon/bootstrap.js
Outdated
// if you have code to handle expiration / long-timers, it could go here | ||
/* | ||
if (this.feature.hasExpired()) { | ||
// Please note that the general study expiration should probably be taken care of by Normandy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is news to me! I have been handling general study expiration in my addon code -- @mythmon , does Normandy handle this? What do you recommend study authors do re: general study expiration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normandy does not handle this, and I do not agree with this comment.
Normandy will handle removal of the add-on when the study is ended on the server, but that is not what this feature is generally used for. The first expiration timer that I'm aware of was designed to expire an experiment as a fail safe, in case Normandy could not be contacted, or someone forgot to disable the recipe on the server.
In that original case, the expiry timer was not a normal end to the study, but a failsafe in case something went wrong. As such, it should be implemented in a very reliable way by the add-on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying @mythmon, adding this information as a comment in the template
Done |
TESTPLAN.md
Outdated
|
||
During INSTALL ONLY users see: | ||
* Download a Release version of Firefox (Release is required for the recommendation heuristics to work) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by "recommendation heuristics"? Can you expand on that a little here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, a leftover from taar-v2, removing...
addon/bootstrap.js
Outdated
@@ -119,22 +119,26 @@ function shutdown(addonData, reason) { | |||
// FRAGILE: handle uninstalls initiated by USER or by addon | |||
if (reason === REASONS.ADDON_UNINSTALL || reason === REASONS.ADDON_DISABLE) { | |||
log.debug("uninstall or disable"); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a note here to say we check if feature
exists because it's possible the study is shutting down before it has instantiated the feature. Ex: if the user is ineligible or if the study has expired.
Should probably have clicked a few lines below for this comment. :X
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarifying this
… after recent bootstrap.js updates
… that we can rely on
…e already on the way to be merged into) shield-study-addon-utils
… will not be relevant for study-specific QA
Rebased upon the latest master. Ready for merge. |
Many improvements to the template. Primarily sourced from:
Version bump to 1.3.0
The idea of this PR is to, in one big swoop, bring this template forward to reflect today's improvements and desired changes discovered while developing the above add-ons, as well as make it easier (via npm run format addition and linting improvements) to merge and backport code between add-ons and the template (with less differences only from code style and whitespace).