← back to journal
EngineeringJun 12, 20262 min

The service imported the adapter directly. The app ran fine anyway.

arc: the PR ran green so i reviewed it as done → my lead read the imports → the app working told me it runs, not that it belongs

i have been writing about how AI pattern matches. it copies the nearest thing, guards the wrong field, fixes the side it can see.

here is the scarier version i hit this week. sometimes it does not mismatch the pattern. it skips the pattern entirely.

i was building a backend feature. i wrote it, or honestly vibe-coded a good chunk of it, and raised the PR. everything worked. the app was happy, green across the board.

then Jagan sir caught something i had walked straight past.

our backend has a clean separation of concerns. every layer is its own file, and they talk in a strict chain:

routecontrollerservicerepositoryadapterthe databaseeach layer knowsonly the next onethe importthat skippeda layer
the repository is the only thing that is supposed to hold queries — so an import that reaches past it puts queries where nobody looks for them.

simple rule. you do not skip a link in the chain.

the AI skipped a link. in my PR the service file imported the adapter directly, straight past the repository. and the feature worked perfectly, because at runtime an import is just an import. the data flowed. nothing crashed. nothing complained.

and i overlooked it completely. who sits there thinking let me check whether the AI respected my layering. you assume the basics are safe, and it is one import in the wrong file.

but that small thing is the entire point of separation of concerns. the moment the service talks straight to the adapter, the repository layer is a lie. the next person copies the shortcut. and six months later nobody can touch the data layer without breaking three files that were never supposed to know about it.

the thing i actually got wrong was what i thought i was reviewing. the app working told me the code runs. it told me nothing about whether the code belongs where it is. those are two different reviews, and i had only done one.

so this stacks on top of the other AI lessons. it does not only get patterns subtly wrong. sometimes it ignores the architecture completely and ships something that works today and quietly rots, and a fast review glides right over it, because you are checking does it run, not did it cross a layer.

now when i review AI-written backend code i do not start with the logic. i start with the imports. who is this file allowed to talk to, and who is it actually talking to.

"it works" is a runtime fact. "it fits" is an architecture decision. only one of them shows up when you click around the app.

#buildinpublic #softwareengineering #cleanarchitecture #separationofconcerns #ai #maahitatechnologies

Send this as proof →Share on LinkedIn