You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+158Lines changed: 158 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,164 @@ Discussions happen in [#mozilla-vpn:mozilla.org](https://chat.mozilla.org/#/room
5
5
1.[Issues marked as `good-first-bug`](https://github.com/mozilla-mobile/mozilla-vpn-client/labels/good%20first%20issue) are self-contained enough that a contributor should be able to work on them.
6
6
2. Issues are considered not assigned, until there is a PR linked to them.
7
7
8
+
9
+
### Pre-commit formatting hook
10
+
11
+
If you want to submit a pull-request, please, install the clang format
12
+
pre-commit hook that lints code.
13
+
14
+
1. The standard conda environment includes the required clang-format libraries.
15
+
If the conda environment is *not* being used, a clang-format library will need
16
+
to manually installed. (For example, using Homebrew on macOS:
17
+
`brew install clang-format`.)
18
+
19
+
2. The linter will need to know where to find the `clang-format-diff.py` file, so
20
+
`CLANG_FORMAT_DIFF` must be exported. On a standard conda installation:
The functional tests also require the testing addons to be built. This sub project can be found
59
+
at `tests/functional/addons` and can be built as follows:
60
+
61
+
```
62
+
cmake -B build-addons/ -S tests/functional/addons
63
+
cmake --build build-addons/
64
+
export MVPN_ADDONS_PATH=build-addons/
65
+
```
66
+
67
+
**Other dependencies**:
68
+
* Install node (if needed) and then `npm install` to install the testing
69
+
dependencies
70
+
* Make a .env file and place it in the root folder for the repo. It should include:
71
+
*`ARTIFACT_DIR` - optional (directory to put screenshots from test failures)
72
+
* Sample .env file:
73
+
```
74
+
export PATH=$PATH:~/Qt/6.10.1/macos/bin:$PATH
75
+
export QT_MACOS_BIN=~/Qt/6.10.1/macos/bin
76
+
MVPN_API_BASE_URL=http://localhost:5000
77
+
ARTIFACT_DIR=tests/artifact
78
+
```
79
+
80
+
**To run a test**: from the root of the project: `npm run functionalTest path/to/testFile.js`. To run, say, the authentication tests: `npm run functionalTest tests/functional/testAuthenticationInApp.js`.
81
+
82
+
(Functional tests are run against the production build of the application by providing the
83
+
`--testing` flag to the command line when running the app. This option switches the client in to staging mode, and
84
+
enables mocking for platform and backend features necessary to facilitate automated testing.
85
+
This flag is added automatically when setupVpn.js starts the VPN, which is done for all functional tests.)
86
+
87
+
## Developer Options and staging environment
88
+
89
+
To enable the staging environment, open the `Help` window, and click on the
90
+
`Help` title text 6 times within 10 seconds to unlock the Developer Options menu.
91
+
On this menu, you can enable on the `Staging Server` checkbox to switch to the
92
+
staging environment. A full restart of the VPN will be required for this option
93
+
to take effect.
94
+
95
+
## Inspector
96
+
97
+
The inspector is a debugging tool available only when the staging environment
98
+
is activated. When running MozillaVPN, go to the [inspector page](
99
+
https://mozilla-mobile.github.io/mozilla-vpn-client/inspector/) to interact
100
+
with the app. Connect the inspector to the app using the web-socket interface.
101
+
On desktop, use `ws://localhost:8765`.
102
+
103
+
The inspector offers a number of tools to help debug and navigate through the VPN client:
104
+
***Shell:** By default the inspector link will take you to the Shell. From there type `help` to see the list of available commands.
105
+
***Logs:** Will constantly output all the app activities happening in real time. This information includes the timestamp, component and message. From the left column you can select which component(s) you'd like to monitor.
106
+
***Network Inspector:** Includes a list of all incoming and outgoing network requests. This is especially helpful when debugging network related issues or monitoring how the app communicates with external components such as the Guardian.
107
+
***QML Inspector:** Allows you to identify and inspect all QML components in the app by mirroring the local VPN client running on your machine and highlighting components by clicking on the QML instance on the right.
Glean provides a series of [debug APIs](debug-apis) to aid developers and testers
126
+
in verifying Glean metrics.
127
+
128
+
These APIs can be accessed through the Mozilla VPN developer menu, under "Telemetry Debugging".
129
+
130
+
#### Data review
131
+
132
+
If you are responsible for a piece of work that adds new Glean instrumentation you will need to do a data review.
133
+
Following is the recommended process along with some pointers.
134
+
135
+
> The data review process is also described here: https://wiki.mozilla.org/Data_Collection
136
+
137
+
The basic process is this:
138
+
139
+
* Implement the new instrumentation. Refer to [the Glean book](https://mozilla.github.io/glean/book/user/metrics/adding-new-metrics.html) on how to do that.
140
+
* When adding or updating new metrics or pings, the [Glean YAML files](https://github.com/mozilla-mobile/mozilla-vpn-client/tree/main/glean) might need to be updated.
141
+
When that is the case a new data-review must be requested and added to the list of data-reviews for the updated/added instrumentation.
142
+
When updating data-review links on the YAML files, these are the things to keep in mind:
143
+
* Include a link to the *GitHub* bug that describes the work, this must be a public link;
144
+
* Put "TBD" in the `data_reviews` entry, that needs to be updated *before* releasing the new instrumentation and ideally before merging it;
145
+
* Think about whether the data you are collecting is technical or interaction, sometimes it's both. In that case pick interaction which is a higher category of data. (See more details on https://wiki.mozilla.org/Data_Collection);
146
+
* Open a **draft** PR on GitHub;
147
+
* Fill out the data-review[^1] form and request a data-review from one of the [Mozilla Data Stewards](https://wiki.mozilla.org/Data_Collection)[^2].
148
+
That can be done by opening a Bugzilla ticket or more easily by attaching the questionnaire as a comment on the PR that implements the instrumentation changes.
149
+
For Bugzilla, there is a special Bugzilla data review request option and for GitHub it's enough to add the chosen data steward as a reviewer for the PR.
150
+
* The data-review questionnaire will result in a data review response. The link to that response is what should be added to the `data_review` entry on the Glean YAML files.
151
+
It must be a public link.
152
+
153
+
> Note:
154
+
> - It is **ok** for a reviewer to review and approve your code while you're waiting for data review.
155
+
> - It is **not** ok to release code that contains instrumentation changes without a data review r+. It is good practice not to merge code that does not have a data review r+.
156
+
157
+
[^1]: The data-review questionnaire can be found at https://github.com/mozilla/data-review/blob/main/request.md. That can be copy pasted and filled out manually. However,
158
+
since the VPN application uses Glean for data collection developers can also use the [`glean_parser data-review`](https://mozilla.github.io/glean_parser/) command,
159
+
which generates a mostly filled out data-review questionnaire for Glean users. The questionnaire can seem quite intimidating, but don't panic.
160
+
First, look at an old data-review such as https://github.com/mozilla-mobile/mozilla-vpn-client/pull/4594.
161
+
Questions 1, 2, 3 an 10 are the ones that require most of your attention and thought.
162
+
If you don't know the answers to these questions, reach out to Sarah Bird or the product manager so you can answer these with full confidence.
163
+
[^2]: Feel free to ping any of the data-stewards. If the collection is time sensitive consider pinging all data-stewards directly on the [data-stewards](https://matrix.to/#/#data-stewards:mozilla.org) matrix channel.
0 commit comments