verify-commands
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseVerify commands
验证命令
A verify command is an acceptance test. Before shipping one, answer: if this command were silently doing nothing, what in its output would tell me? If you cannot answer, you have a command, not a check. Fix the command; do not invent a statement for it.
验证命令属于验收测试范畴。在交付前,请先回答:如果该命令静默执行无任何操作,从其输出中能看出什么? 如果无法回答,那你拥有的只是一个命令,而非检查项。请修复该命令,不要为它编造理由。
Name the failing direction
明确失败方向
Next to every runnable check, write one line naming the observable signal that means failure: , , , . "The command fails" and "an error occurs" are restatements, not signals. , , and are refusals. Short is fine; is complete. Prefer the signal the tool actually emits over one you imagine: for a command that already ran, state what you saw; for a new one, take the signal from the tool's documented output. N commands need N statements.
non-zero exit"0 passed" in the summary linethe coverage line is absentstderr contains "ECONNREFUSED"TBDN/Anonenon-zero exit在每个可运行的检查旁,添加一行文字说明代表失败的可观测信号:(非零退出码)、、、。“命令失败”和“发生错误”只是重述,并非信号。、和属于回避问题。简短即可;就足够完整。优先使用工具实际输出的信号,而非你想象的信号:对于已运行的命令,说明你实际看到的信号;对于新命令,则参考工具文档中记录的输出信号。N个命令需要N条说明。
non-zero exit摘要行中包含"0 passed"覆盖率行缺失stderr包含"ECONNREFUSED"TBDN/Anonenon-zero exitGround every path
锚定所有路径
Inherit the command that already worked in this repo, verbatim, before deriving a new one. A target or target must exist, or be created by an earlier step, and must hold the matching manifest (, , ). Prefer over ; it does not depend on the caller's working directory. Do not hand-reason the filesystem: list it. If you cannot ground a path, say so instead of guessing.
cd--prefixpackage.jsonMakefilepyproject.tomlnpm --prefix <dir> run <script>cd <dir> && npm run <script>在衍生新命令前,先完全继承仓库中已验证可行的命令。目标或目标必须存在,或由之前的步骤创建,且必须包含匹配的清单文件(、、)。优先使用而非;前者不依赖调用者的工作目录。不要主观推断文件系统结构:列出实际路径。如果无法锚定路径,请如实说明,不要猜测。
cd--prefixpackage.jsonMakefilepyproject.tomlnpm --prefix <dir> run <script>cd <dir> && npm run <script>Shapes that pass while measuring nothing
看似通过但未有效检测的情况
| Trap | Why it passes | Instead |
|---|---|---|
| tree output starts each line with | drop the anchor, or match |
| a count recalled from memory, stale from training | |
| both sides default to | let the failure propagate, or guard with |
| the gate trips on comment text, not on code | describe the forbidden thing by concept, not by literal |
| a file-wide negative is unsatisfiable across regions | scope it: |
| a test-name filter that matches zero tests | exit 0 with nothing asserted | list tests first ( |
The anchor trap has a family: , , , and all print column or tree prefixes. is acceptable only when absence is the default and the value is not used in a comparison meant to detect absence.
npm lsyarn listdocker pskubectl get|| echo default| 陷阱 | 为何会通过 | 替代方案 |
|---|---|---|
| 树形输出每行以 | 移除锚点,或匹配 |
| 数字是凭记忆回忆的,与当前实际情况不符 | 使用 |
| 当输入缺失时,两边默认值均为 | 让失败直接传播,或用 |
| 检查会触发注释文本,而非代码中的内容 | 从概念层面描述禁止的内容,而非字面文本 |
| 针对整个文件的否定检查在不同区域无法满足 | 限定范围:使用 |
| 匹配零个测试的测试名称过滤器 | 无任何断言就返回退出码0 | 先列出测试(使用 |
锚点陷阱有一系列类似情况:、、和都会输出列或树形前缀。只有当缺失是默认情况且该值不用于检测缺失的比较时,才是可接受的。
npm lsyarn listdocker pskubectl get|| echo defaultReviewing someone else's command
审查他人的命令
Report; never prescribe a replacement path you did not verify. A prescribed path is copied verbatim and carries zero information. A missing directory or manifest is a blocker: quote the raw target. A dynamic path, glob, , or variable is a warning, not a licence to guess the literal.
~仅报告问题;切勿给出未经验证的替代方案。指定的替代方案会被直接复制,但不包含任何有效信息。缺失的目录或清单文件是阻塞问题:直接引用原始目标。动态路径、通配符、或变量是警告,而非猜测字面内容的许可。
~