debug

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Debug

调试

When to use

适用场景

  • Something is broken
  • A test is failing
  • Behavior does not match expectations
  • 功能出现故障
  • 测试用例失败
  • 实际行为与预期不符

Process

流程

  1. Reproduce the problem and read the real error or failing output.
  2. Form one hypothesis about the root cause.
  3. Run one targeted check to confirm or reject that hypothesis.
  4. Fix the root cause and add a test that proves it.
  5. Run the strongest relevant verification before finishing.
  1. 复现问题并查看真实的错误或失败输出。
  2. 针对根本原因提出一个假设。
  3. 执行一项针对性检查以确认或推翻该假设。
  4. 修复根本原因并添加一个可验证修复的测试用例。
  5. 完成前执行最相关的严格验证。

Verification

验证标准

  • The problem is reproduced before the fix
  • The root cause is identified, not guessed
  • The fix is covered by a test where possible
  • The final checks pass
  • 修复前已成功复现问题
  • 已确定根本原因,而非猜测
  • 尽可能为修复添加测试覆盖
  • 最终检查全部通过

Rules

规则

  • Make the smallest safe fix for the proven root cause.
  • If the bug comes from a contract mismatch or unhandled failure path, fix that explicitly.
  • If there is no concrete bug or symptom, clarify the problem before debugging.
  • One hypothesis at a time.
  • Fix root cause, not symptoms.
  • Do not hide missing evidence. If you did not run it, say so.
  • If repeated attempts fail, step back and trace the data flow from the entry point.
  • 针对已证实的根本原因进行最小且安全的修复。
  • 如果bug源于契约不匹配或未处理的失败路径,需明确修复该问题。
  • 如果没有具体的bug或症状,先明确问题再进行调试。
  • 一次只验证一个假设。
  • 修复根本原因,而非表面症状。
  • 不要隐瞒未完成的检查。如果未执行某项检查,需说明。
  • 如果多次尝试失败,退一步从入口点追踪数据流。