跪拜 Guibai
← All articles
Frontend

Every Decision Was 'Right' — Until the Project Rotted Anyway

By 涛涛ing ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Teams mistake tidy structure for coherent design, so production outages and multi-month rewrites come as surprises. AI code generation lowers the cost of creating near-duplicate components, which makes degradation accrue faster unless someone actively consolidates.

Summary

The trigger was a checkout feature. Adding a "corporate procurement" field required touching six directories, none named "checkout". A two-year-old validator hidden in `utils` vetoed the new fields and broke production for enterprise clients. The real problem wasn't carelessness; the scattered placement made it impossible to verify completeness.

A medical CRM team's retrospective gave it a name: Architecture Decision Degradation. Each choice — Redux-Toolkit, createAsyncThunk, optimistic updates — was defensible, yet three slices became ten, 41% of bugs were state-related by month 12, and a three-month rewrite loomed by month 16. A migration that moved 143 components unchanged into a new skeleton, plus a 5647-line Vue component with a reverse import cycle, showed that moving house without consolidating just relocates bad habits.

AI sharpens the trap: it generates a new component instead of checking for an existing one, making duplication cheaper than reuse. The author's new yardstick is cohesion — code that changes together for the same reason should live together. Convergence means deciding what should not exist, not just rearranging what does.

Takeaways
— Checkout logic was spread across six directories (form, state, validation, requests, types, payload), none named 'checkout'.
— A two-year-old validator in `utils` silently vetoed new form fields, causing a production outage for corporate orders.
— The medical team saw 41% of bugs related to state management by month 12, and needed a 3-month rewrite by month 16.
— A migration moved 143 old components unchanged into a new five-layer skeleton; no component was split or consolidated.
— `SessionWorkspace.vue` is 5647 lines, mixing six stores, SSE orchestration, input queues, panel dragging, and more.
— A real reverse import cycle exists between `apis` and `identity`, currently masked by lazy calls inside function bodies.
— AI generation defaults to creating a new component rather than checking for an existing one, weakening the incentive to reuse.
— The author's new criterion: code that changes together for the same reason should live together.
Conclusions

ADD differs from technical debt in that each decision is rational at the time; the failure only becomes visible when a dozen rational decisions intersect, making retroactive blame pointless.

The 5647-line component and the import cycle show that even enforced directory structure and lint rules cannot prevent a codebase from becoming untouchable if consolidation is never performed.

AI's role is not to introduce duplication but to remove the cost barrier that previously made reuse the default choice, so teams must institutionalize consolidation rather than rely on individual discipline.

Concepts & terms
Architecture Decision Degradation (ADD)
The gradual erosion of architecture quality through accumulated compromises. Unlike technical debt, which is a deliberate tradeoff, ADD happens when each individual decision seems correct at the time, but the accumulation pushes the system toward an unintended, fragile state.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗