[policy, no patch] relax patch size policies

Created on 31 January 2024, 12 months ago

Problem/Motivation

This is in regards to https://www.drupal.org/docs/develop/issues/issue-procedures-and-etiquett... β†’

This patch size limitation seems to have been from the days when we mostly used .patch files. That's no longer the case and there's a big push to use MRs for basically everything. In https://www.drupal.org/project/drupal/issues/3113971#comment-15377394 πŸ“Œ Replace REQUEST_TIME in services Fixed it was asked to split this issue further just based on the number of lines/size of the MR. IMO this MR is not hard to review. We have so many tools in the MR now to make the review process vastly more simple to parse large MRs.

These include things like the "Viewed" checkbox, allowing reviewers to hide files they've already reviewed to reduce cognitive load, and have files marked as unviewed when they get further changes. This alone makes large MRs infinitely easier to review as it doesn't have to be done all at once - i.e reviewers can "pick up where they left off" so to speak.

Being forced to split a large MR up just because it touches more than X number of files/lines/KB is just busy work to me, especially with these types of issues where the changes are mostly the same thing across every file.

Splitting issues up creates more overhead and reduces motivation to work on issues. More conflicts to resolve, more MRs to rebase, etc etc.

Or is it more that this policy isn't a hard rule and we can decide on an issue-by-issue basis as a community whether something is too large?

Remaining tasks

Agree

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component
OtherΒ  β†’

Last updated about 7 hours ago

Created by

πŸ‡¦πŸ‡ΊAustralia acbramley

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @acbramley
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    On commit of the issue that originated this issue catch made the following comment πŸ“Œ Replace REQUEST_TIME in services Fixed which supports the existing policy

    I'm going to go ahead and commit this despite #66 because I've already reviewed it in its current state once and it's looking good now. However the re-roll hell this has been in since December validates that it probably would have been easier in smaller chunks - e.g. splitting cache changes out to their own issue, or core/modules changes or both. It's always hard to balance between too many changes in one issue vs. too many issues for one change, and can be hard to tell when you start working on an issue how big the eventual MR is going to end up, so very tricky to figure out.

    Where, the comment being referred to, comment #66, is the one where it was asked that the issue be split into smaller issues.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    Being forced to split a large MR up just because it touches more than X number of files/lines/KB is just busy work to me, especially with these types of issues where the changes are mostly the same thing across every file.

    On the other hand the policy is based on research that shows that the quality of a code review reduces as the change size increases. I do think Drupal should follow that, unless there is new research. And I know from my own experience as a reviewer that the research is correct.

    Or is it more that this policy isn't a hard rule and we can decide on an issue-by-issue basis as a community whether something is too large?

    There have been exceptions to the policy about the size of the change, such as when it is mostly boilerplate or a large change was automated. I think one of the recent OO hook issues was one, but I could be wrong. Coding standard issues would be another case where large patches were committed. So, yes there is some flexibility.

    The language of the policy is already flexible in that it takes in consideration of the type of change and only suggests a 'good target size'. I do not see a need for a change.

  • πŸ‡¨πŸ‡¦Canada Charlie ChX Negyesi 🍁Canada

    Yes, hook-to-OOP went in a single go. However, that contained no functional changes and while the MR itself was over 25 000 lines it was just shuffling code around automatically and a very small amount manually and even that small amount was split into six patches. Zero functional changes. (The problems being found are coming from the new module system not the conversion. People have abused ModuleHandler in truly creative ways I couldn't have possibly expect.)

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    I think it would be good to consider maybe upping? I really get both sides

    πŸ“Œ Move helpers in contact_storage_test.module and delete it Active this is a piece of a meta converting all test modules to hooks. The fact it was broken out to this smaller one made it super quick to review. If the developer tried to group say 6 modules of tests to convert that could take a little longer. And this may be a bad example but could hold up good to go pieces from getting in.

    So I'd be +1 for upping it slightly but also recognizing and suggesting that breaking things up is always the fastest approach.

  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    I think it's funny that issues I created were used for pro and against increasing the patch size.

    I think it should be increased a bit from where it is, and while it can get hard to review after a certain size, tools like hiding sections do make it easier.

    Here is a third example.
    I am working through an issue that it was requested I break up now too.

    πŸ“Œ Mark core modules as converted to OOP hooks Active
    πŸ“Œ [pp-1] Mark several more modules as converted Active
    I think the first break up makes sense because the first issue was an attempt to mitigate the memory leak and the issue was really doing two separate things to that approach.

    The second issue is being requested to be broken up into 3 new issues.

    With the tools in gitlab it feels possible to review that as one issue especially since it was rtbc already in the parent issue.
    I'll likely break it up when I get some time just because it was requested, but I think that issue should be considered acceptable.

    As for the meta smustgrave mentioned I did combine a couple but quickly realized the remaining had too much to do in each so I will end up splitting them up as I work on them as well.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    For those that want this to change, can you add suggested wording to the issue summary so it can be evaluated? Showing before and after text would help.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Do we just want to increase the number and leave the language?

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    A good target size for a merge request or merge request is a diff size 10-40K, or about 400 changed lines of code. The ideal merge request size varies with the type of fix.

    Good conceptual scope is more important than the size alone. Large size merge requests with many instances of the same simple change can still be easy to create and review, while small merge requests with complex code or documentation can be difficult to create and review.

    These limits are based on 11 Best Practices for Peer Code Review. That analysis shows that reviewers are twice as likely to miss problems when reviewing more than about 400 lines of code, and many times more likely to miss problems when reviewing more than 400 lines.

    Thought?

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    I think 400 lines seems reasonable, I think the main change being that we're not judging by patch "size" since that metric is not readily available from an MR (AFAIK).

    I wonder if we could find some examples of >400 line MRs that are considered too hard to review.

  • πŸ‡«πŸ‡·France andypost

    sometimes it's easier to chunk commits by 400 loc but having overall changes as 10k

Production build 0.71.5 2024