Build a Baseline with Record and Replay
Added 2026-10
Build a Baseline with Record and Replay — Chinese original prompt
要改动的 [模块] 没有任何测试,行为细节只有线上跑着的那份代码知道。请设计录制回放方案:从日志或请求记录里采集输入、连同当时的输出存成基线、改造后用同一批输入重跑并比对。输出:采集范围与脱敏要求、基线存储格式、比对规则(哪些差异可接受)、发现差异时的定位方法。
Site original
Chinese original
Example
Sample input
要改的优惠计算模块没有任何测试,设计录制回放方案,采集输入输出做基线再比对。
The output should include
- 采集范围与脱敏要求都要写清
- 给基线存储格式与比对规则
- 说明发现差异后该怎么定位
Replace these placeholders 1
Swap the bracketed parts for your own details before sending.
[模块]
How to use
基线要包含异常输入,只录成功路径会漏掉最容易改坏的分支。
Try tweaking it
- Have it restate requirements and constraints before writing code.
- Ask for the smallest change plus a rollback path, not a full-file rewrite.
What you should get
- A minimal, runnable change with copy-ready code
- Impact list: which files and call sites must follow
Common mistakes
- Asking it to touch ten files at once, then losing track of what broke what.
- Pasting only the error, with no code or version, and getting an unfixable answer.
How to check the output
- The change runs, can be rolled back, and touches nothing unrelated.
- Edge cases (empty, oversized, concurrent) are covered or explained.
Where it works
- Good for: having it restate requirements and constraints, then propose the smallest runnable change.
- Watch out: include versions and a minimal reproduction with the error, or the fix may look plausible but not fit.