Code smells in the era of AI Slop code-gen at work

and why I see it but cant do shit about it

AI-first Codegen at Work - Code Smells?

Now that many or most work places mandate that you need to be AI first or whatever that means, where writing code by hand = being sent to the gulag, most engineers rely on AI tools to generate code. What this results in - many features entirely generated by AI, with handholding (AKA a lot of swearing and back and forth).

What’s the impact of this on many good established engineering practices like DRY? I mean, to some extent, most services are supposed to have some common code for doing stuff that is simple - fetch a file from some bucket, rename, delete, etc.

Problem Statement

Consider a standard storage setup: an S3 bucket (or any object store) holding date-partitioned data structured as YYYY/MM/DD/, where each date folder contains multiple files. Several different services need to query data across date ranges, and we already have a common, shared method to asynchronously fetch a single file from the store.

Some sample code on how it is being done

I dont wanna copy paste from my work laptop (bruh) so here is an approximation:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# In a shared storage library
async def fetch_date_range(bucket: str, start_date: date, end_date: date) -> list[dict]:
    dates = generate_date_sequence(start_date, end_date)
    tasks = [
        fetch_files_for_prefix(bucket, f"{d.year}/{d.strftime('%b')}/{d.day:02d}/")
        for d in dates
    ]
    results = await asyncio.gather(*tasks)
    return [item for sublist in results for item in sublist]

# In Service A, Service B, Service C...
records = await storage_client.fetch_date_range("analytics-data", start_date, end_date)

What is everyone doing

Every single service just had devs with unlimited tokens ask them this - fetch me this file, this is the format blah blah

Now you have code like this in all the services:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
all_data = []
for year in range(start_year, end_year + 1):
    for month in ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]:
        for day in range(1, 32):
            prefix = f"{year}/{month}/{day:02d}/"
            try:
                files = await s3_client.list_objects(bucket, prefix)
                for file in files:
                    content = await fetch_file_async(bucket, file)
                    all_data.append(content)
            except Exception:
                continue

this code too - varies - because AI agents are not deterministic so every service has their own code. Now any AI agent can create this and it DOES work.

The problem is - this should be a shared library - you dont need so much code. You take this problem and multiply it 5X, 10X … hope you see where I am going

There is so much volume of code no one can review it. So we just… give up.

My take

This is bad engineering. plain and simple. you may disagree, but I feel its a death trap.

Since codegen is cheap, the pain of writing code disappears, and no one cares how man LOC you wrote and no one cares to look if this function already exists as an API. Code review by agents dont point this out! (atleast not on sol)

Can I do anything about this?

NO.

Why?

  1. That is not a part of my KPI.

    I dont get any goodwill by doing hygiene work. It does not give me promo ability.

  2. It will look like I am stepping on someone else’s service

    The associated trouble of approvals, blah, blah is NOT worth my time

  3. leadership does not care - economic threshold for DRY is kinda dead

    if we need to update this ever, let the AI agents take care of it. That is what leadership will say.

Bottom line

At the service layer, “good enough” duplication will survive. everyone will accept ugly, repetitive boilerplate in non-critical and even critical(yikes) paths because AI can bulk-refactor it when needed. Refactoring across ten repos won’t be a multi-sprint migration anymore - so who cares.

I genuinely do not have words on how this plays out. Let’s see.

Licensed under CC BY-NC-SA 4.0
Built with Hugo
Theme Stack designed by Jimmy