DEV Community

Riven Desk
Riven Desk

Posted on

The AI PR that deleted “unused” code still wired by name

I keep hitting this one in AI-written PRs.

The agent grepped for call sites, saw none, and deleted a helper, a handler, or a small module as "unused." Diff is tidy. CI greens. Summary says cleanup. Production or a plugin path still reaches it by string name, reflection, a registry, a YAML key, or a dynamic import the agent never followed.

You did not ask for a smaller tree. You asked for a safe change.

The 60-second check I run now

When an agent PR deletes code marked unused:

  1. Search for the symbol as a string, config key, and filename — not only as an AST reference.
  2. Ask: could a plugin, worker, or feature flag still load this by name?
  3. If the only proof of "unused" is "no direct imports," I bounce it or demand a runtime path check. A green unit suite is not proof nothing loads it.

This is one of the stops on a short bar I use before I merge agent PRs. Free one-pager if you want the rest: https://chopragunji.gumroad.com/l/zpnmdn

If you'd rather someone else do a hard pass on one scary AI PR, I still have founding slots at $49 (normally $99): https://chopragunji.gumroad.com/l/byoyi/FOUNDING

Has an agent on your team ever deleted "dead" code that was still load-bearing?

Top comments (0)