1# Node.js collaborator guide 2 3## Contents 4 5* [Issues and pull requests](#issues-and-pull-requests) 6 * [Welcoming first-time contributors](#welcoming-first-time-contributors) 7 * [Closing issues and pull requests](#closing-issues-and-pull-requests) 8 * [Author ready pull requests](#author-ready-pull-requests) 9 * [Handling own pull requests](#handling-own-pull-requests) 10 * [Security issues](#managing-security-issues) 11* [Accepting modifications](#accepting-modifications) 12 * [Code reviews](#code-reviews) 13 * [Consensus seeking](#consensus-seeking) 14 * [Waiting for approvals](#waiting-for-approvals) 15 * [Testing and CI](#testing-and-ci) 16 * [Useful Jenkins CI jobs](#useful-jenkins-ci-jobs) 17 * [Starting a Jenkins CI job](#starting-a-jenkins-ci-job) 18 * [Internal vs. public API](#internal-vs-public-api) 19 * [Breaking changes](#breaking-changes) 20 * [Breaking changes and deprecations](#breaking-changes-and-deprecations) 21 * [Breaking changes to internal elements](#breaking-changes-to-internal-elements) 22 * [Unintended breaking changes](#unintended-breaking-changes) 23 * [Reverting commits](#reverting-commits) 24 * [Introducing new modules](#introducing-new-modules) 25 * [Additions to Node-API](#additions-to-n-api) 26 * [Deprecations](#deprecations) 27 * [Involving the TSC](#involving-the-tsc) 28* [Landing pull requests](#landing-pull-requests) 29 * [Using `git-node`](#using-git-node) 30 * [Technical HOWTO](#technical-howto) 31 * [Troubleshooting](#troubleshooting) 32 * [I made a mistake](#i-made-a-mistake) 33 * [Long Term Support](#long-term-support) 34 * [What is LTS?](#what-is-lts) 35 * [How are LTS branches managed?](#how-are-lts-branches-managed) 36 * [How can I help?](#how-can-i-help) 37* [Who to CC in the issue tracker](#who-to-cc-in-the-issue-tracker) 38 39This document explains how collaborators manage the Node.js project. 40Collaborators should understand the 41[guidelines for new contributors](../../CONTRIBUTING.md) and the 42[project governance model](../../GOVERNANCE.md). 43 44## Issues and pull requests 45 46Mind these guidelines, the opinions of other collaborators, and guidance of the 47[TSC][]. Notify other qualified parties for more input on an issue or a pull 48request. See [Who to CC in the issue tracker](#who-to-cc-in-the-issue-tracker). 49 50### Welcoming first-time contributors 51 52Always show courtesy to individuals submitting issues and pull requests. Be 53welcoming to first-time contributors, identified by the GitHub 54![First-time contributor](../first_timer_badge.png) badge. 55 56For first-time contributors, check if the commit author is the same as the pull 57request author. This way, once their pull request lands, GitHub will show them 58as a _Contributor_. Ask if they have configured their git 59[username][git-username] and [email][git-email] to their liking. 60 61### Closing issues and pull requests 62 63Collaborators can close any issue or pull request that is not relevant to the 64future of the Node.js project. Where this is unclear, leave the issue or pull 65request open for several days to allow for discussion. Where this does not yield 66evidence that the issue or pull request has relevance, close it. Remember that 67issues and pull requests can always be re-opened if necessary. 68 69### Author ready pull requests 70 71A pull request is _author ready_ when: 72 73* There is a CI run in progress or completed. 74* There is at least one collaborator approval. 75* There are no outstanding review comments. 76 77Please always add the `author ready` label to the pull request in that case. 78Please always remove it again as soon as the conditions are not met anymore. 79 80### Handling own pull requests 81 82When you open a pull request, [start a CI](#testing-and-ci) right away. Later, 83after new code changes or rebasing, start a new CI. 84 85As soon as the pull request is ready to land, please do so. This allows other 86collaborators to focus on other pull requests. If your pull request is not ready 87to land but is [author ready](#author-ready-pull-requests), add the 88`author ready` label. If you wish to land the pull request yourself, use the 89"assign yourself" link to self-assign it. 90 91### Managing security issues 92 93Use the process outlined in [SECURITY.md][] to report security 94issues. If a user opens a security issue in the public repository: 95 96* Ask the user to submit a report through HackerOne as outlined in 97 [SECURITY.md][]. 98* Move the issue to the private repository called 99 [premature-disclosures](https://github.com/nodejs/premature-disclosures). 100* For any related pull requests, create an associated issue in the 101 `premature-disclosures` repository. Add a copy of the patch for the 102 pull request to the issue. Add screenshots of discussion from the pull request 103 to the issue. 104* [Open a ticket with GitHub](https://support.github.com/contact) to delete the 105 pull request using Node.js (team) as the account organization. 106* Open a new issue in the public repository with the title `FYI - pull request 107 deleted #YYYY`. Include an explanation for the user: 108 > FYI @xxxx we asked GitHub to delete your pull request while we work on 109 > releases in private. 110* Email `tsc@iojs.org` with links to the issues in the 111 `premature-disclosures` repository. 112 113## Accepting modifications 114 115Contributors propose modifications to Node.js using GitHub pull requests. This 116includes modifications proposed by TSC members and other collaborators. A pull 117request must pass code review and CI before landing into the codebase. 118 119### Code reviews 120 121At least two collaborators must approve a pull request before the pull request 122lands. One collaborator approval is enough if the pull request has been open 123for more than seven days. 124 125Approving a pull request indicates that the collaborator accepts responsibility 126for the change. 127 128Approval must be from collaborators who are not authors of the change. 129 130In some cases, it might be necessary to summon a GitHub team to a pull request 131for review by @-mention. 132See [Who to CC in the issue tracker](#who-to-cc-in-the-issue-tracker). 133 134If you are the first collaborator to approve a pull request that has no CI yet, 135please [start one](#testing-and-ci). Please also start a new CI if the 136pull request creator pushed new code since the last CI run. 137 138### Consensus seeking 139 140A pull request can land if it has the needed [approvals](#code-reviews), 141[CI](#testing-and-ci), [wait time](#waiting-for-approvals) and no 142[outstanding objections](#objections). [Breaking changes](#breaking-changes) 143must receive [TSC review](#involving-the-tsc) in addition to other 144requirements. If a pull request meets all requirements except the 145[wait time](#waiting-for-approvals), please add the 146[`author ready`](#author-ready-pull-requests) label. 147 148#### Objections 149 150Collaborators can object to a pull request by using the "Request 151Changes" GitHub feature. Dissent comments alone don't constitute an 152objection. Any pull request objection must include a clear reason for that 153objection, and the objector must remain responsive for further discussion 154towards consensus about the direction of the pull request. Where possible, 155provide a set of actionable steps alongside the objection. 156 157If the objection is not clear to others, another collaborator can ask an 158objecting collaborator to explain their objection or to provide actionable 159steps to resolve the objection. If the objector is unresponsive for seven 160days after a collaborator asks for clarification, a collaborator may 161dismiss the objection. 162 163Pull requests with outstanding objections must remain open until all 164objections are satisfied. If reaching consensus is not possible, a 165collaborator can escalate the issue to the TSC by pinging `@nodejs/tsc` and 166adding the `tsc-agenda` label to the issue. 167 168#### Helpful resources 169 170* [How to Do Code Reviews Like a Human (Part One)](https://mtlynch.io/human-code-reviews-1/) 171* [How to Do Code Reviews Like a Human (Part Two)](https://mtlynch.io/human-code-reviews-2/) 172* [Code Review Etiquette](https://css-tricks.com/code-review-etiquette/) 173 174### Waiting for approvals 175 176Before landing pull requests, allow 48 hours for input from other collaborators. 177Certain types of pull requests can be fast-tracked and can land after a shorter 178delay. For example: 179 180* Focused changes that affect only documentation and/or the test suite: 181 * `code-and-learn` tasks often fall into this category. 182 * `good-first-issue` pull requests might also be suitable. 183* Changes that fix regressions: 184 * Regressions that break the workflow (red CI or broken compilation). 185 * Regressions that happen right before a release, or reported soon after. 186 187To propose fast-tracking a pull request, apply the `fast-track` label. Then add 188a comment that collaborators can upvote. 189 190If someone disagrees with the fast-tracking request, remove the label. Do not 191fast-track the pull request in that case. 192 193The pull request can be fast-tracked if two collaborators approve the 194fast-tracking request. To land, the pull request itself still needs two 195collaborator approvals and a passing CI. 196 197Collaborators can request fast-tracking of pull requests they did not author. 198In that case only, the request itself is also one fast-track approval. Upvote 199the comment anyway to avoid any doubt. 200 201### Testing and CI 202 203All fixes must have a test case which demonstrates the defect. The test should 204fail before the change, and pass after the change. 205 206Do not land any pull requests without the necessary passing CI runs. 207A passing (green) GitHub Actions CI result is required. A passing (green or 208yellow) [Jenkins CI](https://ci.nodejs.org/) is also required if the pull 209request contains changes that will affect the `node` binary. This is because 210GitHub Actions CI does not cover all the environments supported by Node.js. 211 212<details> 213<summary>Changes that affect the `node` binary</summary> 214 215Changes in the following folders (except comment-only changes) are guaranteed to 216affect the `node` binary: 217 218* `deps/` 219* `lib/` 220* `src/` 221* `test/` 222* `tools/code_cache/` 223* `tools/gyp/` 224* `tools/icu/` 225* `tools/inspector-protocol/` 226* `tools/msvs/` 227* `tools/snapshot/` 228* `tools/v8_gypfiles/` 229 230There are some other files that touch the build chain. Changes in the following 231files also qualify as affecting the `node` binary: 232 233* `tools/*.py` 234* `tools/build-addons.js` 235* `*.gyp` 236* `*.gypi` 237* `configure` 238* `configure.py` 239* `Makefile` 240* `vcbuilt.bat` 241 242</details> 243 244If there are GitHub Actions CI failures unrelated to the change in the pull 245request, try "Re-run all jobs". It's under the " Re-run jobs" button, on the 246right-hand side of "Checks" tab. 247 248If there are Jenkins CI failures unrelated to the change in the pull request, 249try "Resume Build". It is in the left navigation of the relevant 250`node-test-pull-request` job. It will preserve all the green results from the 251current job but re-run everything else. Start a fresh CI if more than seven days 252have elapsed since the original failing CI as the compiled binaries for the 253Windows and ARM platforms are only kept for seven days. 254 255#### Useful Jenkins CI jobs 256 257* [`node-test-pull-request`](https://ci.nodejs.org/job/node-test-pull-request/) 258is the CI job to test pull requests. It runs the `build-ci` and `test-ci` 259targets on all supported platforms. 260 261* [`citgm-smoker`](https://ci.nodejs.org/job/citgm-smoker/) 262uses [`CitGM`](https://github.com/nodejs/citgm) to allow you to run 263`npm install && npm test` on a large selection of common modules. This is 264useful to check whether a change will cause breakage in the ecosystem. 265 266* [`node-stress-single-test`](https://ci.nodejs.org/job/node-stress-single-test/) 267can run a group of tests over and over on a specific platform. Use it to check 268that the tests are reliable. 269 270* [`node-test-commit-v8-linux`](https://ci.nodejs.org/job/node-test-commit-v8-linux/) 271runs the standard V8 tests. Run it when updating V8 in Node.js or floating new 272patches on V8. 273 274* [`node-test-commit-custom-suites-freestyle`](https://ci.nodejs.org/job/node-test-commit-custom-suites-freestyle/) 275enables customization of test suites and parameters. It can execute test suites 276not used in other CI test runs (such as tests in the `internet` or `pummel` 277directories). It can also make sure tests pass when provided with a flag not 278used in other CI test runs (such as `--worker`). 279 280#### Starting a Jenkins CI job 281 282From the CI Job page, click "Build with Parameters" on the left side. 283 284You generally need to enter only one or both of the following options 285in the form: 286 287* `GIT_REMOTE_REF`: Change to the remote portion of git refspec. 288To specify the branch this way, `refs/heads/BRANCH` is used 289(e.g. for `master` -> `refs/heads/master`). 290For pull requests, it will look like `refs/pull/PR_NUMBER/head` 291(e.g. for pull request #42 -> `refs/pull/42/head`). 292* `REBASE_ONTO`: Change that to `origin/master` so the pull request gets rebased 293onto master. This can especially be important for pull requests that have been 294open a while. 295 296Look at the list of jobs on the left hand side under "Build History" and copy 297the link to the one you started (which will be the one on top, but click 298through to make sure it says something like "Started 5 seconds ago" 299(top right) and "Started by user ...". 300 301Copy/paste the URL for the job into a comment in the pull request. 302[`node-test-pull-request`](https://ci.nodejs.org/job/node-test-pull-request/) 303is an exception where the GitHub bot will automatically post for you. 304 305The [`node-test-pull-request`](https://ci.nodejs.org/job/node-test-pull-request/) 306CI job can be started by adding the `request-ci` label into the pull request. 307Once this label is added, `github-actions bot` will start 308the `node-test-pull-request` automatically. If the `github-actions bot` 309is unable to start the job, it will update the label with `request-ci-failed`. 310 311### Internal vs. public API 312 313All functionality in the official Node.js documentation is part of the public 314API. Any undocumented object, property, method, argument, behavior, or event is 315internal. There are exceptions to this rule. Node.js users have come to rely on 316some undocumented behaviors. Collaborators treat many of those undocumented 317behaviors as public. 318 319All undocumented functionality exposed via `process.binding(...)` is internal. 320 321All undocumented functionality in `lib/internal/**/*.js` is internal. It is 322public, though, if it is re-exported by code in `lib/*.js`. 323 324Non-exported `Symbol` properties and methods are internal. 325 326Any undocumented object property or method that begins with `_` is internal. 327 328Any native C/C++ APIs/ABIs requiring the `NODE_WANT_INTERNALS` flag are 329internal. 330 331Sometimes, there is disagreement about whether functionality is internal or 332public. In those cases, the TSC makes a determination. 333 334For undocumented APIs that are public, open a pull request documenting the API. 335 336### Breaking changes 337 338At least two TSC members must approve backward-incompatible changes to the 339master branch. 340 341Examples of breaking changes include: 342 343* Removal or redefinition of existing API arguments. 344* Changing return values. 345* Removing or modifying existing properties on an options argument. 346* Adding or removing errors. 347* Altering expected timing of an event. 348* Changing the side effects of using a particular API. 349 350#### Breaking changes and deprecations 351 352Existing stable public APIs that change in a backward-incompatible way must 353undergo deprecation. The exceptions to this rule are: 354 355* Adding or removing errors thrown or reported by a public API. 356* Changing error messages for errors without error code. 357* Altering the timing and non-internal side effects of the public API. 358* Changes to errors thrown by dependencies of Node.js, such as V8. 359* One-time exceptions granted by the TSC. 360 361For more information, see [Deprecations](#deprecations). 362 363#### Breaking changes to internal elements 364 365Breaking changes to internal elements can occur in semver-patch or semver-minor 366commits. Take significant care when making and reviewing such changes. Make 367an effort to determine the potential impact of the change in the ecosystem. Use 368[Canary in the Goldmine](https://github.com/nodejs/citgm) to test such changes. 369If a change will cause ecosystem breakage, then it is semver-major. Consider 370providing a Public API in such cases. 371 372#### Unintended breaking changes 373 374Sometimes, a change intended to be non-breaking turns out to be a breaking 375change. If such a change lands on the master branch, a collaborator can revert 376it. As an alternative to reverting, the TSC can apply the semver-major label 377after-the-fact. 378 379##### Reverting commits 380 381Revert commits with `git revert <HASH>` or `git revert <FROM>..<TO>`. The 382generated commit message will not have a subsystem and might violate line length 383rules. That is OK. Append the reason for the revert and any `Refs` or `Fixes` 384metadata. Raise a pull request like any other change. 385 386### Introducing new modules 387 388Treat commits that introduce new core modules with extra care. 389 390Check if the module's name conflicts with an existing ecosystem module. If it 391does, choose a different name unless the module owner has agreed in writing to 392transfer it. 393 394If the new module name is free, register a placeholder in the module registry as 395soon as possible. Link to the pull request that introduces the new core module 396in the placeholder's `README`. 397 398For pull requests introducing new core modules: 399 400* Allow at least one week for review. 401* Land only after sign-off from at least two TSC members. 402* Land with a [Stability Index][] of Experimental. The module must remain 403 Experimental until a semver-major release. 404 405### Additions to Node-API 406 407Node-API provides an ABI-stable API guaranteed for future Node.js versions. 408Node-API additions call for unusual care and scrutiny. If a change adds to 409`node_api.h`, `js_native_api.h`, `node_api_types.h`, or `js_native_api_types.h`, 410consult [the relevant guide](https://github.com/nodejs/node/blob/HEAD/doc/guides/adding-new-napi-api.md). 411 412### Deprecations 413 414Node.js uses three [Deprecation][] levels. For all deprecated APIs, the API 415documentation must state the deprecation status. 416 417* Documentation-Only Deprecation 418 * A deprecation notice appears in the API documentation. 419 * There are no functional changes. 420 * By default, there will be no warnings emitted for such deprecations at 421 runtime. 422 * Might cause a runtime warning with the [`--pending-deprecation`][] flag or 423 `NODE_PENDING_DEPRECATION` environment variable. 424 425* Runtime Deprecation 426 * Emits a warning at runtime on first use of the deprecated API. 427 * If used with the [`--throw-deprecation`][] flag, will throw a runtime error. 428 429* End-of-Life 430 * The API is no longer subject to the semantic versioning rules. 431 * Backward-incompatible changes including complete removal of such APIs can 432 occur at any time. 433 434Apply the `notable change` label to all pull requests that introduce 435Documentation-Only Deprecations. Such deprecations have no impact on code 436execution. Thus, they are not breaking changes (`semver-major`). 437 438Runtime Deprecations and End-of-Life APIs (internal or public) are breaking 439changes (`semver-major`). The TSC can make exceptions, deciding that one of 440these deprecations is not a breaking change. 441 442Avoid Runtime Deprecations when an alias or a stub/no-op will suffice. An alias 443or stub will have lower maintenance costs for end users and Node.js core. 444 445All deprecations receive a unique and immutable identifier. Documentation, 446warnings, and errors use the identifier when referring to the deprecation. The 447documentation for the deprecation identifier must always remain in the API 448documentation. This is true even if the deprecation is no longer in use (for 449example, due to removal of an End-of-Life deprecated API). 450 451<a id="deprecation-cycle"></a> 452A _deprecation cycle_ is a major release during which an API has been in one of 453the three Deprecation levels. Documentation-Only Deprecations can land in a 454minor release. They can not change to a Runtime Deprecation until the next major 455release. 456 457No API can change to End-of-Life without going through a Runtime Deprecation 458cycle. There is no rule that deprecated code must progress to End-of-Life. 459Documentation-Only and Runtime Deprecations can remain in place for an unlimited 460duration. 461 462Communicate pending deprecations and associated mitigations with the ecosystem 463as soon as possible. If possible, do it before the pull request adding the 464deprecation lands on the master branch. 465 466Use the `notable-change` label on pull requests that add or change the 467deprecation level of an API. 468 469### Involving the TSC 470 471Collaborators can opt to elevate pull requests or issues to the [TSC][]. 472Do this if a pull request or issue: 473 474* Is labeled `semver-major`, or 475* Has a significant impact on the codebase, or 476* Is controversial, or 477* Is at an impasse among collaborators who are participating in the discussion. 478 479@-mention the `@nodejs/tsc` GitHub team if you want to elevate an issue to the 480[TSC][]. Do not use the GitHub UI on the right-hand side to assign to 481`@nodejs/tsc` or request a review from `@nodejs/tsc`. 482 483The TSC serves as the final arbiter where required. 484 485## Landing pull requests 486 4871. Avoid landing pull requests that have someone else as an assignee. Authors 488 who wish to land their own pull requests will self-assign them. Sometimes, an 489 author will delegate to someone else. If in doubt, ask the assignee whether 490 it is okay to land. 4911. Never use GitHub's green ["Merge pull request"][] button. Reasons for not 492 using the web interface button: 493 * The "Create a merge commit" method will add an unnecessary merge commit. 494 * The "Squash and merge" method will add metadata (the pull request #) to the 495 commit title. If more than one author contributes to the pull request, 496 squashing only keeps one author. 497 * The "Rebase and merge" method has no way of adding metadata to the commit. 4981. Make sure CI is complete and green. If the CI is not green, check for 499 unreliable tests and infrastructure failures. If there are not corresponding 500 issues in the [node][unreliable tests] or 501 [build](https://github.com/nodejs/build/issues) repositories, open new 502 issues. Run a new CI any time someone pushes new code to the pull request. 5031. Check that the commit message adheres to [commit message guidelines][]. 5041. Add all necessary [metadata](#metadata) to commit messages before landing. If 505 you are unsure exactly how to format the commit messages, use the commit log 506 as a reference. See [this commit][commit-example] as an example. 507 508For pull requests from first-time contributors, be 509[welcoming](#welcoming-first-time-contributors). Also, verify that their git 510settings are to their liking. 511 512All commits should be self-contained, meaning every commit should pass all 513tests. This makes it much easier when bisecting to find a breaking change. 514 515### Using `git-node` 516 517In most cases, using [the `git-node` command][git-node] of [`node-core-utils`][] 518is enough to land a pull request. If you discover a problem when using 519this tool, please file an issue [to the issue tracker][node-core-utils-issues]. 520 521Quick example: 522 523```text 524$ npm install -g node-core-utils 525$ git node land $PRID 526``` 527 528To use `node-core-utils`, you will need a GitHub access token. If you do not 529have one, `node-core-utils` will create one for you the first time you use it. 530To do this, it will ask for your GitHub password and two-factor authentication 531code. If you wish to create the token yourself in advance, see 532[the `node-core-utils` guide][node-core-utils-credentials]. 533 534### Technical HOWTO 535 536Infrequently, it is necessary to manually perform the steps required to land a 537pull request rather than rely on `git-node`. 538 539<details> 540<Summary>Manual Landing Steps</Summary> 541 542Clear any `am`/`rebase` that might already be underway: 543 544```text 545$ git am --abort 546$ git rebase --abort 547``` 548 549Checkout proper target branch: 550 551```text 552$ git checkout master 553``` 554 555Update the tree (assumes your repository is set up as detailed in 556[CONTRIBUTING.md](./contributing/pull-requests.md#step-1-fork)): 557 558```text 559$ git fetch upstream 560$ git merge --ff-only upstream/master 561``` 562 563Apply external patches: 564 565```text 566$ curl -L https://github.com/nodejs/node/pull/xxx.patch | git am --whitespace=fix 567``` 568 569If the merge fails even though recent CI runs were successful, try a 3-way 570merge: 571 572```text 573$ git am --abort 574$ curl -L https://github.com/nodejs/node/pull/xxx.patch | git am -3 --whitespace=fix 575``` 576 577If the 3-way merge succeeds, check the results against the original pull 578request. Build and test on at least one platform before landing. 579 580If the 3-way merge fails, then it is most likely that a conflicting pull request 581has landed since the CI run. You will have to ask the author to rebase. 582 583Check and re-review the changes: 584 585```text 586$ git diff upstream/master 587``` 588 589Check the number of commits and commit messages: 590 591```text 592$ git log upstream/master...master 593``` 594 595Squash commits and add metadata: 596 597```text 598$ git rebase -i upstream/master 599``` 600 601This will open a screen like this (in the default shell editor): 602 603```text 604pick 6928fc1 crypto: add feature A 605pick 8120c4c add test for feature A 606pick 51759dc crypto: feature B 607pick 7d6f433 test for feature B 608 609# Rebase f9456a2..7d6f433 onto f9456a2 610# 611# Commands: 612# p, pick = use commit 613# r, reword = use commit, but edit the commit message 614# e, edit = use commit, but stop for amending 615# s, squash = use commit, but meld into previous commit 616# f, fixup = like "squash", but discard this commit's log message 617# x, exec = run command (the rest of the line) using shell 618# 619# These lines can be re-ordered; they are executed from top to bottom. 620# 621# If you remove a line here THAT COMMIT WILL BE LOST. 622# 623# However, if you remove everything, the rebase will be aborted. 624# 625# Note that empty commits are commented out 626``` 627 628Replace a couple of `pick`s with `fixup` to squash them into a 629previous commit: 630 631```text 632pick 6928fc1 crypto: add feature A 633fixup 8120c4c add test for feature A 634pick 51759dc crypto: feature B 635fixup 7d6f433 test for feature B 636``` 637 638Replace `pick` with `reword` to change the commit message: 639 640```text 641reword 6928fc1 crypto: add feature A 642fixup 8120c4c add test for feature A 643reword 51759dc crypto: feature B 644fixup 7d6f433 test for feature B 645``` 646 647Save the file and close the editor. When prompted, enter a new commit message 648for that commit. This is an opportunity to fix commit messages. 649 650* The commit message text must conform to the [commit message guidelines][]. 651* <a name="metadata"></a>Change the original commit message to include metadata. (The 652 [`git node metadata`][git-node-metadata] command can generate the metadata 653 for you). 654 655 * Required: A `PR-URL:` line that references the full GitHub URL of the pull 656 request. This makes it easy to trace a commit back to the conversation that 657 led up to that change. 658 * Optional: A `Fixes: X` line, where _X_ is the full GitHub URL for an 659 issue. A commit message can include more than one `Fixes:` lines. 660 * Optional: One or more `Refs:` lines referencing a URL for any relevant 661 background. 662 * Required: A `Reviewed-By: Name <email>` line for each collaborator who 663 reviewed the change. 664 * Useful for @mentions / contact list if something goes wrong in the 665 pull request. 666 * Protects against the assumption that GitHub will be around forever. 667 668Other changes might have landed on master since the successful CI run. As a 669precaution, run tests (`make -j4 test` or `vcbuild test`). 670 671Confirm that the commit message format is correct using 672[core-validate-commit](https://github.com/nodejs/core-validate-commit). 673 674```text 675$ git rev-list upstream/master...HEAD | xargs core-validate-commit 676``` 677 678Optional: For your own commits, force push the amended commit to the pull 679request branch. If your branch name is `bugfix`, then: `git push 680--force-with-lease origin master:bugfix`. Don't close the pull request. 681It will close after you push it upstream. It will have the purple merged 682status rather than the red closed status. If you close the pull request 683before GitHub adjusts its status, it will show up as a 0 commit pull 684request with no changed files. The order of operations is important. 685If you push upstream before you push to your branch, GitHub will close 686the issue with the red closed status. 687 688Time to push it: 689 690```text 691$ git push upstream master 692``` 693 694Close the pull request with a "Landed in `<commit hash>`" comment. Even if 695your pull request shows the purple merged status, 696add the "Landed in \<commit hash>..\<commit hash>" comment if you added 697more than one commit. 698 699</details> 700 701### Troubleshooting 702 703Sometimes, when running `git push upstream master`, you might get an error 704message like this: 705 706```console 707To https://github.com/nodejs/node 708 ! [rejected] master -> master (fetch first) 709error: failed to push some refs to 'https://github.com/nodejs/node' 710hint: Updates were rejected because the tip of your current branch is behind 711hint: its remote counterpart. Integrate the remote changes (e.g. 712hint: 'git pull ...') before pushing again. 713hint: See the 'Note about fast-forwards' in 'git push --help' for details. 714``` 715 716That means a commit has landed since your last rebase against `upstream/master`. 717To fix this, pull with rebase from upstream, run the tests again, and (if the 718tests pass) push again: 719 720```bash 721git pull upstream master --rebase 722make -j4 test 723git push upstream master 724``` 725 726### I made a mistake 727 728* Ping a TSC member. 729* With `git`, there's a way to override remote trees by force pushing 730 (`git push -f`). This is generally forbidden as it creates conflicts in other 731 people's forks. It is permissible for simpler slip-ups such as typos in commit 732 messages. You are only allowed to force push to any Node.js branch within 10 733 minutes from your original push. If someone else pushes to the branch or the 734 10-minute period passes, consider the commit final. 735 * Use `--force-with-lease` to reduce the chance of overwriting someone else's 736 change. 737 738### Long Term Support 739 740#### What is LTS? 741 742Long Term Support (LTS) guarantees 30-month support cycles for specific Node.js 743versions. You can find more information 744[in the full release plan](https://github.com/nodejs/Release#release-plan). Once 745a branch enters LTS, the release plan limits the types of changes permitted in 746the branch. 747 748#### How are LTS branches managed? 749 750Each LTS release has a corresponding branch (v10.x, v8.x, etc.). Each also has a 751corresponding staging branch (v10.x-staging, v8.x-staging, etc.). 752 753Commits that land on master are cherry-picked to each staging branch as 754appropriate. If a change applies only to the LTS branch, open the pull request 755against the *staging* branch. Commits from the staging branch land on the LTS 756branch only when a release is being prepared. They might land on the LTS branch 757in a different order than they do in staging. 758 759Only members of @nodejs/backporters should land commits onto LTS staging 760branches. 761 762#### How can I help? 763 764When you send your pull request, please state if your change is breaking. Also 765state if you think your patch is a good candidate for backporting. For more 766information on backporting, please see the [backporting guide][]. 767 768There are several LTS-related labels: 769 770* `lts-watch-` labels are for pull requests to consider for landing in staging 771 branches. For example, `lts-watch-v10.x` would be for a change 772 to consider for the `v10.x-staging` branch. 773 774* `land-on-` are for pull requests that should land in a future v*.x 775 release. For example, `land-on-v10.x` would be for a change to land in Node.js 776 10.x. 777 778Any collaborator can attach these labels to any pull request/issue. As commits 779land on the staging branches, the backporter removes the `lts-watch-` label. 780Likewise, as commits land in an LTS release, the releaser removes the `land-on-` 781label. 782 783Attach the appropriate `lts-watch-` label to any pull request that 784might impact an LTS release. 785 786## Who to CC in the issue tracker 787 788| Subsystem | Maintainers | 789| --- | --- | 790| `benchmark/*` | @nodejs/benchmarking, @mscdex | 791| `doc/*`, `*.md` | @nodejs/documentation | 792| `lib/assert` | @nodejs/assert | 793| `lib/async_hooks` | @nodejs/async\_hooks for bugs/reviews (+ @nodejs/diagnostics for API) | 794| `lib/buffer` | @nodejs/buffer | 795| `lib/child_process` | @nodejs/child\_process | 796| `lib/cluster` | @nodejs/cluster | 797| `lib/{crypto,tls,https}` | @nodejs/crypto | 798| `lib/dgram` | @nodejs/dgram | 799| `lib/domains` | @nodejs/domains | 800| `lib/fs`, `src/{fs,file}` | @nodejs/fs | 801| `lib/{_}http{*}` | @nodejs/http | 802| `lib/inspector.js`, `src/inspector_*` | @nodejs/v8-inspector | 803| `lib/internal/bootstrap/*` | @nodejs/process | 804| `lib/internal/url`, `src/node_url` | @nodejs/url | 805| `lib/net` | @bnoordhuis, @indutny, @nodejs/streams | 806| `lib/repl` | @nodejs/repl | 807| `lib/{_}stream{*}` | @nodejs/streams | 808| `lib/timers` | @nodejs/timers | 809| `lib/util` | @nodejs/util | 810| `lib/zlib` | @nodejs/zlib | 811| `src/async_wrap.*` | @nodejs/async\_hooks | 812| `src/node_api.*` | @nodejs/n-api | 813| `src/node_crypto.*` | @nodejs/crypto | 814| `test/*` | @nodejs/testing | 815| `tools/node_modules/eslint`, `.eslintrc` | @nodejs/linting | 816| build | @nodejs/build | 817| `src/module_wrap.*`, `lib/internal/modules/*`, `lib/internal/vm/module.js` | @nodejs/modules | 818| GYP | @nodejs/gyp | 819| performance | @nodejs/performance | 820| platform specific | @nodejs/platform-{aix,arm,freebsd,macos,ppc,smartos,s390,windows} | 821| python code | @nodejs/python | 822| upgrading c-ares | @rvagg | 823| upgrading http-parser | @nodejs/http, @nodejs/http2 | 824| upgrading libuv | @nodejs/libuv | 825| upgrading npm | @nodejs/npm | 826| upgrading V8 | @nodejs/V8, @nodejs/post-mortem | 827| Embedded use or delivery of Node.js | @nodejs/delivery-channels | 828 829When things need extra attention, are controversial, or `semver-major`: 830@nodejs/tsc 831 832If you cannot find who to cc for a file, `git shortlog -n -s <file>` can help. 833 834## Labels 835 836### General labels 837 838* `confirmed-bug`: Bugs you have verified 839* `discuss`: Things that need larger discussion 840* `feature request`: Any issue that requests a new feature 841* `good first issue`: Issues suitable for newcomers to fix 842* `meta`: Governance, policies, procedures, etc. 843* `tsc-agenda`: Open issues and pull requests with this label will be added to 844 the Technical Steering Committee meeting agenda 845 846--- 847 848* `author-ready` - A pull request is _author ready_ when: 849 * There is a CI run in progress or completed. 850 * There is at least one collaborator approval (or two TSC approvals for 851 semver-major pull requests). 852 * There are no outstanding review comments. 853 854Please always add the `author ready` label to pull requests that qualify. 855Please always remove it again as soon as the conditions are not met anymore, 856such as if the CI run fails or a new outstanding review comment is posted. 857 858--- 859 860* `semver-{minor,major}` 861 * be conservative – that is, if a change has the remote *chance* of breaking 862 something, go for semver-major 863 * when adding a semver label, add a comment explaining why you're adding it 864 * minor vs. patch: roughly: "does it add a new method / does it add a new 865 section to the docs" 866 * major vs. everything else: run last versions tests against this version, if 867 they pass, **probably** minor or patch 868 869### LTS/version labels 870 871We use labels to keep track of which branches a commit should land on: 872 873* `dont-land-on-v?.x` 874 * For changes that do not apply to a certain release line 875 * Also used when the work of backporting a change outweighs the benefits 876* `land-on-v?.x` 877 * Used by releasers to mark a pull request as scheduled for inclusion in an 878 LTS release 879 * Applied to the original pull request for clean cherry-picks, to the backport 880 pull request otherwise 881* `backport-requested-v?.x` 882 * Used to indicate that a pull request needs a manual backport to a branch in 883 order to land the changes on that branch 884 * Typically applied by a releaser when the pull request does not apply cleanly 885 or it breaks the tests after applying 886 * Will be replaced by either `dont-land-on-v?.x` or `backported-to-v?.x` 887* `backported-to-v?.x` 888 * Applied to pull requests for which a backport pull request has been merged 889* `lts-watch-v?.x` 890 * Applied to pull requests which the Release working group should consider 891 including in an LTS release 892 * Does not indicate that any specific action will be taken, but can be 893 effective as messaging to non-collaborators 894* `release-agenda` 895 * For things that need discussion by the Release working group 896 * (for example semver-minor changes that need or should go into an LTS 897 release) 898* `v?.x` 899 * Automatically applied to changes that do not target `master` but rather the 900 `v?.x-staging` branch 901 902Once a release line enters maintenance mode, the corresponding labels do not 903need to be attached anymore, as only important bugfixes will be included. 904 905### Other labels 906 907* Operating system labels 908 * `macos`, `windows`, `smartos`, `aix` 909 * No `linux` label because it is the implied default 910* Architecture labels 911 * `arm`, `mips`, `s390`, `ppc` 912 * No `x86{_64}` label because it is the implied default 913 914["Merge pull request"]: https://help.github.com/articles/merging-a-pull-request/#merging-a-pull-request-on-github 915[Deprecation]: https://en.wikipedia.org/wiki/Deprecation 916[SECURITY.md]: https://github.com/nodejs/node/blob/HEAD/SECURITY.md 917[Stability Index]: ../api/documentation.md#stability-index 918[TSC]: https://github.com/nodejs/TSC 919[`--pending-deprecation`]: ../api/cli.md#--pending-deprecation 920[`--throw-deprecation`]: ../api/cli.md#--throw-deprecation 921[`node-core-utils`]: https://github.com/nodejs/node-core-utils 922[backporting guide]: backporting-to-release-lines.md 923[commit message guidelines]: contributing/pull-requests.md#commit-message-guidelines 924[commit-example]: https://github.com/nodejs/node/commit/b636ba8186 925[git-email]: https://help.github.com/articles/setting-your-commit-email-address-in-git/ 926[git-node]: https://github.com/nodejs/node-core-utils/blob/HEAD/docs/git-node.md 927[git-node-metadata]: https://github.com/nodejs/node-core-utils/blob/HEAD/docs/git-node.md#git-node-metadata 928[git-username]: https://help.github.com/articles/setting-your-username-in-git/ 929[node-core-utils-credentials]: https://github.com/nodejs/node-core-utils#setting-up-credentials 930[node-core-utils-issues]: https://github.com/nodejs/node-core-utils/issues 931[unreliable tests]: https://github.com/nodejs/node/issues?q=is%3Aopen+is%3Aissue+label%3A%22CI+%2F+flaky+test%22 932