Harvey / Re-fixing the same filesThe re-fixing trap

Why do you keep fixing the same three files?

Because bug risk in most codebases is not spread evenly — a small number of files concentrate most of it, a fix applied to one copy of duplicated logic frequently misses the others, hand-rolled code in that area keeps inviting new mistakes, and no test catches the regression before it ships again. It is rarely bad luck. It is almost always the same handful of files, for reasons you can name.

The pain this is for

"Every change to this part breaks something." "I fixed this bug last month and it's back." "One area of the app eats all my time, and I don't know why." Nobody searches for "churn times complexity" — but almost every founder running a fast-moving codebase has felt this exact pattern, usually without being able to point at the specific files causing it.

Why it's always the same three files

Four separate mechanisms compound on each other, and they tend to stack in the same few files rather than spreading out:

1. Hotspots: complexity and change collide

A file that is both complex (deep nesting, many branches, many responsibilities) and frequently changed is a hotspot — every edit has more ways to go wrong, and it gets edited more often than anywhere else. Ranking files by churn × complexity finds the small set that concentrates most of a codebase's bug risk, instead of treating every file as an equal suspect.

2. Duplication: you fixed one copy

Logic that was copy-pasted instead of shared drifts out of sync. A bug fix lands in the copy someone remembered to edit; the other copies keep the old, broken behavior — so the "same" bug reappears somewhere that was never actually touched.

3. Maintainability: fragile hand-rolled code invites the next bug

Hand-rolled auth, ad-hoc parsing, and other reinvented-wheel code tends to cluster in the same files as the hotspots above, and it is disproportionately fragile — a small change nearby has more ways to break it than code built on a standard, well-tested pattern.

4. Test quality: nothing catches it coming back

A regression returns silently when the tests around that file don't actually exercise the failure path. A green suite that never runs the code that broke — or asserts nothing meaningful when it does — is worse than no suite at all, because it's trusted.

A quick self-audit

  • Can you name, right now, the one or two files every recent bugfix has touched?
  • When you last fixed a bug, did you check whether the same logic was copy-pasted anywhere else?
  • Is there a part of the app new contributors are told to "be careful around"?
  • Does that area have hand-rolled logic where a standard library or pattern would do?
  • If you reintroduced last month's bug on purpose, would a test actually fail?
  • Have you ever ranked files by how often they change AND how complex they are — together?

This is the felt version of the entire code-health half of Harvey's audit in one pain: Hotspots (M3) ranks files by churn × complexity, Duplication (M4) finds the copies a fix missed, Maintainability (M6) flags the fragile hand-rolled code sitting in those same files, and Test quality (M8) runs mutation testing — deliberately breaking your code — to report which of your tests would actually catch the regression coming back.

Find the files causing most of your bugs.

The free scan ranks your codebase by churn × complexity and flags the duplication and fragile code sitting in the same files — no database access needed.