doc: add large pull requests contributing guide#62829
doc: add large pull requests contributing guide#62829mcollina wants to merge 1 commit intonodejs:mainfrom
Conversation
|
Review requested:
|
There was a problem hiding this comment.
- We should link to it from CONTRIBUTING.md, pull-requests.md, collaborator-guide.md (or some subset of those)
- We should exclude routine dependency/wpt/test bot-issued PRs, this can either be excluded explicitly with additional rules or by changing the classification put forth by the
OvervieworWhat qualifies as a large pull requestsections - dependency changes in a separate commit is at odds with having each commit self-contained, this is fine when the commits get squashed but the first commit's message is used for the squash so the first commit would be the non-deps changes? seems odd and counter-intuitive
- Design document - I 100% discourage linking outside documents, a detailed PR description should also suffice, 3000 can easily be hit with just thorough test coverage for an otherwise trivial change, how would a design document help such PRs?
- Both
Separating test additions from implementation changes.andSplitting documentation into its own pull request.strategies to avoiding large PRs are contrary to what we usually request of contributions. Those strategies only work when the contribution isn't "done" or "shipped" and is excluded from builds.
e9d9a4c to
7552c50
Compare
|
The specification here doesn't seem very clear:
|
We have to draw a line, and this is as good as any. I proposed 5k but I was asked to lower it. I would be happier with a 3k of non-test/non-doc changes, but that would require better tooling, which I'd prefer to avoid creating now. What would work for you?
The number that matters is at landing time. |
In the document it says: So
I would say as soon as it reaches the threshold the new rules apply. This also means that if with further commits the PR shrinks, rules do not apply anymore. |
|
FYI, I've added the new |
|
|
|
@nodejs/tsc ... we could use some more TSC scrutiny on this policy change. |
| * 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. | ||
|
|
There was a problem hiding this comment.
| * Organize commits in a logical sequence so that reviewers can follow the progression of the change incrementally, rather than reviewing the entire diff at once. | |
Organize commits in a logical sequence that tells a clear story of the change, allowing reviewers to follow the progression incrementally. Ideally we can follow the author's train of thought step by step rather than parsing a monolithic diff 🤔
There was a problem hiding this comment.
This is in direct conflict with what has been asked by @joyeecheung and others.
(This is how I operate, btw, creating a PR in small increments).
There was a problem hiding this comment.
Our tools support autoquash commits and I think we should just lean into using autosquash commits. The commits themselves should always be in the shape that's suitable to be merged into main. That is, a sequence like this (that reflect the chain of thought of the authors but not how it should land)
- commit1
- commit2
- address A's comment (touch both 1 and 2)
- address B's comment (touch both 2 and 3)
- address C's comment (touch 1)
is not the right way to stack commits - the later commits are actually harder to review because you then need to track other comments and the author have to later squash them correctly, and it's a chore to review that the final squash is correct, especially considering we have the hard requirement that commits landed must be themselves individually passing the test for bisect to work.
The way I have always being doing is:
- commit1
- commit2
- fixup! commit1
- fixup! commit2
- fixup! commit1
Then reviewers can mentally connect the fixups with the original commits, and the author do not have to squash commits themselves manually - our commit queue tooling support autosquash, so 1, 3, 5 would be squashed together and 2, 4 would be squashed together automatically at the time of landing.
We already have guidelines for how to group commits, I think whether the PR is big or not doesn't make a lot of difference in this, we can just reference that https://github.com/nodejs/node/blob/main/doc/contributing/pull-requests.md#step-4-commit
7552c50 to
57506d2
Compare
57506d2 to
104bc61
Compare
To be honest I don't have strong opinions on this. I just wrote out how I interpreted the rule to make sure we're on the same page. Thinking about it, my formula above probably would easily trigger this limit. Just making out an example, if I have a JS function which body is 100 lines long and I wrap the entire body inside a So either we only count additions or we raised the combined limit. |
|
I've updated it to to be ADDED - DELETED > LIMIT |
| A pull request is considered large when it exceeds **3000 lines** of net | ||
| change (lines added minus lines deleted). This threshold applies across all | ||
| files in the pull request, including changes in `deps/`, `test/`, `doc/`, | ||
| `lib/`, `src/`, and `tools/`. |
There was a problem hiding this comment.
3000 is very easy to hit with simple refactors, consider ignoring whitespace for this "check". Ignoring whitespace can make 15 files changed, 935 insertions(+), 789 deletions(-) change i'm working on a 15 files changed, 297 insertions(+), 151 deletions(-) one.
Fixes: #62752
Adds a contributing guide for large pull requests (3000+ lines), covering: