sanity-check
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSanity Check
合理性检查(Sanity Check)
Passing tests is necessary but not sufficient. Before declaring done, verify your code matches the real world.
测试通过是必要条件,但并非充分条件。在宣布完成前,请确认你的代码与实际场景相符。
When to Run
执行时机
After implementation is complete and tests pass. Before committing or declaring done.
在实现完成且测试通过后,提交代码或宣布完成前执行。
Checks
检查项
1. Run with Real Data
1. 使用真实数据运行
- Execute the program with real inputs (dry-run if available).
- Check output makes sense — wrong numbers, weird dates, implausible results → investigate.
- If no dry-run mode exists, call real endpoints in a throwaway script and confirm the response matches your code's assumptions.
- 使用真实输入执行程序(若支持预演模式则用预演模式)。
- 检查输出是否合理——若出现错误数值、异常日期、不符合逻辑的结果,需展开调查。
- 若没有预演模式,可在一次性脚本中调用真实接口,确认响应是否与代码中的假设一致。
2. Cross-Check External APIs
2. 交叉验证外部API
- Verify every field name, enum value, and response shape against actual API docs.
- Don't trust what you "know" — open the docs and confirm.
- If you can't verify a field, response shape, or identifier from docs or real responses, stop and ask. A wrong guess that passes tests is worse than a blocker that gets flagged.
- 对照实际API文档,验证每个字段名、枚举值和响应结构。
- 不要凭“经验”判断,打开文档确认细节。
- 若无法通过文档或真实响应验证某个字段、响应结构或标识符,请暂停并询问相关人员。一个能通过测试的错误假设,比被标记的阻塞问题更糟糕。
3. Smell Test
3. 直观合理性测试
- Does the output look right to a human?
- Are the numbers in the right ballpark?
- Would you trust this if you saw it in production?
- 输出结果在人类视角下是否正常?
- 数值是否在合理范围内?
- 如果在生产环境看到这个结果,你会信任它吗?
4. Contract Boundaries
4. 契约边界检查
- Changed a public API/interface? Verify all callers still work.
- Touched persistence/state? Verify read/write roundtrip with real data.
- Changed config? Verify the program starts with the new config.
- Schema/state changes must be forward-compatible. Document rollback path.
- 若修改了公共API/接口,请验证所有调用方仍能正常工作。
- 若涉及持久化/状态操作,请使用真实数据验证读写往返流程。
- 若修改了配置,请验证程序能使用新配置正常启动。
- Schema/状态变更必须具备向前兼容性,同时记录回滚路径。
If Something Smells Off
若发现异常
Don't rationalize it. Investigate. Don't burn tokens on workarounds — surface the issue.
不要找借口合理化问题。展开调查。不要浪费精力在临时解决方案上,而是将问题暴露出来。
Output
输出结果
After running checks, report:
- Verified: what you checked and how
- Gaps: things you couldn't verify and why
- Confidence: /
ship it/needs reviewblocked
完成检查后,需提交报告:
- 已验证内容: 你检查了哪些内容,以及检查方式
- 待确认项: 无法验证的内容及原因
- 信心等级: (可发布)/
ship it(需评审)/needs review(阻塞)blocked