2015-08-13 18:14:34 +02:00
# Node.js Collaborator Guide
2015-01-02 12:52:50 +01:00
**Contents**
2015-06-17 00:01:39 +02:00
* [Issues and Pull Requests ](#issues-and-pull-requests )
* [Accepting Modifications ](#accepting-modifications )
2016-02-18 18:26:43 +01:00
- [Involving the CTC ](#involving-the-ctc )
2015-06-17 00:01:39 +02:00
* [Landing Pull Requests ](#landing-pull-requests )
- [Technical HOWTO ](#technical-howto )
- [I Just Made a Mistake ](#i-just-made-a-mistake )
2015-10-19 22:26:30 +02:00
- [Long Term Support ](#long-term-support )
2015-01-02 12:52:50 +01:00
2015-08-13 18:14:34 +02:00
This document contains information for Collaborators of the Node.js
2015-01-02 12:52:50 +01:00
project regarding maintaining the code, documentation and issues.
Collaborators should be familiar with the guidelines for new
contributors in [CONTRIBUTING.md ](./CONTRIBUTING.md ) and also
understand the project governance model as outlined in
[GOVERNANCE.md ](./GOVERNANCE.md ).
## Issues and Pull Requests
Courtesy should always be shown to individuals submitting issues and
2015-08-13 18:14:34 +02:00
pull requests to the Node.js project.
2015-01-02 12:52:50 +01:00
Collaborators should feel free to take full responsibility for
managing issues and pull requests they feel qualified to handle, as
long as this is done while being mindful of these guidelines, the
2016-02-18 18:26:43 +01:00
opinions of other Collaborators and guidance of the CTC.
2015-01-02 12:52:50 +01:00
Collaborators may **close** any issue or pull request they believe is
2015-08-13 18:14:34 +02:00
not relevant for the future of the Node.js project. Where this is
2015-01-02 12:52:50 +01:00
unclear, the issue should be left open for several days to allow for
2015-08-13 18:14:34 +02:00
additional discussion. Where this does not yield input from Node.js
2015-01-02 12:52:50 +01:00
Collaborators or additional evidence that the issue has relevance, the
issue may be closed. Remember that issues can always be re-opened if
necessary.
2016-12-19 13:59:19 +01:00
[**See "Who to CC in issues"** ](./doc/onboarding-extras.md#who-to-cc-in-issues )
2016-11-15 18:47:58 +01:00
2015-01-02 12:52:50 +01:00
## Accepting Modifications
2015-08-13 18:14:34 +02:00
All modifications to the Node.js code and documentation should be
2015-01-02 12:52:50 +01:00
performed via GitHub pull requests, including modifications by
2016-02-18 18:26:43 +01:00
Collaborators and CTC members.
2015-01-02 12:52:50 +01:00
All pull requests must be reviewed and accepted by a Collaborator with
sufficient expertise who is able to take full responsibility for the
change. In the case of pull requests proposed by an existing
Collaborator, an additional Collaborator is required for sign-off.
In some cases, it may be necessary to summon a qualified Collaborator
to a pull request for review by @-mention.
If you are unsure about the modification and are not prepared to take
full responsibility for the change, defer to another Collaborator.
Before landing pull requests, sufficient time should be left for input
from other Collaborators. Leave at least 48 hours during the week and
72 hours over weekends to account for international time differences
and work schedules. Trivial changes (e.g. those which fix minor bugs
or improve performance without affecting API or causing other
wide-reaching impact) may be landed after a shorter delay.
2016-11-15 18:47:58 +01:00
For non-breaking changes, if there is no disagreement amongst
Collaborators, a pull request may be landed given appropriate review.
Where there is discussion amongst Collaborators, consensus should be
sought if possible. The lack of consensus may indicate the need to
elevate discussion to the CTC for resolution (see below).
Breaking changes (that is, pull requests that require an increase in
the major version number, known as `semver-major` changes) must be
elevated for review by the CTC. This does not necessarily mean that the
PR must be put onto the CTC meeting agenda. If multiple CTC members
approve (`LGTM`) the PR and no Collaborators oppose the PR, it can be
landed. Where there is disagreement among CTC members or objections
from one or more Collaborators, `semver-major` pull requests should be
put on the CTC meeting agenda.
2016-08-03 06:07:53 +02:00
2015-01-02 12:52:50 +01:00
All bugfixes require a test case which demonstrates the defect. The
test should *fail* before the change, and *pass* after the change.
2015-06-17 00:23:24 +02:00
All pull requests that modify executable code should be subjected to
continuous integration tests on the
2015-09-15 20:46:27 +02:00
[project CI server ](https://ci.nodejs.org/ ).
2015-06-17 00:23:24 +02:00
2016-02-18 18:26:43 +01:00
### Involving the CTC
2015-01-02 12:52:50 +01:00
2016-02-18 18:26:43 +01:00
Collaborators may opt to elevate pull requests or issues to the CTC for
2016-10-13 06:34:44 +02:00
discussion by assigning the `ctc-review` label. This should be done
2015-01-02 12:52:50 +01:00
where a pull request:
- has a significant impact on the codebase,
- is inherently controversial; or
- has failed to reach consensus amongst the Collaborators who are
actively participating in the discussion.
2016-02-18 18:26:43 +01:00
The CTC should serve as the final arbiter where required.
2015-01-02 12:52:50 +01:00
## Landing Pull Requests
2016-11-15 18:47:58 +01:00
* Please never use GitHub's green ["Merge Pull Request" ](https://help.github.com/articles/merging-a-pull-request/#merging-a-pull-request-using-the-github-web-interface ) button.
* If you do, please force-push removing the merge.
* Reasons for not using the web interface button:
* The merge method will add an unnecessary merge commit.
* The rebase & merge method adds metadata to the commit title.
* The rebase method changes the author.
* The squash & merge method has been known to add metadata to the
commit title.
* If more than one author has contributed to the PR, only the
latest author will be considered during the squashing.
2015-01-02 12:52:50 +01:00
Always modify the original commit message to include additional meta
information regarding the change process:
2016-03-11 22:03:25 +01:00
- A `PR-URL:` line that references the *full* GitHub URL of the original
2015-01-02 12:52:50 +01:00
pull request being merged so it's easy to trace a commit back to the
2015-04-01 23:32:06 +02:00
conversation that led up to that change.
2016-03-11 22:03:25 +01:00
- A `Fixes: X` line, where _X_ either includes the *full* GitHub URL
2015-01-02 12:52:50 +01:00
for an issue, and/or the hash and commit message if the commit fixes
a bug in a previous commit. Multiple `Fixes:` lines may be added if
appropriate.
2016-11-15 18:47:58 +01:00
- A `Reviewed-By: Name <email>` line for yourself and any
other Collaborators who have reviewed the change.
- Useful for @mentions / contact list if something goes wrong in the PR.
- Protects against the assumption that GitHub will be around forever.
2015-01-02 12:52:50 +01:00
2016-03-11 22:03:25 +01:00
Review the commit message to ensure that it adheres to the guidelines
2016-12-14 19:55:44 +01:00
outlined in the [contributing ](./CONTRIBUTING.md#step-3-commit ) guide.
2016-03-11 22:03:25 +01:00
2015-01-02 12:52:50 +01:00
See the commit log for examples such as
2015-08-13 18:14:34 +02:00
[this one ](https://github.com/nodejs/node/commit/b636ba8186 ) if unsure
2015-01-02 12:52:50 +01:00
exactly how to format your commit messages.
Additionally:
2015-06-13 03:59:40 +02:00
- Double check PRs to make sure the person's _full name_ and email
2015-01-02 12:52:50 +01:00
address are correct before merging.
- Except when updating dependencies, all commits should be self
2015-06-13 03:59:40 +02:00
contained (meaning every commit should pass all tests). This makes
2015-01-02 12:52:50 +01:00
it much easier when bisecting to find a breaking change.
### Technical HOWTO
_Optional:_ ensure that you are not in a borked `am` /`rebase` state
```text
$ git am --abort
$ git rebase --abort
```
Checkout proper target branch
```text
2015-04-23 17:22:38 +02:00
$ git checkout master
2015-01-02 12:52:50 +01:00
```
Update the tree
```text
$ git fetch origin
2015-04-23 17:22:38 +02:00
$ git merge --ff-only origin/master
2015-01-02 12:52:50 +01:00
```
Apply external patches
```text
2015-08-13 18:14:34 +02:00
$ curl -L https://github.com/nodejs/node/pull/xxx.patch | git am --whitespace=fix
2015-01-02 12:52:50 +01:00
```
Check and re-review the changes
```text
2015-04-23 17:22:38 +02:00
$ git diff origin/master
2015-01-02 12:52:50 +01:00
```
Check number of commits and commit messages
```text
2015-04-23 17:22:38 +02:00
$ git log origin/master...master
2015-01-02 12:52:50 +01:00
```
If there are multiple commits that relate to the same feature or
2015-06-13 03:59:40 +02:00
one with a feature and separate with a test for that feature,
you'll need to use `squash` or `fixup` :
2015-01-02 12:52:50 +01:00
```text
2015-04-23 17:22:38 +02:00
$ git rebase -i origin/master
2015-01-02 12:52:50 +01:00
```
This will open a screen like this (in the default shell editor):
```text
pick 6928fc1 crypto: add feature A
pick 8120c4c add test for feature A
pick 51759dc feature B
pick 7d6f433 test for feature B
# Rebase f9456a2..7d6f433 onto f9456a2
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
```
Replace a couple of `pick` s with `fixup` to squash them into a
previous commit:
```text
pick 6928fc1 crypto: add feature A
fixup 8120c4c add test for feature A
pick 51759dc feature B
fixup 7d6f433 test for feature B
```
Replace `pick` with `reword` to change the commit message:
```text
reword 6928fc1 crypto: add feature A
fixup 8120c4c add test for feature A
reword 51759dc feature B
fixup 7d6f433 test for feature B
```
2015-06-13 03:59:40 +02:00
Save the file and close the editor. You'll be asked to enter a new
commit message for that commit. This is a good moment to fix incorrect
commit logs, ensure that they are properly formatted, and add
`Reviewed-By` lines.
2016-12-14 19:55:44 +01:00
* The commit message text must conform to the
[commit message guidelines ](./CONTRIBUTING.md#step-3-commit ).
2015-01-02 12:52:50 +01:00
Time to push it:
```text
2015-04-23 17:22:38 +02:00
$ git push origin master
2015-04-01 23:32:06 +02:00
```
2016-11-15 18:47:58 +01:00
* Optional: Force push the amended commit to the branch you used to
open the pull request. If your branch is called `bugfix` , then the
command would be `git push --force-with-lease origin master:bugfix` .
When the pull request is closed, this will cause the pull request to
show the purple merged status rather than the red closed status that is
usually used for pull requests that weren't merged. Only do this when
landing your own contributions.
* Close the pull request with a "Landed in `<commit hash>` " comment. If
your pull request shows the purple merged status then you should still
add the "Landed in < commit hash > ..< commit hash > " comment if you added
multiple commits.
* `./configure && make -j8 test`
* `-j8` builds node in parallel with 8 threads. Adjust to the number
of cores or processor-level threads your processor has (or slightly
more) for best results.
2015-04-14 08:37:20 +02:00
2015-06-17 00:01:39 +02:00
### I Just Made a Mistake
2015-04-14 08:37:20 +02:00
2016-11-15 18:47:58 +01:00
* Ping a CTC member.
* `#node-dev` on freenode
* With `git` , there's a way to override remote trees by force pushing
2015-04-14 08:37:20 +02:00
(`git push -f`). This should generally be seen as forbidden (since
you're rewriting history on a repository other people are working
against) but is allowed for simpler slip-ups such as typos in commit
2015-08-13 18:14:34 +02:00
messages. However, you are only allowed to force push to any Node.js
2015-04-14 08:37:20 +02:00
branch within 10 minutes from your original push. If someone else
2015-06-13 03:59:40 +02:00
pushes to the branch or the 10 minute period passes, consider the
commit final.
2016-11-15 18:47:58 +01:00
* Use `--force-with-lease` to minimize the chance of overwriting
someone else's change.
* Post to `#node-dev` (IRC) if you force push.
2015-10-19 22:26:30 +02:00
### Long Term Support
#### What is LTS?
Long Term Support (often referred to as *LTS* ) guarantees application developers
a 30 month support cycle with specific versions of Node.js.
You can find more information [in the full LTS plan ](https://github.com/nodejs/lts#lts-plan ).
#### How does LTS work?
2015-11-05 01:59:59 +01:00
Once a stable branch enters LTS, changes in that branch are limited to bug
fixes, security updates, possible npm updates, documentation updates, and
certain performance improvements that can be demonstrated to not break existing
applications. Semver-minor changes are only permitted if required for bug fixes
and then only on a case-by-case basis with LTS WG and possibly Core Technical
Committee (CTC) review. Semver-major changes are permitted only if required for
security related fixes.
Once a stable branch moves into Maintenance mode, only **critical** bugs,
**critical** security fixes, and documentation updates will be permitted.
#### Landing semver-minor commits in LTS
The default policy is to not land semver-minor or higher commits in any LTS
branch. However, the LTS WG or CTC can evaluate any individual semver-minor
commit and decide whether a special exception ought to be made. It is
expected that such exceptions would be evaluated, in part, on the scope
and impact of the changes on the code, the risk to ecosystem stability
incurred by accepting the change, and the expected benefit that landing the
commit will have for the ecosystem.
Any collaborator who feels a semver-minor commit should be landed in an LTS
branch should attach the `lts-agenda` label to the pull request. The LTS WG
will discuss the issue and, if necessary, will escalate the issue up to the
CTC for further discussion.
#### How are LTS Branches Managed?
There are currently three LTS branches: `v4.x` , `v0.10` , and `v0.12` . Each
of these is paired with a "staging" branch: `v4.x-staging` , `v0.10-staging` ,
and `v0.12-staging` .
As commits land in `master` , they are cherry-picked back to each staging
branch as appropriate. If the commit applies only to the LTS branch, the
PR must be opened against the *staging* branch. Commits are selectively
pulled from the staging branch into the LTS branch only when a release is
being prepared and may be pulled into the LTS branch in a different order
than they were landed in staging.
Any collaborator may land commits into a staging branch, but only the release
team should land commits into the LTS branch while preparing a new
LTS release.
2015-10-19 22:26:30 +02:00
#### How can I help?
When you send your pull request, consider including information about
whether your change is breaking. If you think your patch can be backported,
please feel free to include that information in the PR thread.
2015-11-05 01:59:59 +01:00
Several LTS related issue and PR labels have been provided:
* `lts-watch-v4.x` - tells the LTS WG that the issue/PR needs to be considered
for landing in the `v4.x-staging` branch.
* `lts-watch-v0.10` - tells the LTS WG that the issue/PR needs to be considered
for landing in the `v0.10-staging` branch.
* `lts-watch-v0.12` - tells the LTS WG that the issue/PR needs to be considered
for landing in the `v0.12-staging` branch.
* `land-on-v4.x` - tells the release team that the commit should be landed
in a future v4.x release
* `land-on-v0.10` - tells the release team that the commit should be landed
in a future v0.10 release
* `land-on-v0.12` - tells the release team that the commit should be landed
in a future v0.12 release
Any collaborator can attach these labels to any PR/issue. As commits are
landed into the staging branches, the `lts-watch-` label will be removed.
Likewise, as commits are landed in a LTS release, the `land-on-` label will
be removed.
Collaborators are encouraged to help the LTS WG by attaching the appropriate
`lts-watch-` label to any PR that may impact an LTS release.
2015-10-19 22:26:30 +02:00
#### How is an LTS release cut?
2015-11-05 01:59:59 +01:00
When the LTS working group determines that a new LTS release is required,
selected commits will be picked from the staging branch to be included in the
release. This process of making a release will be a collaboration between the
LTS working group and the Release team.