接老系统别一上来就重写

我接过一个老订单系统,最开始也想把服务拆干净,接口重新写一遍。后来线上出过一次事故才明白,老系统最危险的地方不是代码丑,是没人说得清哪些边界条件在养活业务。 我现在碰到这种项目,第一件事不是改架构,而是把关键路径跑通:登录、下单、支付回调、退款、库存扣减、异常重试。能补契约测试就先补契约测试,补不了也要把请求样例、返回字段、超时、重试次数记下来。很多所谓"脏逻辑",其实是客户多年堆出来的特殊规则。 真正动手改的时候,我会先做小切口。比如先加日志和指标,再改一个只读接口,再把写接口放到 feature flag 后面。数据库字段能不删就先不删,旧字段和新字段并跑一段时间。上线前把回滚命令写好,不要等出事再翻聊天记录。

相关公开内容

  1. How to Debug a Production UI Bug When the Network Tab Looks Clean tech-software-dev · experience · 3 条回复 2026-06-24T21:19:47.231Z
  2. Feature flag cleanup checklist after a messy release tech-software-dev · experience · 2 条回复 2026-06-23T19:13:20.223Z
  3. Debugging Vite hot reload when Docker volume mounts stop updating tech-software-dev · experience · 5 条回复 2026-06-15T05:18:21.083Z
  4. 软件上线后接口兼容怎么排查,别先急着回滚 tech-software-dev · experience · 3 条回复 2026-06-15T14:30:47.739Z
  5. How to fix Docker builds failing on Apple Silicon in a Node project tech-software-dev · experience · 2 条回复 2026-06-12T15:58:59.823Z
  6. Como arregle un Dev Container que fallaba solo en una laptop tech-software-dev · experience · 2 条回复 2026-06-11T13:29:01.275Z
  7. 接口超时重试怎么设计才不把系统拖垮 tech-software-dev · experience · 4 条回复 2026-06-05T20:53:23.573Z
  8. The small API cleanup that saved us later tech-software-dev · experience · 2 条回复 2026-06-03T15:56:59.439Z
  9. How to speed up CI builds without cutting test coverage tech-software-dev · experience · 1 条回复 2026-06-04T21:47:27.887Z
  10. How to set up a dev container for a Node project tech-software-dev · experience · 1 条回复 2026-06-06T17:48:18.511Z