fix-bug
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBug fix workflow
Bug 修复工作流
- Understand the reported bug precisely.
- Identify the expected behavior, the actual behavior, and the smallest scope that reproduces the problem.
- Inspect the existing tests and locate the best place to extend them.
- Prefer enhancing an existing focused test file over adding a broad new one.
- Before modifying tests, gather debugging evidence that helps explain the failure mode.
- Use logging, screenshots, traces, or other lightweight diagnostics that fit the stack.
- Enhance the tests until they reproduce the bug.
- If a relevant test already fails for the bug, keep it as the reproduction and tighten it only if needed.
- Stop once the reproduction is minimal, reliable, and clearly tied to the reported bug.
- Fix the implementation without weakening the new or existing assertions.
- Keep the code change as small and cohesive as possible.
- Run the enhanced tests and confirm they pass with the fix in place.
- If the repository workflow requires broader verification, run the relevant checks after the targeted tests pass.
- Summarize the root cause, the test enhancement, and the implementation fix.
- 准确理解上报的bug。
- 明确预期行为、实际行为,以及可复现问题的最小范围。
- 检查现有测试,找到扩展测试的最佳位置。
- 优先增强现有的针对性测试文件,而非新增宽泛的新测试文件。
- 修改测试前,收集有助于解释失败模式的调试证据。
- 结合技术栈使用日志、截图、链路追踪或其他轻量诊断工具。
- 增强测试直至可以复现bug。
- 如果已有相关测试因该bug失败,直接将其作为复现用例,仅在必要时收紧断言即可。
- 当复现用例足够精简、可靠,且与上报bug明确关联时即可停止。
- 修复代码实现,不得弱化新增或现有断言的校验强度。
- 尽可能保持代码修改的最小化与内聚性。
- 运行增强后的测试,确认修复后所有测试均可通过。
- 如果代码仓库工作流要求更全面的验证,在目标测试通过后运行相关检查项。
- 总结根本原因、测试优化内容以及代码修复方案。