Top
Best
New

Posted by rzk 11 hours ago

Ask HN: How to deal with shipping AI-written code you don't understand?

I saw this LinkedIn post from a Meta engineer and it resonated with me:

https://www.linkedin.com/posts/ali-hamie_im-an-engineer-at-m...

> I'm an engineer at Meta and I never felt this uncomfortable doing my job. I'm writing code these days and it all feels like a black box. This new standard of shipping with AI is moving so fast that if we're going to spend our time checking each line of code, it's going to take forever. That means you can end up with systems you've built where you don't truly understand how all the code works. You understand the high level, but not every detail. And maybe this is becoming the new standard. It goes against every instinct of being a software engineer. I'm used to understanding what I'm building. Now I'm trying to figure out how much I need to understand before I'm comfortable moving forward. Are other engineers feeling this too?

How are you handling this?

147 points | 257 commentspage 2
webarchitect 5 hours ago|
I can think of so many times this has happened before. People getting used to MVC, Dependency Injection, ORMs. Sometimes the code is so large you only work on a part of it, so you have to get used to a lot of not knowing.

So how do we build confidence anyhow when we can't know everything?

I think first, standard checks - does it compile? What do static analysis tools say - code quality, passes SAST analysis? Linters? Style checkers?

Do the tests run? I'm not comfortable with the tests I write let alone the AI.. by adding fault injection (fuzzing, chaos), and mutation testing, I have a better degree of confidence in the tests and code.

Spend even more time getting to know the product instead. Maybe I don't know the code as well as I used to, but I know the product backwards and forwards. That helps me have some new confidence that I didn't really have before. Knowing the greater whole.

combyn8tor 2 hours ago||
Your comment made me think that people have been happily importing hundreds to thousands of dependencies into their projects that were written by some random guys on the internet, but they've just now started to become concerned they don't understand the code they're shipping.
p2detar 1 hour ago||
Exactly right. Many never check the release notes of those libs on bump either. To this add copy & paste from Stack Overflow we used to do. People are just afraid of losing their jobs now, so naturally we all got defensive.
chrisjj 3 hours ago||
> So how do we build confidence anyhow when we can't know everything?

Avoid known unreliable tools?

gavinray 3 hours ago||
I lost my ability to fully explain the systems I work on around the time I transitioned from next-edit-prediction AI running in my IDE (early Copilot) and working primarily via Codex/Claude CLI's.

The further away I got from the implementation details, the fuzzier the semantics became. To the point that now I could not in good faith say I understand the system I have built from the ground-up and worked on the last ~4-5 years.

The solution to this, in my mind, is not to revert back to reviewing implementation details. The economics of that from a business/productivity perspective don't play out well.

The only viable solution in my mind is adapting code/languages themselves to the shift by making programs formally verifiable. That way you can be sure that the code "does what it says on the tin", and provably so.

I feel so strongly about this I've written on it:

https://gavinray97.github.io/blog/design-by-contract-and-eff...

oblio 3 hours ago||
> To the point that now I could not in good faith say I understand the system I have built from the ground-up and worked on the last ~4-5 years.

You weren't programming with LLMs in 2021 or 2022, be real. More like 2024 (that's already pushing it) or 2025.

gavinray 3 hours ago|||
Because telling lies on the internet attached to my real name is so beneficial to my reputation, right?

https://i.imgur.com/CNAUczi.png

jimbokun 2 hours ago|||
Receipts!
oblio 2 hours ago|||
You poor soul. You were gambling against roulette odds.
epihelix 2 hours ago|||
I'd guess they started developing the project back in 2021 coding by hand, and are now improving/maintaining via agenetic engineering. This is not uncommon.

The point is that it's easy to lose understanding of the finer details, even of a codebase you lovingly created, once this switch occurs and an LLM gets its hands on it.

pizzafeelsright 2 hours ago||
You get it.

The bridge is built. How do we test the load? Drive bigger and bigger trucks until it fails, note the weight, print the sign and rebuild the bridge the same way.

orblivion 3 hours ago||
I'm miles away from all of this as a non-user of AI and it seems like a mania to me.
mrbombastic 2 hours ago||
as someone using AI, it is mania, leadership has decided it is so and software is getting worse. we could have just accepted our 20% bump and been happy, fixed bugs, made things better quality, nope, ship half assed features at 2x speed, pretend claude is infallible and will solve all our problems, brand reputation? user research? pixel perfect designs? what are you a dinosaur?
dboreham 3 hours ago|||
You should probably try it.
dofm 1 hour ago||
Yeah, man. Don't be a square!

Try it, you might like it. First month's free and you can still quit if it's not for you.

pizzafeelsright 2 hours ago|||
You make eat omelets using sourced material you have no way to verify.

You trust the label. The person. The company. You hope someone did their due diligence.

Sometimes taste the shell. That is an acceptable risk.

orblivion 1 hour ago|||
Would you have made this comparison in 2022 about a future where you're shipping code that you're not even reading?

(made a small edit)

pizzafeelsright 1 hour ago||
No, not in 2022. The models weren't good enough yet. I was looking at the trend line though. I gave word to our engineers that software would not be the bottleneck. The bottleneck was understanding what to do next.
dofm 1 hour ago||||
We used to be in the business of owning, understanding and evolving our processes. Are we not, now?
michaelt 2 hours ago|||
Except in this case the label on the eggs says "Eggs may occasionally be poisonous. Users should not rely on eggs to be safe, and should carefully scrutinise eggs before and during cooking. Bob's Farm accepts no liability for injuries resulting from making omelets with our eggs."
pizzafeelsright 1 hour ago||
Users are responsible for what their agents do.
epihelix 2 hours ago||
I expect the guy sticking to his horse and cart, as the first cars started to overtake him on the roads, felt similar.
orblivion 1 hour ago||
A lot of the real advancements that the dinosaurs didn't understand perhaps seemed like a mania, but a lot of manias seem like real advancements that the dinosaurs don't get.
realo 49 minutes ago||
Maybe a related question:

How do you keep the IEC 62443-4-1 auditors happy?

quibono 1 hour ago||
Maybe a bit unorthodox but I have it plant 1-3 bugs into the code it writes (depending on the size of the MR I'm working on); they range from simple one-off issues to something more structural.

It then gives me a hint on the area or a typical code flow that would hit the bug - whichever gives me less info. I can obviously ask for more hints as I read along.

Obviously all honour-code based since I could just ask it to fix the bugs itself. I think this is something that can't be fixed systemically - either you're going to bother reading and thinking through the code or not.

Other than that I guess reading the tests - to make sure they fail without the code / fix, to make sure the setup makes sense etc.

movsx 3 hours ago||
Well, it's simple. Don't do it.
tcdent 3 hours ago||
I agree with you with one caveat. Professionally, your obligation is to be qualified for your job and ship work that you stand behind. Complete comprehension is absolutely necessary.

Personally, with side projects and tooling, go nuts. There's no reason to read all of that code.

KronisLV 2 hours ago||
> Complete comprehension is absolutely necessary.

I feel like an increasing amount of orgs out there have long abandoned this thinking.

vjvjvjvjghv 2 hours ago||
Your world will get smaller and smaller . I don’t think you can stop that wave.
AbrahamParangi 1 hour ago||
The traditional answer is the same for engineers going into engineering management because managing a team and managing a set of agents is highly similar, only managing agents is far easier. One only ever has the illusion of control, and so you have to set your mind to containing the worst possible outcomes and looking at the net efficiency and efficacy of the team with the understanding that they will, on average, never be perfect.
asimovDev 3 hours ago||
I was struggling with this today. Working on a feature and AI review flagged something so I need to fix that. I iterated multiple times throughout the day and was completely exhausted cause each iteration was always complicated with the fix being ~1k lines. Finally landed on a one I felt at least a little comfortable submitting for review but a work day like this is super draining and I felt like crap the entire evening (I am about to go to bed, I am probably gonna have nightmares about pressing enter and enabling auto mode on plans that make no sense in a true nightmare sense)
d0m 2 hours ago||
1) Need to triple down on infrastructure (safeguards, tests, sandboxes, etc.).

2) Ask agents to do more than just code.

They need to fully demonstrate and prove that their PRs are rock solid. Ask for screenshots, videos, code reviews, detailed architecture diagrams, etc.

It would be an insane amount of work for humans, but AI can do it easily for each PR.

Merging any PR from an agent should be a no-brainer if there's real proof that the feature is built correctly and working.

If there's still doubt, then the agent needs to do a better job of proving that the feature is built correctly, doesn't introduce regressions, etc.

senderista 51 minutes ago|
This is OT and a cheap shot, but if I were an engineer at Meta I would have felt pretty uncomfortable well before AI showed up...
More comments...