ds-verify-loop
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseds-verify-loop
ds-verify-loop
Prove a change works by running the real check and fixing what it reports, not what you expect it to report.
通过运行真实检查并修复其实际报告的问题来证明变更有效,而不是根据预期结果进行修复。
Steps
步骤
- Pick the check before you edit: the narrowest real command that proves the change, such as one test file, a typecheck, a build, or a run of the app with one request. Write the command down.
- Run it once before the edit if you can, so you know the baseline (already failing, already passing, or broken for another reason).
- Make the smallest edit that should satisfy the check.
- Run the exact command. Read the full error output, including the first error, the file and line, and the stack frame in your code. Do not skim to the last line.
- State the root cause in one sentence, based on the output. If you cannot, add one print or log line, or read the failing code, and rerun. Do not guess.
- Fix the cause, not the symptom. Do not add a special case for the one input that the test uses.
- Rerun the same command. Count this as one iteration.
- When the narrow check passes, run the wider one once (the full test suite, the build, or a lint) to catch breakage elsewhere.
- Paste the final passing output (the command and its last lines) in your reply or in PROGRESS.md.
- 在编辑之前选择检查:使用能够证明变更有效性的最窄真实命令,例如单个测试文件、类型检查、构建,或使用一个请求运行应用。将命令记录下来。
- 如果可以,请在编辑前运行一次,以便了解基线状态(原本就失败、原本就通过,或因其他原因而损坏)。
- 进行满足检查所需的最小修改。
- 运行完全相同的命令。阅读完整的错误输出,包括第一个错误、文件和行号,以及代码中的 stack frame。不要直接跳到最后一行。
- 根据输出,用一句话说明根本原因。如果无法确定,请添加一行 print 或 log,或阅读失败的代码,然后重新运行。不要猜测。
- 修复原因,而不是症状。不要为测试使用的某一个输入添加特殊处理。
- 重新运行相同的命令将此计为一次迭代。
- 当范围较窄的检查通过后,再运行一次范围更广的检查(完整测试套件、构建或 lint),以发现其他位置的损坏。
- 在回复或 PROGRESS.md 中粘贴最终通过的输出(命令及其最后几行)。
Stop when
停止条件
- The check passes and you have pasted the output. A claim without output does not count.
- You reach 5 iterations without passing. Stop editing, report the last error, and switch to ds-unstick.
- The same error appears twice after two different fixes. Switch to ds-unstick now. Do not wait for iteration 5.
- 检查已通过,并且已粘贴输出。没有输出支持的结论不算通过。
- 经过 5 次迭代仍未通过。停止编辑,报告最后一个错误,并切换到 ds-unstick。
- 在进行两次不同的修复后,同一个错误再次出现。立即切换到 ds-unstick,不要等待第 5 次迭代。
Rules
规则
- Never weaken, skip, delete or loosen a test, assertion, type or lint rule to make the check pass. If the test is wrong, say why and ask first.
- Never mock away the thing under test.
- Run the real command every time. Do not reason about what it would print.
- Change one thing per iteration so that you know what fixed it.
- If no check exists, write the smallest one that fails without your change, then use the loop.
- 绝不能为了通过检查而削弱、跳过、删除或放宽测试、断言、类型或 lint 规则。如果测试本身有误,请说明原因并先征求同意。
- 绝不能 mock 掉被测试的对象。
- 每次都运行真实命令。不要根据推测判断它会输出什么。
- 每次迭代只修改一个事项,以便明确是什么修复了问题。
- 如果不存在检查,请编写一个最小的检查,使其在没有你的修改时失败,然后使用该循环。