-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
doc: add large pull requests contributing guide #62829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mcollina
wants to merge
2
commits into
nodejs:main
Choose a base branch
from
mcollina:doc/large-pull-requests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+167
−0
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,140 @@ | ||
| # Large pull requests | ||
|
|
||
| * [Overview](#overview) | ||
| * [What qualifies as a large pull request](#what-qualifies-as-a-large-pull-request) | ||
| * [Who can open a large pull request](#who-can-open-a-large-pull-request) | ||
| * [Requirements](#requirements) | ||
| * [Design document](#design-document) | ||
| * [Review guide](#review-guide) | ||
| * [Approval requirements](#approval-requirements) | ||
| * [Dependency changes](#dependency-changes) | ||
| * [Splitting large pull requests](#splitting-large-pull-requests) | ||
| * [Feature forks and branches](#feature-forks-and-branches) | ||
| * [Guidance for reviewers](#guidance-for-reviewers) | ||
|
|
||
| ## Overview | ||
|
|
||
| Large pull requests are difficult to review thoroughly. They are likely to sit | ||
| for a long time without receiving adequate review, and when they do get reviewed, | ||
| the quality of that review is often lower due to reviewer fatigue. Contributors | ||
| should avoid creating large pull requests except in those cases where it is | ||
| effectively unavoidable, such as when adding a major new subsystem. | ||
|
|
||
| This document outlines the policy for authoring and reviewing large pull | ||
| requests in the Node.js project. | ||
|
|
||
| ## What qualifies as a large pull request | ||
|
|
||
| A pull request is considered large when it exceeds **3000 lines** of combined | ||
| additions and deletions. This threshold applies across all files in the pull | ||
| request, including changes in `deps/`, `test/`, `doc/`, `lib/`, `src/`, and | ||
| `tools/`. | ||
|
|
||
| Changes in `deps/` are included in this count. Dependency changes are | ||
| sensitive because they often receive less scrutiny than first-party code. | ||
|
|
||
| ## Who can open a large pull request | ||
|
|
||
| Large pull requests may only be opened by existing | ||
| [collaborators](https://github.com/nodejs/node/#current-project-team-members). | ||
| Non-collaborators are strongly discouraged from opening pull requests of this | ||
| size. Collaborators should close large pull requests from non-collaborators and | ||
| direct the author to discuss the proposed changes in an issue first, and to | ||
| find a collaborator to champion the work. | ||
|
|
||
| ## Requirements | ||
|
|
||
| All large pull requests must satisfy the following requirements in addition to | ||
| the standard [pull request requirements](./pull-requests.md). | ||
|
|
||
| ### Design document | ||
|
|
||
| A design document or detailed issue must be available when the pull request is | ||
| opened. The design document should explain: | ||
|
|
||
| * The motivation for the change. | ||
| * The high-level approach and architecture. | ||
| * Any alternatives that were considered and why they were rejected. | ||
| * How the change interacts with existing subsystems. | ||
|
|
||
| The design document can be a GitHub issue, a Markdown file in the repository, | ||
| or an external document linked from the pull request description. It does not | ||
| need to be shared before the work starts, but it must be available for reviewers | ||
| when the pull request is opened. | ||
|
|
||
| ### Review guide | ||
|
|
||
| The pull request description must include a review guide that helps reviewers | ||
| navigate the change. The review guide should: | ||
|
|
||
| * Identify the key files and directories to review. | ||
| * Describe the order in which files should be reviewed. | ||
| * Highlight the most critical sections that need careful attention. | ||
| * Include a testing plan explaining how the change has been validated and | ||
| how reviewers can verify the behavior. | ||
|
|
||
| ### Approval requirements | ||
|
|
||
| Large pull requests follow the same approval path as semver-major changes: | ||
|
|
||
| * At least **two TSC member approvals** are required. | ||
| * The standard 48-hour wait time applies. Given the complexity of large pull | ||
| requests, authors should expect and allow for a longer review period. | ||
| * CI must pass before landing. | ||
|
|
||
| ### Dependency changes | ||
|
|
||
| When a large pull request adds or modifies a dependency in `deps/`: | ||
|
|
||
| * Dependency changes must be in a **separate commit** from the rest of the | ||
| pull request. This makes it easier to review the dependency update | ||
| independently from the first-party code changes. | ||
| * The provenance and integrity of the dependency must be verifiable. | ||
| Include documentation of how the dependency was obtained and how | ||
| reviewers can reproduce the build artifact. | ||
|
|
||
| ## Splitting large pull requests | ||
|
|
||
| Contributors should always consider whether a large pull request can be split | ||
| into smaller, independently reviewable pieces. Strategies include: | ||
|
|
||
| * Landing foundational internal APIs first, then building on top of them. | ||
| * Separating test additions from implementation changes. | ||
| * Splitting documentation into its own pull request. | ||
| * Landing refactoring or preparatory changes before the main feature. | ||
|
|
||
| ### Feature forks and branches | ||
|
|
||
| For extremely large or complex changes that develop over time, such as adding | ||
| a major new subsystem, contributors should consider using a feature fork. | ||
| This approach has been used successfully in the past for subsystems like QUIC. | ||
|
|
||
| The feature fork must be hosted in a **separate GitHub repository**, managed | ||
| by the collaborator championing the change. The repository can live in the | ||
| [nodejs organization](https://github.com/nodejs) or be a personal repository | ||
| of the champion. The champion is responsible for coordinating development, | ||
| managing access, and ensuring the fork stays up to date with `main`. | ||
|
|
||
| A feature fork allows: | ||
|
|
||
| * Incremental development with multiple collaborators. | ||
| * Review of individual commits rather than one monolithic diff. | ||
| * CI validation at each stage of development. | ||
| * Independent issue tracking and discussion in the fork repository. | ||
|
|
||
| When the work is ready, the final merge into `main` via a pull request still | ||
| requires the same approval and review requirements as any other large pull | ||
| request. | ||
|
|
||
| ## Guidance for reviewers | ||
|
|
||
| Reviewing a large pull request is a significant time investment. Reviewers | ||
| should: | ||
|
|
||
| * Read the design document and review guide before diving into the code. | ||
| * Focus review effort on `lib/` and `src/` changes, which have the highest | ||
| impact on the runtime. `test/` and `doc/` changes, while important, are | ||
| lower risk. | ||
| * Not hesitate to request that the author split the pull request if it can | ||
| reasonably be broken into smaller pieces. | ||
| * Coordinate with other reviewers to divide the review workload when possible. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we enforce
commit-queuebot to check this?