News for hackers. Stuff that matters.
Re:I gave commit rights to someone I didn't know by golergka on Tuesday May 30, 2023 @02:14AM (#36121661)
That's literally 300 something lines. I'm buffled, 5k PRs aren't that rare at work.
Re:I gave commit rights to someone I didn't know by zuprau on Tuesday May 30, 2023 @02:41AM (#36121822)
I’d hate to work there. I’d rather review small chunks and merge often than review 5k lines that could be built on a shaky foundation/idea
Re:I gave commit rights to someone I didn't know by golergka on Tuesday May 30, 2023 @02:59AM (#36121908)
Best team I've ever worked with. 5k was on the larger side, sure, but technically difficult tasks often just can't be split into a series of smaller pull requests.
Re:I gave commit rights to someone I didn't know by tsimionescu on Tuesday May 30, 2023 @03:13AM (#36121982)
I am always amazed that many people with significant experience are so resistant to this idea. For what it's worth, my experience matches yours entirely: many significant changes can't be meaningfully committed in small chunks, they only make sense as an all in one.

And even more so, I've often seen the opposite problem: people committing small chunks of a big feature that individually look good, but end up being a huge mess when the whole feature is available. I hate seeing PRs that add a field or method here and there (backwards compatible!) without actually using them for now, only to later find out that they've dispersed state for what should have been one operation over 5 different objects or something.

Re:I gave commit rights to someone I didn't know by charcircuit on Tuesday May 30, 2023 @03:33AM (#36122111)
>many significant changes can't be meaningfully committed in small chunks

They almost always can. The exceptions are stuff like autogenerated code or updating a dependency.

Re:I gave commit rights to someone I didn't know by sh4rks on Tuesday May 30, 2023 @05:54AM (#36122988)
I think if a review is very large, the owner of the code should do a code walkthrough for the whole team.
Re:I gave commit rights to someone I didn't know by ZephyrBlu on Tuesday May 30, 2023 @06:35AM (#36123258)
What changes can't be committed in <5k LOC? That's a shit ton of code. If you can't break that down into smaller shippable chunks there's probably something wrong, or you're building something extraordinarily complex.

It's definitely overall quicker to ship like this, but there are tradeoffs. You are effectively working independently from the rest of your team, there is no context sharing and everything is delivered at once after a longer period of time.

Re:I gave commit rights to someone I didn't know by rprospero on Tuesday May 30, 2023 @07:40AM (#36123637)
Here's a personal example from work:

We're performing atomistic simulations. The first edition of the code stored each atom on the heap and had a vector full of pointers to the individual atoms. Obviously this would obliterate the cache, so I crafted a PR to simply store all the atoms in a single vector. On its own, that was a one line change, but it was also a very fundamental change to the type system. Everything as simple as

    Atom* linker = atoms[index];
    linker->x += 1.57;
Suddenly had to be

    Atom& linker = atoms[index];
    linker.x += 1.57;
If I didn't make those corresponding changes, the code wouldn't type check and the build would fail. I think the final PR came out to about 17 kLOC.
Re:I gave commit rights to someone I didn't know by ZephyrBlu on Tuesday May 30, 2023 @07:46AM (#36123672)
The OP is talking about feature work, as am I.

Obviously if you make a change to something like your type system it's going to generate a very large diff, but you also aren't going to review the full diff.

You're just going to make the change with find+replace or some other automation then write in the PR description "I made this change to the type system". No one is actually reviewing 17k LOC.

Re:I gave commit rights to someone I didn't know by tsimionescu on Tuesday May 30, 2023 @07:58AM (#36123757)
Actually the example is pretty good for the kind of problem I'm talking about.

Let's imagine that instead of optimizing the pointers to in-place structs, we were taking the optimized program and adding support for dynamically allocated atoms because of some new feature for dynamically adding/removing atoms.

We could of course split the value->pointer 17k line change into a single PR. But, that PR is only doing a pessimization of the code. On its own, it makes no sense and should be rejected. It only makes sense if I know it will be followed by the other feature, and even then, I would have to see the specific changes being made to know if this pessimization is worth it.

And if it got committed to the main branch, in preparation for other PRs that depend on it, the main branch is no longer in a releasable state, since it would be crazy to release with a performance penalty and no feature gain.

So, the right way to push this is as a single PR with a 17k-changed-LoC commit + the commits that actually use it. Of course, people would only manually review the other changes, but that's easy to do even if it's all in a single PR. And anyone looking back at history would clearly see that the pessimization was only a part of the dynamically-allocated atom feature, not a crazy change that someone did.

Re:I gave commit rights to someone I didn't know by ZephyrBlu on Tuesday May 30, 2023 @08:19AM (#36123919)
You specifically mention "big feature" in your original comment so it's confusing that this is a good example of the kind of problem you're talking about.

This is a very different situation than large PRs containing feature code. I think most people would agree that one large PR is the correct approach for this kind of situation.

Re:I gave commit rights to someone I didn't know by tsimionescu on Tuesday May 30, 2023 @08:29AM (#36124008)
Usually new features require modifications of old code, at least in my experience. If I came across as claiming it's likely for a feature to require 5k new lines of code, then I clearly communicated badly. But a feature coming with 5k lines of modified code, while rare, still happens several times a year in a large project in my experience.
Re:I gave commit rights to someone I didn't know by 12345hn6789 on Tuesday May 30, 2023 @08:14AM (#36123872)
This isn't what the op is talking about. They're talking about a net new feature that would span 5k lines. Your change is trivial compared to it, and frankly would earn approvals immediately without much thought (assuming the changes were already planned and talked about)
Re:I gave commit rights to someone I didn't know by tsimionescu on Tuesday May 30, 2023 @08:31AM (#36124028)
A new feature can easily involve the kind of modifications that they are mentioning. It's pretty rare for a new feature to exclusively involve new code, in my experience. And when it needs modifications in a deep part of the stack, the new feature will easily spiral into small modifications to thousands of lines of code.
Re:I gave commit rights to someone I didn't know by zuprau on Tuesday May 30, 2023 @02:12PM (#36128356)
In that case I also see "large" PRs, but I point the reviewer to "file X and then 4999 copies of file Y." When doing large no-change refactors, I submit standalone PRs and merge them quickly because no one will review 1k identical changed lines (e.g. if I change the location of /lib/ imported 600 times in the project)
Re:I gave commit rights to someone I didn't know by tsimionescu on Tuesday May 30, 2023 @03:38PM (#36129531)
What if the refactoring makes the code harder to understand when looked at in isolation, but is necessary for the rest of the feature to work? Why submit it in a separate PR without the context of why it's necessary?
Re:I gave commit rights to someone I didn't know by o1y32 on Tuesday May 30, 2023 @10:34AM (#36125343)
We have a small feature that was put together in a rush. It "works", but only works correctly for some simple cases, otherwise there are bugs everywhere. There were very few tests. We must redo the while thing, update the UX and add tests. Tell me how we can achieve that without replacing all existing code and add new tests that cover every use case in the same change.
Re:I gave commit rights to someone I didn't know by ZephyrBlu on Tuesday May 30, 2023 @11:22AM (#36125945)
Why do you have to do it all at once? You can't improve the codebase piece by piece?

Shipping all the changes in a monster PR is usually not a good option. One big reason why is that you do not create any value until the whole thing ships. If you ship piece by piece you can create small amounts of value every time you ship.

Also, if it's a "small feature", why is it 5k+ LOC?

Re:I gave commit rights to someone I didn't know by ShroudedNight on Tuesday May 30, 2023 @03:55PM (#36129789)
I've experienced this changing the API for a primary memory allocator in a frequently updated code-base. Each location updated was perilous and it needed to be changed in bulk to avoid an endless war of attrition.
Re:I gave commit rights to someone I didn't know by whstl on Tuesday May 30, 2023 @05:18PM (#36130969)
Upgrading versions of a framework with breaking changes is one. I did a 12k PR a few weeks ago that touched almost every file of the app.

It was an all or nothing thing, as almost every third-party dependency we used had to be swapped by something else.

At least we have amazing test coverage, so it was easy to find bugs.

But there wasn't much I could say other than "trust me".

Re:I gave commit rights to someone I didn't know by midasz on Tuesday May 30, 2023 @03:20AM (#36122030)
We as a team sometimes decided to PR into a PR branch, not as meticulous as a PR to develop but there'd still be eyes on the code entering the branch. Especially useful when there are dependencies and/or different disciplines contributing to the feature.
Re:I gave commit rights to someone I didn't know by plugin-baby on Tuesday May 30, 2023 @02:23AM (#36121716)
> at work

Level of trust with colleagues will hopefully be higher! And individual ownership of and responsibility for the code probably lower.

Re:I gave commit rights to someone I didn't know by g8oz on Tuesday May 30, 2023 @12:16PM (#36126637)
Which is the philosophy behind Gerrit as opposed to Github.
Re:I gave commit rights to someone I didn't know by nateberkopec on Tuesday May 30, 2023 @02:29AM (#36121757)
What language/stack?
Re:I gave commit rights to someone I didn't know by golergka on Tuesday May 30, 2023 @03:00AM (#36121914)
Typescript, React, Monaco, Treesitter, etc.
Re:I gave commit rights to someone I didn't know by TeMPOraL on Tuesday May 30, 2023 @03:20AM (#36122031)
What is being changed matters.

To use an analogy: if you wanted to reupholster my car seats, or spice up the radio panel, sure knock yourself out - I'll come check when it's done. But if you were to as much as think about tightening or loosening a single screw anywhere near the engine block, believe me I will be paying very close attention to what you're changing.

Re:I gave commit rights to someone I didn't know by robertlagrant on Tuesday May 30, 2023 @06:00AM (#36123032)
That would be a reason to never accept the PR; not to auto-accept it.
Re:I gave commit rights to someone I didn't know by bjornasm on Tuesday May 30, 2023 @03:22AM (#36122038)
Well, I feel like "at work" is a keyword here.
Re:I gave commit rights to someone I didn't know by globular-toast on Tuesday May 30, 2023 @05:29AM (#36122849)
As if you are reviewing 5k lines, though. It's either 90% whitespace changes that you completely skim over (probably missing the one bit that actually changed) or you just skim over it looking for a few patterns you don't like such as using a loop instead of Array.map or something.
Re:I gave commit rights to someone I didn't know by smabie on Tuesday May 30, 2023 @05:54AM (#36122991)
This is so true.
Re:I gave commit rights to someone I didn't know by sh4rks on Tuesday May 30, 2023 @05:55AM (#36122997)
When they say 5k lines, I'm assuming they mean 5k lines of meaningful code. 5k lines with whitespace changes, linting etc. would be impossible to meaningfully review
Re:I gave commit rights to someone I didn't know by ZephyrBlu on Tuesday May 30, 2023 @06:16AM (#36123133)
You genuinely review 5k LOC PRs?

If I was doing a proper review of a PR that big and making sure you understand how everything works that would easily take multiple days and generate 10s-100s of comments.

In reality I would flat out refuse to review it. Even 1k is very large without being broken down.

The only time I see PRs that big at work are cleanups (E.g. deleting whole directories), automated linting changes across the whole codebase and large structural refactors (E.g. changing directory structure).

Re:I gave commit rights to someone I didn't know by opportune on Tuesday May 30, 2023 @01:04PM (#36127395)
Almost every time I’ve reviewed a 1k+ LOC PR, even if it’s from a really experienced and good engineer, it has introduced a bug. Obviously I’m not gonna say it at work, but changes that big are too hard to properly review and consider all side effects and gotchas
Re:I gave commit rights to someone I didn't know by tstrimple on Tuesday May 30, 2023 @02:17PM (#36128416)
It's also more difficult to bisect to find the actual bug. Small commits have a lot of advantages.