Live data from Hacker News

The Theatre of Pull Requests and Code Review

meks.quest

421–430 of 431 posts

Re: The Theatre of Pull Requests and Code Review

#421
post #391

Earlier quoted context omitted.

I think "doesn't work in every case" is true for basically every rule of course. But 99% of people in the industry are not qualified to make that call because they will always choose "not" out of laziness rather than because it actually wasn't a good idea

Have we stoped celebrating laziness being a virtue in software development? Discipline doesn't and will never scale and the pressures of business mean that processes that processes that put up walls to shipping will always crumble. Real example, we do PR reviews because they're required for our audit and I'm of the opinion that they're mostly theater. It's vanishingly rare that someone actually wants a review rather…

Laziness is a virtue when it leads to automation. Not when it leads to shoddy work

Re: The Theatre of Pull Requests and Code Review

#422

Earlier quoted context omitted.

There are not mutually exclusive. While I don't personally make the checkpoint style commits ever, I work with those who do. But they re-create a set of logical atomic story commits before submitting as a PR or otherwise

Which means they are inventing a narrative that did not exist when they were developing the PR. While also spending time on squashing and merging commits to pretend the development was linear. When it absolutely wasn't. That is the perfect story for the final merge commit or the PR when this nicely crafted story is squashed into nothingness and merged.

If you sqaush then the commits don't exist, so this seems to agree with my point

Re: The Theatre of Pull Requests and Code Review

#423

Earlier quoted context omitted.

If there is only useful information in the commit message "once in a blue moon" it means someone isn't writing good commit messages. The number of times I look at a change and all I can think is "why did they/I do that" is very very often. Having the answer to that question available saves re learning the lesson that led to the change.

Put that in the developer-docs/issue-tracker where it has chance of being seen again. And not only by developers.

Commit messages are the developer docs for a change yes

Re: The Theatre of Pull Requests and Code Review

#424
post #61

Earlier quoted context omitted.

That's a bummer! At my company we've started investing in what I'm calling 'semantic linting', which is basically running GPT over a PR with a set of rules that we iterate on. Already I'm finding huge value for style/pattern comments that linters can't easily catch, dropping warnings for common DB migration footguns, or notifying people of changing patterns/new ways of doing things. Been great so far!

Do you have any write-up about this or more info? It sounds like a useful use case but I haven't yet got it right

I do not, but it took me and a coworker all of an hour to setup. Create a CI workflow, vibe code it to load up the PR contents + any rules you want (we maintain a directory of individual rules that people can tweak), and ship it off to GPT for a response. Add some input/output schemas, and it's pluggable back into the CI hooks to notify of failed build steps (Github in my case).

Re: The Theatre of Pull Requests and Code Review

#425
post #375

Earlier quoted context omitted.

Virtue signalling? What are you on about? Everything I said has direct benefits for the team, and hence for the company. > If you want to communicate with others, write proper docs in a format that won't be lost to time You have a severe misunderstanding of what commit messages are for. They're meant to describe changes that can be used as historical reference by developers . They're not meant to be read by non-devel…

> And... you're actually proud of this? Amazing. Your posts above are dripping in it. Docs are available to everyone, accessibility in action. You have a severe misunderstanding of what communication is. There’s no important developer information that should be explicitly and effectively hidden from others. There’s not even a proper search facility, you have to browsing with a lot of background knowledge until you ho…

^go browsing

s/burying/buying/

Re: The Theatre of Pull Requests and Code Review

#426

Earlier quoted context omitted.

> The fact that people often use the tool wrong certainly begs some criticism of the tool, but when used correctly commits are certainly worth looking at one by one What do you consider correct usage of git, and why? In this very discussion, I can see at least two distinct purposes that, more often than not, are mutually exclusive: - To "tell a story" for other people - To checkpoint units of work as individual perce…

In my usage, the story is for myself first and foremost. Telling the story helps keep me organized and helps me remember what I've done and where I'm going. I don't need to know that I fixed a typo in a comment, I need to know what the changes are overall doing. Sometimes I go down a dead end, reverse out, and leave a comment about why a different approach would be a dead end. I (and others) don't need a record of th…

But writing a story like this is akin to writing a book with an ink pen.

Are you so good that you can just one-shot a book from start to finish without any mistakes?

For me commits to a PR are more like me going "ok, this step is stable enough" and continuing with the next one. The code might not compile or be valid or even clean, but it lets me focus on the next step without having 42 staged files cluttering up my brain.

Re: The Theatre of Pull Requests and Code Review

#427
post #313

Earlier quoted context omitted.

I'm not the person you asked, but I often don't. I personally don't care about git history - I read code not commit messages. I don't really care how it got the way it is I care about what it is, maybe once in a blue moon there could potentially be some useful information in a commit message but it's not enough. So, I'll often just make lots of changes and then commit them all at once with some vague commit message a…

The important thing about making commits separately and as much self-contained as possible is to allow cherrypicking. Say you're on a development branch and you added something new, that the Project thinks can be and should be added to the Main branch. By having that addition in its own self-contained commit allows the Project to create a new branch, cherrypick the commit, and merge the branch to Main, without having…

Only when you commit to main.

When I'm creating a PR in a feature branch, it's my playground. And the PR will be squashed and merged as one clean commit with a clean message.

Nobody wants to see my 50 "argh, forgot this bit" commits, they bring zero value.

Re: The Theatre of Pull Requests and Code Review

#428
We've definitely fallen into the trap of performative code reviews where everyone feels obligated to find something to comment on

Quickly learned the best code reviews are focused on logic and architecture, not formatting. But it's easy to slip into nitpicking because those comments are easier to write

Re: The Theatre of Pull Requests and Code Review

#429

Earlier quoted context omitted.

I always tell my engineers to create atomic commits and we usually review commit by commit. Obviously commits like "fixed review comments" or "removed some left-over comments" or "fixed typo" should not be pushed into a PR you asked others to review. I expect people to understand how to clean their commit history - if they don't I teach them. The senior people who are capable of structured work - e.g. are used to con…

> Obviously commits like "fixed review comments" or "removed some left-over comments" or "fixed typo" should not be pushed into a PR you asked others to review. Could you explain this a bit more? I'm having trouble visualizing the end to end process. 1. Someone has what they feel is a complete change and submits a PR for review. 2. The reviewers read part of it, first half looks good, and halfway through they have co…

Everytime you push commits to a PR you decide what you push exactly.

The first time you push, you should have squashed/rebased your changes into a structure that make sense. Atomic commits are best. Could even be a single commit. Sometimes it makes sense to have multiple commits. E.g. - introducing a new API - moving other code to use the new API - deleting the old API

This could also be a single commit. That is really up to you/your team.

And yes, you rebase/squash and force push new commits. Every team I had in the past 12 years routinely used force-push for PR iterations.

Turns out, when writing production code, other people rarely checkout and work simultaneously on branches of half-finished stuff of other people. It is and should be very, very rare. Very occasionally it happens that someone bases their work on the branch another developer. In these cases, people just carefully rebase their branch on "origin/other-branch" after a fetch. You can't rely on people not force push anyway. Even if you agreed on it, sometimes this needs to be done. (e.g. commit a very large binary file by accident). So you need work in a way which assumes that somebody might have force-pushed their private branch.

Multiple people working on the same branch without a PR process is indeed messy and you should never force push when you do that. They key here is to avoid working with multiple people on the same branch in the first place. I've seen this happening only when: - Work items are too big and not broken down enough (branches are actively developed for for several weeks/months ). Usually and indication of lack of architecture and product leadership. If you do this, you have lots of other interesting problems as well. You are prototyping really but pretending you don't. - You are consciously experimenting and prototyping. Make whatever mess you want - in code and history. You are going to iterate so much and so messy that whatever you produce can't a product. Figure out what you want and need to do and start with a clean implementation afterwards. And maybe delete that messy branch eventually.

So, we have two modes: - Prototyping - which means you are allowed to make a mess because you throw it away anyway. No one, including you, cares much what you code and your repo history looks like. - Production - you write code and repo history for eternity. You do it right for the sake of everybody's sanity.

Re: The Theatre of Pull Requests and Code Review

#430
post #344
post #288

Earlier quoted context omitted.

> nobody reads intermediate commit messages one by one on a PR, period. Very common practice at my old company, and one I continue in my current role. > “every commit must compile” sucks ass for anyone else trying to rebase your branch onto the update main/master when they don't. Once your PR is out of "working on the feature" and into the "getting it merged" phase, do a little `git rebase -i` and squash your really…

> sucks ass for anyone else trying to rebase your branch onto the update main why would anyone else rebase your branches? YOU should rebase your branches.

because sometimes getting someone else's code ready to merge to the main branch is the highest value thing I can do to unblock the whole team. I wholeheartedly agree that they should have done that in the first place.
Post reply on HN