deps: backport IsValid changes from 4e8736d in V8
[platform/upstream/nodejs.git] / COLLABORATOR_GUIDE.md
1 # Node.js Collaborator Guide
2
3 **Contents**
4
5 * [Issues and Pull Requests](#issues-and-pull-requests)
6 * [Accepting Modifications](#accepting-modifications)
7  - [Involving the CTC](#involving-the-ctc)
8 * [Landing Pull Requests](#landing-pull-requests)
9  - [Technical HOWTO](#technical-howto)
10  - [I Just Made a Mistake](#i-just-made-a-mistake)
11  - [Long Term Support](#long-term-support)
12
13 This document contains information for Collaborators of the Node.js
14 project regarding maintaining the code, documentation and issues.
15
16 Collaborators should be familiar with the guidelines for new
17 contributors in [CONTRIBUTING.md](./CONTRIBUTING.md) and also
18 understand the project governance model as outlined in
19 [GOVERNANCE.md](./GOVERNANCE.md).
20
21 ## Issues and Pull Requests
22
23 Courtesy should always be shown to individuals submitting issues and
24 pull requests to the Node.js project.
25
26 Collaborators should feel free to take full responsibility for
27 managing issues and pull requests they feel qualified to handle, as
28 long as this is done while being mindful of these guidelines, the
29 opinions of other Collaborators and guidance of the CTC.
30
31 Collaborators may **close** any issue or pull request they believe is
32 not relevant for the future of the Node.js project. Where this is
33 unclear, the issue should be left open for several days to allow for
34 additional discussion. Where this does not yield input from Node.js
35 Collaborators or additional evidence that the issue has relevance, the
36 issue may be closed. Remember that issues can always be re-opened if
37 necessary.
38
39 ## Accepting Modifications
40
41 All modifications to the Node.js code and documentation should be
42 performed via GitHub pull requests, including modifications by
43 Collaborators and CTC members.
44
45 All pull requests must be reviewed and accepted by a Collaborator with
46 sufficient expertise who is able to take full responsibility for the
47 change. In the case of pull requests proposed by an existing
48 Collaborator, an additional Collaborator is required for sign-off.
49
50 In some cases, it may be necessary to summon a qualified Collaborator
51 to a pull request for review by @-mention.
52
53 If you are unsure about the modification and are not prepared to take
54 full responsibility for the change, defer to another Collaborator.
55
56 Before landing pull requests, sufficient time should be left for input
57 from other Collaborators. Leave at least 48 hours during the week and
58 72 hours over weekends to account for international time differences
59 and work schedules. Trivial changes (e.g. those which fix minor bugs
60 or improve performance without affecting API or causing other
61 wide-reaching impact) may be landed after a shorter delay.
62
63 Where there is no disagreement amongst Collaborators, a pull request
64 may be landed given appropriate review. Where there is discussion
65 amongst Collaborators, consensus should be sought if possible. The
66 lack of consensus may indicate the need to elevate discussion to the
67 CTC for resolution (see below).
68
69 All bugfixes require a test case which demonstrates the defect. The
70 test should *fail* before the change, and *pass* after the change.
71
72 All pull requests that modify executable code should be subjected to
73 continuous integration tests on the
74 [project CI server](https://ci.nodejs.org/).
75
76 ### Involving the CTC
77
78 Collaborators may opt to elevate pull requests or issues to the CTC for
79 discussion by assigning the ***ctc-agenda*** tag. This should be done
80 where a pull request:
81
82 - has a significant impact on the codebase,
83 - is inherently controversial; or
84 - has failed to reach consensus amongst the Collaborators who are
85   actively participating in the discussion.
86
87 The CTC should serve as the final arbiter where required.
88
89 ## Landing Pull Requests
90
91 Always modify the original commit message to include additional meta
92 information regarding the change process:
93
94 - A `Reviewed-By: Name <email>` line for yourself and any
95   other Collaborators who have reviewed the change.
96 - A `PR-URL:` line that references the *full* GitHub URL of the original
97   pull request being merged so it's easy to trace a commit back to the
98   conversation that led up to that change.
99 - A `Fixes: X` line, where _X_ either includes the *full* GitHub URL
100   for an issue, and/or the hash and commit message if the commit fixes
101   a bug in a previous commit. Multiple `Fixes:` lines may be added if
102   appropriate.
103
104 Review the commit message to ensure that it adheres to the guidelines
105 outlined in the [contributing](https://github.com/nodejs/node/blob/master/CONTRIBUTING.md#step-3-commit) guide.
106
107 See the commit log for examples such as
108 [this one](https://github.com/nodejs/node/commit/b636ba8186) if unsure
109 exactly how to format your commit messages.
110
111 Additionally:
112
113 - Double check PRs to make sure the person's _full name_ and email
114   address are correct before merging.
115 - Except when updating dependencies, all commits should be self
116   contained (meaning every commit should pass all tests). This makes
117   it much easier when bisecting to find a breaking change.
118
119 ### Technical HOWTO
120
121 _Optional:_ ensure that you are not in a borked `am`/`rebase` state
122
123 ```text
124 $ git am --abort
125 $ git rebase --abort
126 ```
127
128 Checkout proper target branch
129
130 ```text
131 $ git checkout master
132 ```
133
134 Update the tree
135
136 ```text
137 $ git fetch origin
138 $ git merge --ff-only origin/master
139 ```
140
141 Apply external patches
142
143 ```text
144 $ curl -L https://github.com/nodejs/node/pull/xxx.patch | git am --whitespace=fix
145 ```
146
147 Check and re-review the changes
148
149 ```text
150 $ git diff origin/master
151 ```
152
153 Check number of commits and commit messages
154
155 ```text
156 $ git log origin/master...master
157 ```
158
159 If there are multiple commits that relate to the same feature or
160 one with a feature and separate with a test for that feature,
161 you'll need to use `squash` or `fixup`:
162
163 ```text
164 $ git rebase -i origin/master
165 ```
166
167 This will open a screen like this (in the default shell editor):
168
169 ```text
170 pick 6928fc1 crypto: add feature A
171 pick 8120c4c add test for feature A
172 pick 51759dc feature B
173 pick 7d6f433 test for feature B
174
175 # Rebase f9456a2..7d6f433 onto f9456a2
176 #
177 # Commands:
178 #  p, pick = use commit
179 #  r, reword = use commit, but edit the commit message
180 #  e, edit = use commit, but stop for amending
181 #  s, squash = use commit, but meld into previous commit
182 #  f, fixup = like "squash", but discard this commit's log message
183 #  x, exec = run command (the rest of the line) using shell
184 #
185 # These lines can be re-ordered; they are executed from top to bottom.
186 #
187 # If you remove a line here THAT COMMIT WILL BE LOST.
188 #
189 # However, if you remove everything, the rebase will be aborted.
190 #
191 # Note that empty commits are commented out
192 ```
193
194 Replace a couple of `pick`s with `fixup` to squash them into a
195 previous commit:
196
197 ```text
198 pick 6928fc1 crypto: add feature A
199 fixup 8120c4c add test for feature A
200 pick 51759dc feature B
201 fixup 7d6f433 test for feature B
202 ```
203
204 Replace `pick` with `reword` to change the commit message:
205
206 ```text
207 reword 6928fc1 crypto: add feature A
208 fixup 8120c4c add test for feature A
209 reword 51759dc feature B
210 fixup 7d6f433 test for feature B
211 ```
212
213 Save the file and close the editor. You'll be asked to enter a new
214 commit message for that commit. This is a good moment to fix incorrect
215 commit logs, ensure that they are properly formatted, and add
216 `Reviewed-By` lines.
217
218 Time to push it:
219
220 ```text
221 $ git push origin master
222 ```
223
224 ### I Just Made a Mistake
225
226 With `git`, there's a way to override remote trees by force pushing
227 (`git push -f`). This should generally be seen as forbidden (since
228 you're rewriting history on a repository other people are working
229 against) but is allowed for simpler slip-ups such as typos in commit
230 messages. However, you are only allowed to force push to any Node.js
231 branch within 10 minutes from your original push. If someone else
232 pushes to the branch or the 10 minute period passes, consider the
233 commit final.
234
235 ### Long Term Support
236
237 #### What is LTS?
238
239 Long Term Support (often referred to as *LTS*) guarantees application developers
240 a 30 month support cycle with specific versions of Node.js.
241
242 You can find more information [in the full LTS plan](https://github.com/nodejs/lts#lts-plan).
243
244 #### How does LTS work?
245
246 Once a stable branch enters LTS, changes in that branch are limited to bug
247 fixes, security updates, possible npm updates, documentation updates, and
248 certain performance improvements that can be demonstrated to not break existing
249 applications. Semver-minor changes are only permitted if required for bug fixes
250 and then only on a case-by-case basis with LTS WG and possibly Core Technical
251 Committee (CTC) review. Semver-major changes are permitted only if required for
252 security related fixes.
253
254 Once a stable branch moves into Maintenance mode, only **critical** bugs,
255 **critical** security fixes, and documentation updates will be permitted.
256
257 #### Landing semver-minor commits in LTS
258
259 The default policy is to not land semver-minor or higher commits in any LTS
260 branch. However, the LTS WG or CTC can evaluate any individual semver-minor
261 commit and decide whether a special exception ought to be made. It is
262 expected that such exceptions would be evaluated, in part, on the scope
263 and impact of the changes on the code, the risk to ecosystem stability
264 incurred by accepting the change, and the expected benefit that landing the
265 commit will have for the ecosystem.
266
267 Any collaborator who feels a semver-minor commit should be landed in an LTS
268 branch should attach the `lts-agenda` label to the pull request. The LTS WG
269 will discuss the issue and, if necessary, will escalate the issue up to the
270 CTC for further discussion.
271
272 #### How are LTS Branches Managed?
273
274 There are currently three LTS branches: `v4.x`, `v0.10`, and `v0.12`. Each
275 of these is paired with a "staging" branch: `v4.x-staging`, `v0.10-staging`,
276 and `v0.12-staging`.
277
278 As commits land in `master`, they are cherry-picked back to each staging
279 branch as appropriate. If the commit applies only to the LTS branch, the
280 PR must be opened against the *staging* branch. Commits are selectively
281 pulled from the staging branch into the LTS branch only when a release is
282 being prepared and may be pulled into the LTS branch in a different order
283 than they were landed in staging.
284
285 Any collaborator may land commits into a staging branch, but only the release
286 team should land commits into the LTS branch while preparing a new
287 LTS release.
288
289 #### How can I help?
290
291 When you send your pull request, consider including information about
292 whether your change is breaking. If you think your patch can be backported,
293 please feel free to include that information in the PR thread.
294
295 Several LTS related issue and PR labels have been provided:
296
297 * `lts-watch-v4.x` - tells the LTS WG that the issue/PR needs to be considered
298   for landing in the `v4.x-staging` branch.
299 * `lts-watch-v0.10` - tells the LTS WG that the issue/PR needs to be considered
300   for landing in the `v0.10-staging` branch.
301 * `lts-watch-v0.12` - tells the LTS WG that the issue/PR needs to be considered
302   for landing in the `v0.12-staging` branch.
303 * `land-on-v4.x` - tells the release team that the commit should be landed
304   in a future v4.x release
305 * `land-on-v0.10` - tells the release team that the commit should be landed
306   in a future v0.10 release
307 * `land-on-v0.12` - tells the release team that the commit should be landed
308   in a future v0.12 release
309
310 Any collaborator can attach these labels to any PR/issue. As commits are
311 landed into the staging branches, the `lts-watch-` label will be removed.
312 Likewise, as commits are landed in a LTS release, the `land-on-` label will
313 be removed.
314
315 Collaborators are encouraged to help the LTS WG by attaching the appropriate
316 `lts-watch-` label to any PR that may impact an LTS release.
317
318 #### How is an LTS release cut?
319
320 When the LTS working group determines that a new LTS release is required,
321 selected commits will be picked from the staging branch to be included in the
322 release. This process of making a release will be a collaboration between the
323 LTS working group and the Release team.