Ask HN: How to deal with shipping AI-written code you don't understand?
630 pointshttps://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?
Comments (767) 238 threads
Earlier commentsTime will tell whether we were right to move from a system where we trusted humans to understand the low-level system, to one where we trust fancy calculators. But so far, it's working.
Well, the fancy calculators do. Yes, they still need guidance to keep from going off the rails. But, at least from personal anecdotal experience, I need to go spelunking into the codebase less and less over time. The agents and models really did just start to become that good.
I worry about a lack of understanding creating risk, and we are creating tools and conventions to address this risk.
But I don't yet see evidence that we're losing touch with what we're building.. yes, code is shipping faster, but I'm honestly just not seeing this "sleep-walk-engineering" issue in reality.
Code isn't shipping so fast that the engineer doesn't understand the intent and general implementation details of the PR.
PRs are required to be small (400ish lines), and have tests, and good PR descriptions must be present. And two humans must approve the PR.
The time it takes to understand, verify and validate the change is fast, often as fast as or faster than the time it takes for AI to implement.
As it stands right now, our level of understanding, PLUS our new verification tools... is all we seem to need.
We're not like the hyperscalers, but we're considering how some of their approaches might fit into our workflow.
And much like Anthropic, we aren't seeing bugs increase with the rate of code increase.
Engineers are still able to understand enough of what they need to.
There seems to be disturbingly little objective evidence of that. There's certainly a lot of code being written but how much actual value that code is adding is another question. With the scale of resources that have been pumped into AI-supported software development over the past few years where are all the new applications and the quantum leaps in quality and performance in the applications we already had? If anything I seem to be seeing more anecdotes going the opposite way so far.
Disturbingly little evidence? I would hardly call that "disturbingly little"...
This does feel a lot like the "Agile era" that was the last silver bullet that was supposed to fix software development forever and the "Cloud era" that was supposed to fix infrastructure and deployments.
Agile had a few good ideas. Code reviews and automated tests are commonly used today.
It had a few plausible ideas that it took too far. We are better at recognising the value of incremental development over big up-front design today - despite the ironic clash this seems to be having with agentic workflows - but almost everyone hates stand-ups and lots of projects have gone off the rails by breaking things down far too much and never committing to anything and so never getting anywhere.
And it had plenty of ideas that almost all of us have thrown out as unpleasant and/or unworkable. Pair programming comes to mind immediately.
What didn't really change was the fundamental nature of software development. Did we adopt a few useful ideas and get a bit more efficient and improve quality a bit? Certainly. Did we get orders of magnitude better at anything and give up all the tried and tested ways of working in favour of radical new ones that never quite felt right? No.
On our current trajectory I'm expecting a broadly similar outcome for LLMs. They're now very good at some things. But they are still pretty bad at other things that also matter - and some of the reasons they are bad at them are an inherent part of how they work and therefore probably can't be overcome (at least not with incremental improvements on the technology that still basically work the same way). So I am expecting to see a period of consolidation with a lot of organisations pulling back from their dramatic leaps into the unknown and downsizing of dev teams once the big AI companies start squeezing financially and the problems of developer burnout and stagnating skills and low morale that we're already seeing after just a few months become endemic. And then as I suggested in another comment I think it's also increasingly possible that we'll see developers unionise and/or push for professional regulation and licensing so they can resist the pressure to just ship whatever their agent wrote without even bothering to check it but still being responsible when inevitably things then go wrong.
Continue this thread — 3 replies
For my part: I've put some of my tooling energy into code comprehension tools. You can get remarkably far quickly by just replacing the Github PR viewer! I started with a (native SwiftUI) read-only front end for tree-sitter and SCIP (the code-indexing standard). Then: as I reviewed PRs, I tried to catch myself doing annoying repetitive things and just building out additional features, like "show me all the knowable call chains for this function", or "show me every implementation of this trait".
You can get a fair ways just by thinking of things to hide in a PR viewer, just to clear space for the things you need to comprehend.
That's really it. I've been finding the same limitations with the default PR code review tools. We currently make do by having a section in our PRs "recommended review order" with a list of files/dirs that should be looked at first, which not only is much smaller Loc than everything else but is the main relevance of the PR.
Within a given project there are inevitably certain files/concepts that are more important, and a better review tool will help emphasize the structure of a large PR to make things easier to review.
I suppose you created a web based front end to GitHub PRs for your team to use? Or is it a local tool? Wondering how yours works.
We use gitlab and there's probably some way to hook up a custom external review tool easily (a bot that posts a link to view the current PR in the tool, for example)
Thanks for the idea!
The key thing, for me, is just having an app that is useful enough to keep running. I get ideas on how to streamline and improve review as I do it (for instance: double click on a symbol to highlight it throughout the rest of the function so I can trace assignments and expressions). Five years ago, implementing these random ideas would be too expensive; I'd lose several hours to each of them. Now it's just: have a dumb idea, share the dumb idea with the agent managing my app, check back in in 10 minutes, and now my review app is better.
It's very much like working in Emacs, but for everything.
HTML/JS/CSS is basically entirely vibe coded. I won't even try to reorg the 4000 line ui.js file. I can just redo the whole thing from a new prompt in a few minutes.
For things like the SQL schema I am still doing things entirely by hand. The consequences of getting this part wrong tend to be far more catastrophic than something in the UI layer.
A total overhaul is always but a single prompt and 5 minutes away, should the need arise...
That's how you get bloated apps that run poorly on lower/mid end consumer hardware and environments, with poor accessibility, and whatnot :p
Not that LLMs are the cause, this happened a lot before too, but they can exacerbate the issue. They can also be effectively used to minimize it, though they more often than not don't do that without explicit instructions.
There are easy ways to prevent the bloat and wasteful performance though, sth I do deeply care about.
You can get a long way staying on vanilla or picking (for your llm) one of those superfast frameworks like svelte in ny experience :)
The UI is the layer the customer is most likely to interact with and request changes over. This is why using the AI as the intermediary is so compelling. Most UI code is not long for this world if we are actually putting it in front of live customers. The less emotionally & economically attached to it we are, the better it is for everyone involved.
When my customer gives me crap about the UI, I barely even process it as a cortisol event because I spent very little time inventing the thing they are concerned with. It makes iterating faster and easier when you don't have much pride on the line.
Probably that's one of reasons why modern web experience is terrible.
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.
Avoid known unreliable tools?
with ai the only one that use that code is only him and the reponsibility is still on him
I think the real question here is how we rebuild some confidence and perhaps remove some fear.
I think the main challenge is pressure for more productivity with AI. I often go back and forth about if I am scrutinizing too much (and not being as productive as I could be) or not enough (and shipping slop). Building the additional QA harnesses and feedback loops for agents seems like the best known path forward to accelerate with some safety, but it is still pretty challenging to context-fiy all of the nuanced judgements a seasoned dev team makes.
All comments shown.
Couldn't load more comments. Check your connection and try again.