‹ BackHN Continuity

Thread

There is more to code review than (automatable) detection

165 points · 117 comments · utiiiD

  1. n4r9 · · focus · HN ↗
    There&#x27;s been a lot of talk about the purpose of code review recently. It makes sense in the face of AI. Heres a link that was submitted a little while ago: <a href="https:&#x2F;&#x2F;mathstodon.xyz&#x2F;@mjd&#x2F;115096720350507897" rel="nofollow">https:&#x2F;&#x2F;mathstodon.xyz&#x2F;@mjd&#x2F;115096720350507897

    And in response I wrote a non-exhaustive checklist of things that a code review can look for:

    - Does it functionally achieve what it sets out to (as per tacker issue or PR description)?

    - Does it have extraneous code? Leftover debug prints, private API keys etc...

    - Does it have any obvious defects? Memory leaks, un-handled edge cases, security flaws, obsolete API calls, etc...

    - Could it be more understandable? Add&#x2F;remove abstractions, better variable&#x2F;method names, more&#x2F;less functional etc...

    - Is the style consistent with the codebase and&#x2F;or style guidelines?

    - Are there obvious performance improvements? Hashset instead of list, lazy evaluations, etc...

    - Is it sufficiently well tested?

    I think LLMs are okay at most of these, and worst at the first.

    1. crabbone · · focus · HN ↗
      &gt; I think LLMs are okay at most of these, and worst at the first.

      LLMs are worst at not realizing problems that I&#x27;d call &quot;meta&quot; problems. Here&#x27;s one example to illustrate it:

      I was allowed by my employer to work on a small project within the large collection of the projects which all constitute the product the company sells. Like a few dozens of other projects, it&#x27;s written in Python. The company doesn&#x27;t have any explicit policies about how Python projects have to be organized, it requires testing, linting, a CI code to package it etc, but the guidelines are very permissive. It just so happens that, beside the guidelines, there&#x27;s a tradition: every other Python project in my company uses the typical Python bloatware, like masonry with a lot of insanity and mental flips going on in pyproject.toml, which is, in general, very typical for Python community at large.

      My project used none of that. Instead, I wrote a ~100 lines setup.py file (no dependency on setuptools&#x2F;distutils) that assembles the wheel and runs project maintenance tasks in the same way (interface-wise) things used to work decade or two ago (eg. &quot;.&#x2F;setup.py test&quot; if you want to run unit tests).

      The AI reviewer didn&#x27;t bat an eyelash. Found some typos in the comments, a problem with Base64 formatting, and generally OK&#x27;d the whole thing.

      I knew I was on my way out. And I generally enjoy seeing people having a fit of rage when they know they are wrong (especially, together with many more like them), and scrambling for arguments that they know to be lies. I felt a little bit vindicated for the years of suffering I had to endure working with what might have been the dumbest and the most entitled manager I had in my life. :D

      Anyways. My point is: the AI caught none of it. It was very happy with my approach to Python project management.

      * * *

      While my story is... more of an odd case, where this does have much wider implications is the AI-generated code. AI-generated code often fails to match these meta-requirements. I&#x27;ve seen AI reviewer OK&#x27;ing a PR containing AI-generated 10K loc Python file. I human would probably break after reading the first 1K lines. But AI doesn&#x27;t get &quot;tired&quot;, it just kept picking on typos in comments, criticizing short variables names etc. And there are other aspects in which AI-generated code is weird to humans in the ways that humans simply won&#x27;t accept it, but AI reviewer would completely ignore as non-issue.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.