Skip to content
mentoor

Topic 5 of 5 · 4 min read

Spotting architecture drift across many changes

Goal: Read a month of change summaries, name the architecture drift they show and choose one corrective step.

Architecture drift is what you get when every change is reasonable on its own and the sum of them is not: the design you intended slowly stops being the design you have.

Check yourself · 1 of 3

What is architecture drift?

Choose one answer

Why it matters

Reviewing one diff catches a bad import. It does not catch the fortieth slightly different way to call the payment API. Agents raise the volume: a team that merges 10 changes a week can now merge 40, each locally fine. No single pull request looks wrong, so nobody objects, and six months later nobody can explain how the system fits together. Drift is a trend, so you have to look at trends.

How to look for it

  1. Read the change log in bulk. Once a month, read a list of merged change titles and the files they touched, not the diffs. Patterns show up: the same file in 30 changes, a new folder every week, three kinds of error handling.
  2. Track a few numbers. Pick measures you can compute from the repo: count of dependency-rule violations in the baseline, number of dependency cycles, size of the largest files, count of direct database calls outside the data layer. A number that only goes up is drift.
  3. Look for second ways of doing things. Two HTTP clients, two logging styles, two date libraries, two ways to validate input. Each one started as an agent's convenient choice.
  4. Look for hotspots. Files that change in most pull requests are where coupling lives. Version control history gives you the list.
  5. Hold a short architecture review. Monthly, 30 minutes. Questions: what did we add that we did not plan? Which rule was bent? Which decision needs a record or a change?
  6. Set a refactoring budget. Reserve a fixed share of capacity, for example one task in five or one day every two weeks, for paying drift down. Put the tasks in the same backlog as features, or they never happen.

Before and after

Before: "The code feels messy." Nobody acts.

After: "In November, 6 changes added direct fetch calls in components. Two HTTP clients now exist. Corrective step: choose apiClient as the standard, record it as ADR 0014, add a lint rule banning raw fetch in src/components, and migrate the six call sites in one refactor task."

What goes wrong

  • Waiting for a big rewrite. Drift is cheaper to fix in small steps while the context is fresh.
  • Blaming the agent. The agent followed the repo's existing habits. Fix the habits, the rules and the instructions.
  • Measuring too much. Ten dashboards that nobody reads are as useful as none. Choose three numbers.

Examples

One month of change summaries

A team reads its merged changes for a month:

  • 6 changes added a raw fetch call inside a component.
  • 9 changes edited helpers.ts, now 1,800 lines.
  • 3 changes added a new date library each.
  • 0 changes touched the billing module's tests.

The pattern is three separate drifts: no standard HTTP client, a god file, and no agreed date library. Corrective step for this month: pick the HTTP client, write the record and add the lint rule.

A small refactoring budget

A team of four ships agent-assisted changes every day. They agree that every fifth ticket in the sprint is a refactor ticket taken from the drift list, and that the monthly review adds at most three items to it.

The cap matters. Three clear, finishable tasks get done; a list of thirty is ignored.

Key points

  • Drift is a trend across many individually acceptable changes, so it needs a periodic look at the whole, not closer reading of each diff.
  • Read merged change titles and touched files in bulk to find repeated hotspots, new folders and second ways of doing the same thing.
  • Track a few countable measures, such as dependency cycles, rule violations and the size of the largest files, and watch which way they move.
  • A short monthly architecture review should end with one corrective step: a record, a check or a refactoring task.
  • Reserve a fixed share of capacity for refactoring and put that work in the normal backlog.

Common mistakes

  • Reading each diff carefully but never looking at the trend across a month.
  • Collecting many metrics and acting on none.
  • Blaming the agent for patterns the repo already modelled.
  • Planning a large rewrite instead of regular small corrections.

Check yourself · 2 of 3

Which activity best reveals drift that no single review would catch?

Choose one answer

Check yourself · 3 of 3

A monthly review finds two HTTP clients and six raw fetch calls in components. Which corrective step is best?

Choose one answer

Practice items, not counted towards your mastery.

Start here