检查 diff 中的回归风险
找出可观察的行为变化,并给出聚焦的测试用例。
填写并复制
最终提示词
按 {{预期行为}} 审查 {{差异}}。每项发现给出改动表达式、触发回归的输入、预期与实际行为,以及最小回归测试。报告有代码证据的问题,样式建议只在影响行为时纳入。 填写全部变量后,即可复制完整提示词。
查看原始模板
提示词原文
Review {{diff}} against {{expected behavior}}. Report only findings supported by the change. For each finding include the changed expression, the input that triggers a regression, the expected and actual behavior, and a focused test. Leave style suggestions out unless they affect behavior.译文
按 {{预期行为}} 审查 {{差异}}。每项发现给出改动表达式、触发回归的输入、预期与实际行为,以及最小回归测试。报告有代码证据的问题,样式建议只在影响行为时纳入。运行样例
Codex · · 单次运行,具体模型版本未记录。
输入
Expected: a free plan has 0 remaining credits and should display 0.
Diff: - const remaining = plan.remaining ?? fallback;
+ const remaining = plan.remaining || fallback;
Fallback = 10.输出
Regression: `plan.remaining || fallback` treats 0 as missing. With remaining = 0 and fallback = 10, the expected display is 0 and the actual display is 10. Add a regression test with these values and assert the result is 0.找到运算符变更和触发问题的零值,明确写出预期与实际结果。