Live data from Hacker News

Ask HN: Teams using AI – how do you prevent it from breaking your codebase?

news.ycombinator.com

31–40 of 59 posts

Re: Ask HN: Teams using AI – how do you prevent it from breaking your codebase?

#31
post #20

It sounds like you're not training it with your existing code base, and that you're running it with relatively small contexts. Have you done any custom LLM training on your code base, and what model are you using?

Who is training models on a code base? That's an extraordinary use case.

Engineers that want to drastically improve their AI tooling outcomes so they can iterate at scale?

Re: Ask HN: Teams using AI – how do you prevent it from breaking your codebase?

#32
AI does not commit code; people do. The origin of the code does not matter, processes remain the same. So:

1. We never catch AI trying to make breaking changes, but we catch developers who do. Since using AI tools we haven’t seen a huge change in those patterns.

2. Prior to opening a PR; developers are now spending more time reviewing code instead of writing it. During the code review process, we use AI to highlight potential issues faster.

3. Human in the middle

Re: Ask HN: Teams using AI – how do you prevent it from breaking your codebase?

#33
Is the issue that the suggestions from the AI tool are not good, or is that bad code is making it into the repo?

The latter problem should be prevent by code review (first by the developer using the AI tool and then their teammates on a PR.) Code generated by AI should be reviewed no differently than code written by a human. If you wouldn't approve the PR if a person wrote this code, why would you approve it because an LLM wrote it? If your PR process is not catching these issues, you have a PR process problem, not an AI problem.

The former problem I have no idea.

Re: Ask HN: Teams using AI – how do you prevent it from breaking your codebase?

#34
1. Don't use Devin or OpenDevin or whatever

2. Use LLM for code auto complete or ask LLM to code specific functions that you weave together to deliver a feature.

3. Or use it to explain your code. I concatenate all my code and shove it into Gemini and ask it to explain how the legacy stuff works

Re: Ask HN: Teams using AI – how do you prevent it from breaking your codebase?

#35
I wrote a SWE bench solver. The SWE bench issues are on mature projects like Django.

The objective of my solver was to get good solutions using only RAG (no embeddings) and with minimal cost (low token count).

Three techniques, combined, yielded good results. The first was to take a TDD approach, first generating a test and then requiring the LLM to pass the test (without failing others). It can also trace the test execution to see exactly what code participates in the feature.

The second technique was to separate “planning” from “coding”. The planner is freed from implementation details, and can worry more about figuring out which files to change, following existing code conventions, not duplicating code, etc. In the coding phase, the LLM is working from a predefined plan, and has little freedom to deviate. It just needs to create a working, lint-free implementation.

The third technique was a gentle pressure on the solver to make small changes in a minimum number of files (ideally, one).

AI coding tools today generally don’t incorporate any of this. They don’t favor TDD, they don’t have a bias towards making minimal changes, and they don’t work from a pre-approved design.

Good human developers do these things, and this is a pretty wide gap between adept human coders and AI.

Re: Ask HN: Teams using AI – how do you prevent it from breaking your codebase?

#36
post #31
post #20

Earlier quoted context omitted.

Who is training models on a code base? That's an extraordinary use case.

Engineers that want to drastically improve their AI tooling outcomes so they can iterate at scale?

Have you or anyone you work with trained a model for code base familiarity?

Re: Ask HN: Teams using AI – how do you prevent it from breaking your codebase?

#37
There is an implication here that you're letting AI commit to your codebase without reviewing it first. Or that humans are committing AI generated code but without reviewing it first. Is that the case?

Because if it is, the answer seems fairly simple: you install a proper code review process, and you don't allow shit code into your codebase.

Re: Ask HN: Teams using AI – how do you prevent it from breaking your codebase?

#40
post #38

Do you not have code reviews? These are all problems with regular humans, too. You prevent it via code reviews.

Or even better, before the code review. If your engineers commit substandard code that was generated by an AI, they’re not doing their job. It’s ok to miss some things, but "breaking the codebase" should absolutely not happen.
Post reply on HN