Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Support Pioneer pipeline + merging ideas from pioneer-utils#263

Merged
gregglind merged 28 commits into
mozilla:release/5.2.0from
motin:issues-142-and-128-support-pioneer-pipeline
Nov 28, 2018
Merged

Support Pioneer pipeline + merging ideas from pioneer-utils#263
gregglind merged 28 commits into
mozilla:release/5.2.0from
motin:issues-142-and-128-support-pioneer-pipeline

Conversation

@motin
Copy link
Copy Markdown
Contributor

@motin motin commented Sep 10, 2018

This PR incorporates relevant parts from pioneer-utils v1.0.10 into shield-studies-addon-utils, making the former repository/code obsolete.

A Pioneer study will thus only need to integrate shield-studies-addon-utils and supply studyType: "pioneer" instead of studyType: "shield" in their configuration. To test this code in an existing add-on: npm install --save motin/shield-studies-addon-utils#issues-142-and-128-support-pioneer-pipeline

Note: In the current implementation, Pioneer studies exhibit the same behavior (including life-cycle telemetry) as ordinary Shield studies. The only difference is that all study telemetry payloads are encrypted.

The browser.study.* API is hereby augmented with the browser.study.getDataPermissions() method, returning the current dataPermissions (shield enabled true/false, pioneer enabled true/false). Note: This is a lighter variant of the data permission related features referenced in #177 (comment)

Fixes #142 (Support different data pipelines)
Fixes #128 (Merge ideas from Pioneer Utils)
Fixes mozilla/pioneer-utils#25 (Request to merge / unfork: Shield-Studies-Addon-Utils)
Fixes mozilla/pioneer-utils#13 (Unit tests)
Fixes mozilla/pioneer-utils#7 (Set up CI)
Fixes mozilla/pioneer-utils#40 (Async/await for endStudy and submitEventPing)
Fixes mozilla/pioneer-utils#41 (Add EVENTS.INSTALLED)

Copy link
Copy Markdown
Contributor

@mythmon mythmon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems pretty straight forward to me. I'd like to hear from Rehan as well though.

Comment thread test/functional/browser.study.api.js Outdated
baseUrls: [
"https://qsurvey.mozilla.com/s3/Shield-Study-Example-Survey/?reason=ineligible",
],
const publicApiTests = function(studyType) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this const publicApiTests = function(...) instead of function publicApiTests(...)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arbitrary. Changing to conform to the style of the rest of the script

Comment thread test/functional/browser.study.api.js Outdated
});

describe("PUBLIC API `browser.study` (studyType: pioneer)", function() {
publicApiTests.bind(this)("pioneer");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually see this written as publicApiTests.call(this, "pioneer"). I don't have any reason to prefer one or the other though.


parameters: []

- name: getInternalTestingOverrides
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really relevant to this review, but why is there both a Yaml and JSON version of the schema? That seems like a duplication risk.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, created a tracking issue: #264

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JSON is generated from YAML. We found it faster to iterate (less verbose, multi-line comments) in YAML.

return studyUtils._internals;
},

getInternalTestingOverrides: async function getInternalTestingOverrides() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formatting of this seems inconsistent. Why not async getInternalTestingOverrides() {?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar issue above with getDataPermissions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally all function declarations were generated based on the schema YAML in a consistent manner. I believe prettier causes the observed inconsistencies based on the length of the function names.

Copy link
Copy Markdown

@rehandalal rehandalal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a pass over this. There's a lot to take it but it generally looks fine to me.

return studyUtils._internals;
},

getInternalTestingOverrides: async function getInternalTestingOverrides() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar issue above with getDataPermissions

@motin motin changed the base branch from release/5.1.0 to master September 12, 2018 17:27
@motin motin force-pushed the issues-142-and-128-support-pioneer-pipeline branch from d673ae7 to 99b242c Compare September 12, 2018 17:27
@motin motin force-pushed the issues-142-and-128-support-pioneer-pipeline branch 4 times, most recently from 5d08c1b to d625caf Compare October 28, 2018 22:01
@motin
Copy link
Copy Markdown
Contributor Author

motin commented Nov 1, 2018

Good news - the packets using shield schemas in pioneer telemetry are now being parsed correctly in the pipeline: mozilla-services/mozilla-pipeline-schemas#199 (comment)

@motin
Copy link
Copy Markdown
Contributor Author

motin commented Nov 14, 2018

@gregglind This PR is now ready for review and merge. The code has been verified to work in https://github.com/motin/jestr-pioneer-shield-study and the pings have been verified to end up in the correct final destination for Pioneer studies.

@motin motin force-pushed the issues-142-and-128-support-pioneer-pipeline branch from 704910d to e367173 Compare November 15, 2018 22:41
@motin motin changed the base branch from master to release/5.2.0 November 15, 2018 22:59
@gregglind gregglind merged commit 39f7588 into mozilla:release/5.2.0 Nov 28, 2018
@motin motin deleted the issues-142-and-128-support-pioneer-pipeline branch December 2, 2018 20:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants