cut
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/cut
/cut
/cut/cutContract
契约
text
cut(spec_ref, reproduction? = null, auto = false) -> GateReceiptResolve every validator invocation through
§ Packaged command
resolution. A bare binary is not installed.
references/gate-workflow.mdred-gateTrigger Cut explicitly, from Mold's approved handoff, or from a
Cook preflight that has no valid receipt. Read the durable spec and its gate
metadata; do not infer applicability from prose. A behavior item must have at
least one Test Contract. A legacy spec without the table may proceed without a
new approval, but Cut must stamp every resulting contract
in the evidence.
red-requiredcontract_source: inferredCut owns only test-side files: outer tracers, mechanically justified
contract-matrix cases, fixtures, and test-only harness support. It may adopt a
qualifying user/Pasteurize reproduction after normalizing it to the approved
seam, argv, cwd, and witness. Adopted cases carry and
; generated cases carry .
producer: cutorigin: adoptedorigin: generatedtext
cut(spec_ref, reproduction? = null, auto = false) -> GateReceipt通过 § 打包命令解析规则处理所有验证器调用。系统未安装独立的二进制文件。
references/gate-workflow.mdred-gate可通过以下方式触发Cut:用户显式调用、Mold移交已批准的任务,或Cook预检查时发现无有效凭证。读取持久化规范及其网关元数据;请勿通过 prose 推断适用性。每个行为项必须至少包含一个测试契约。没有契约表的旧版规范无需重新批准即可继续,但Cut必须在证据中为所有生成的契约标记。
red-requiredcontract_source: inferredCut仅负责测试侧文件:外部追踪器、机械生成的契约矩阵用例、夹具,以及仅用于测试的工具支持。在将用户/Pasteurize复现用例标准化为批准的边界、argv、cwd和观测点后,Cut可采用该用例。采用的用例标记和;生成的用例标记。
producer: cutorigin: adoptedorigin: generatedFlow
流程
-
Resolve and classify. Read the spec, then run. Preserve approved interface, seam, expected failure, and mode exactly. Legacy inference is visible in the returned plan and needs no re-approval. Validate
red-gate contracts <spec>before selecting a runner.gate_applicability -
Close N/A early. A Mold-approveddeclaration for one closed class (
not-applicable,docs-only,refactor-only, ortest-only) produces a non-empty reason and no RED contracts, baseline checks, cases, protected files, guards, or receipt-level mode. It still goes throughappearance-only.red-gate issue -
Choose the seam and declare the phase. Reuse the project's existing runner and conventions. Functional UI reuses the declared browser/E2E seam. If no project or standard-library runner is available, halt with an explicit harness decision; never install or invent a third-party runner. Write a strict phase plan underwith
.cheese/cut/,schema_version,producer,work_id, the exact project-relativeproject_keyCook may change, and baseline entries containing onlyproduction_paths,id, and project-relativeargv. Everything outside those roots is an immutable oracle dependency unless Cut adds it as a protected test file.cwd -
Begin before the oracle. Before creating or adopting a new oracle, call:text
red-gate begin .cheese/cut/<slug>.plan.json --out .cheese/cut/<slug>.phase.jsonruns every broad baseline in order, requires exitbegin, and freezes the full project snapshot. Its printed0andphase_token_refare mandatory candidate fields. A missing baseline, unsafe argv, non-zero exit, stale output path, or uninspectable filesystem halts without a token. Never hand-write or reuse a phase token.phase_token_sha256 -
Freeze the baseline evidence. Copy the token's exact baseline command identities into the candidate and record each observed exit as. Baseline argv must exclude the protected RED-oracle paths or remain green with the oracle present, because receipt validation replays them after oracle creation. Do not recapture the baseline after writing the oracle.
0 -
Write only the oracle. Add one outer tracer per behavioral curd, or a complete matrix only when a ratified/versioned interface mechanically derives every named row. A matrix contract declaresand unique
interface_version; its receipt binds exactly one contract case to each row. Do not change production files, add production stubs/adapters, or require a commit.matrix_rows -
Prove RED. Replay each selected case through its declared argv (never shell evaluation). The case must fail for its assertion witness. Collection, import, dependency, fixture, syntax, or other harness failures are not a behavioral RED. Recheck the production-tree fingerprint after the run. Assertion-origin proof is available only for direct Python scripts/,
-c, andpython -m pytest. An existing runner outside those profiles requires an explicit harness decision; never infer RED from its rendered traceback or exit text.python -m unittest -
Issue canonical evidence. Build the candidate underwith the frozen pre-Cut
.cheese/cut/candidates/, phase token ref and digest, protected test digests, and zero initial guards, then call exactly:baseline_checkstextred-gate issue <candidate> --token .cheese/cut/<slug>.phase.json --out .cheese/cut/<slug>.jsonis the only receipt writer. It verifies that every post-token project change is an exact protected test-side path before replaying. Never hand-write or publish raw GateReceipt JSON. A changed production tree, harness-only failure, stale digest or token, missing baseline, unsafe argv, or witness mismatch leaves no successful receipt.red-gate issue -
Handoff. After issue succeeds, write the small handoff projection and pass the receipt to Cook. In, dispatch Cook once with that receipt. In synchronous Cook preflight, return the receipt to the caller and do not recursively dispatch Cook.
--auto
The detailed event order, candidate fields, refusal rules, and dirty-tree
fingerprinting live in .
references/gate-workflow.md-
解析与分类。读取规范,然后运行。严格保留已批准的接口、边界、预期失败结果和模式。旧版规范的推断结果会在返回的计划中显示,无需重新批准。选择运行器前需验证
red-gate contracts <spec>。gate_applicability -
提前关闭不适用项。若Mold批准了针对某一封闭类别(、
docs-only、refactor-only或test-only)的appearance-only声明,需生成非空原因,且不生成RED契约、基线检查、用例、受保护文件、防护规则或凭证级模式。但仍需执行not-applicable。red-gate issue -
选择边界并声明阶段。复用项目现有的运行器和约定。功能性UI复用已声明的浏览器/E2E边界。若没有可用的项目或标准库运行器,需暂停并明确工具决策;绝不能安装或自行开发第三方运行器。在下编写严格的阶段计划,包含
.cheese/cut/、schema_version、producer、work_id、Cook可能修改的精确项目相对路径project_key,以及仅包含production_paths、id和项目相对路径argv的基线条目。除非Cut将其添加为受保护测试文件,否则这些根目录之外的所有内容均为不可变的依赖项。cwd -
在依赖项创建前启动。创建或采用新依赖项前,调用:text
red-gate begin .cheese/cut/<slug>.plan.json --out .cheese/cut/<slug>.phase.json会按顺序运行所有宽泛的基线检查,要求退出码为begin,并冻结完整的项目快照。其输出的0和phase_token_ref是必填候选字段。若缺少基线、argv不安全、退出码非零、输出路径过期或文件系统不可检查,将暂停且不生成令牌。绝不能手动编写或复用阶段令牌。phase_token_sha256 -
冻结基线证据。将令牌的精确基线命令标识复制到候选文件中,并记录每个观测到的退出码为。基线argv必须排除受保护的RED依赖项路径,或在依赖项存在时仍保持GREEN状态,因为凭证验证会在依赖项创建后重放这些检查。编写依赖项后不得重新捕获基线。
0 -
仅编写依赖项。为每个行为curd添加一个外部追踪器,或仅在已批准/版本化的接口可机械生成每个命名行时生成完整矩阵。矩阵契约需声明和唯一的
interface_version;其凭证会将每个行绑定到一个契约用例。不得修改生产文件、添加生产存根/适配器,或要求提交代码。matrix_rows -
验证RED状态。通过声明的argv重放每个选中的用例(绝不能使用shell解析)。用例必须因断言观测点而失败。收集、导入、依赖项、夹具、语法或其他工具故障不属于行为RED。运行后重新检查生产树指纹。仅直接Python脚本/、
-c和python -m pytest可提供断言来源证明。若现有运行器不在上述范围内,需明确工具决策;绝不能从其生成的回溯信息或退出文本推断RED状态。python -m unittest -
生成标准证据。在下构建候选文件,包含冻结的Cut前
.cheese/cut/candidates/、阶段令牌引用和摘要、受保护测试文件摘要,以及初始空防护规则,然后精确调用:baseline_checkstextred-gate issue <candidate> --token .cheese/cut/<slug>.phase.json --out .cheese/cut/<slug>.json是唯一的凭证生成工具。它会验证令牌生成后的所有项目变更是否为精确的受保护测试侧路径,然后重放检查。绝不能手动编写或发布原始GateReceipt JSON。若生产树变更、仅工具故障、摘要或令牌过期、缺少基线、argv不安全或观测点不匹配,将无法生成有效凭证。red-gate issue -
移交。生成凭证成功后,编写简短的移交投影文件,并将凭证传递给Cook。在模式下,使用该凭证调度Cook一次。在同步Cook预检查中,将凭证返回给调用方,不得递归调度Cook。
--auto
详细的事件顺序、候选字段、拒绝规则和脏树指纹识别规则请参考。
references/gate-workflow.mdReceipt invariants
凭证不变量
A RED receipt has , non-empty contracts, frozen pre-Cut
, RED cases, and protected test-side file digests. Each
entry is the broad project result captured before the oracle;
its , , , and are immutable receipt
evidence, not a Cook-owned recapture. The receipt also carries the exact
and emitted before the oracle; Cook
validates that entry proof rather than trusting an issue-time snapshot. Initial
Cut receipts have ; guards belong to later Press evidence.
Each ordinary behavioral curd owns one tracer. A contract matrix is allowed
only for a ratified/versioned interface: the contract records its non-empty
and unique , and its RED evidence contains
exactly one case for each named . A receipt may mix
tracer and matrix modes because mode belongs to each Test Contract. The active
case origin remains or .
producer: cutbaseline_checksbaseline_checksidargvcwdobserved_exit_codephase_token_refphase_token_sha256guard_receipt_refs: []interface_versionmatrix_rowskind: contractmatrix_rowgeneratedadoptedA dirty worktree is safe: preserve the pre-existing delta, add only the oracle
files, and do not create a RED-only commit. A production digest change, a
harness-only failure, or a missing GREEN baseline blocks issuance. An
unavailable runner blocks for a harness decision rather than adding a
third-party dependency.
RED凭证包含、非空契约、冻结的Cut前、RED用例和受保护测试侧文件摘要。每个条目是依赖项创建前捕获的宽泛项目结果;其、、和是不可变的凭证证据,而非Cook负责重新捕获的内容。凭证还包含依赖项创建前生成的精确和;Cook会验证该条目证据,而非信任生成凭证时的快照。初始Cut凭证的;防护规则属于后续Press证据的范畴。每个普通行为curd对应一个追踪器。仅当接口已批准/版本化时才允许使用契约矩阵:契约需记录非空的和唯一的,其RED证据包含每个命名对应的一个用例。凭证可混合追踪器和矩阵模式,因为模式属于每个测试契约。活跃用例的来源仍标记为或。
producer: cutbaseline_checksbaseline_checksidargvcwdobserved_exit_codephase_token_refphase_token_sha256guard_receipt_refs: []interface_versionmatrix_rowsmatrix_rowkind: contractgeneratedadopted脏工作树是安全的:保留现有差异,仅添加依赖项文件,不得创建仅RED的提交。生产摘要变更、仅工具故障或缺少GREEN基线会阻止凭证生成。若运行器不可用,需暂停并明确工具决策,而非添加第三方依赖。
Handoff
移交
Write with this minimum shape only after the canonical
receipt exists:
.cheese/cut/<slug>.mdtext
status: ok
next: cook
artifact: .cheese/cut/<slug>.jsonThe canonical receipt is the handoff's baseline carrier: Cook must consume its
frozen exactly and must not overwrite or recapture them.
baseline_checksThe orientation line may explain the selected contracts and runner. A blocked
attempt uses and does not claim .
halt: <reason>next: cook仅在标准凭证生成后,编写文件,至少包含以下格式:
.cheese/cut/<slug>.mdtext
status: ok
next: cook
artifact: .cheese/cut/<slug>.json标准凭证是移交的基线载体:Cook必须精确使用其冻结的,不得覆盖或重新捕获。
baseline_checks说明行可解释所选契约和运行器。若操作被阻止,需使用,且不得声明。
halt: <reason>next: cookDiscipline
规范
Iron Law: No successful Cut RED receipt without a GREEN baseline and a
test-only protected RED oracle issued by .
red-gate issueRed Flags — stop if you notice these:
- production code changed while the tracer is being written;
- the first run fails during collection, import, fixture setup, or dependency loading;
- a test is failing before the baseline was recorded;
- a missing runner is being solved by adding a dependency;
- a RED-only commit is being proposed;
- the candidate is being serialized directly as the published receipt;
- synchronous Cook is being called recursively from its Cut preflight.
| Rationalization | Why it fails | Required action |
|---|---|---|
| “I can add the outer test after Cook implements it.” | That removes independent evidence of the pre-implementation failure. | Establish GREEN before creating the oracle, then prove RED, before any production edit. |
| “A collection crash is close enough to RED.” | A harness failure does not test the approved behavior or witness. | Fix or report the harness; issue nothing. |
| “The runner is missing, so I will install a convenient framework.” | Cut cannot silently alter the target project's toolchain. | Halt for an explicit harness decision. |
| “The worktree is already dirty, so a commit makes the receipt safer.” | The receipt protects digests; a RED-only commit is not part of the contract. | Fingerprint the pre-existing delta and leave history untouched. |
| “A hand-written receipt has all the fields.” | Raw JSON can bypass replay, digest, guard, and canonicalization checks. | Route every candidate through |
| “Cook called Cut, so Cut should call Cook back.” | Recursive chaining can loop and loses ownership of the preflight boundary. | Return the receipt synchronously; only |
铁律: 若无GREEN基线和由生成的仅测试受保护RED依赖项,无法生成有效的Cut RED凭证。
red-gate issue红色警报 —— 若发现以下情况请立即停止:
- 编写追踪器时修改了生产代码;
- 首次运行在收集、导入、夹具设置或依赖项加载阶段失败;
- 基线记录前测试已失败;
- 通过添加依赖项解决运行器缺失问题;
- 提议创建仅RED的提交;
- 将候选文件直接序列化为已发布凭证;
- 从Cook预检查中递归调用同步Cook。
| 合理化理由 | 失败原因 | 要求操作 |
|---|---|---|
| “我可以在Cook实现后再添加外部测试。” | 这会移除实现前失败的独立证据。 | 在创建依赖项前先验证GREEN状态,然后证明RED状态,再进行任何生产编辑。 |
| “收集时崩溃已接近RED状态。” | 工具故障无法测试已批准的行为或观测点。 | 修复或上报工具问题;不生成任何凭证。 |
| “运行器缺失,所以我将安装一个便捷的框架。” | Cut不能擅自修改目标项目的工具链。 | 暂停并明确工具决策。 |
| “工作树已脏,提交会让凭证更安全。” | 凭证保护的是摘要;仅RED的提交不属于契约范畴。 | 为现有差异生成指纹,保留历史记录不变。 |
| “手写凭证包含所有字段。” | 原始JSON可绕过重放、摘要、防护和标准化检查。 | 所有候选文件必须通过 |
| “Cook调用了Cut,所以Cut应该回调Cook。” | 递归链式调用可能导致循环,并丢失预检查边界的所有权。 | 同步返回凭证;仅 |
Pressure gate
压力测试网关
A failing pre-skill pressure run is required before this workflow is treated as
durable. The scenario and oracle-sensitivity mutations are in
; AC-12 is covered
by .
references/pressure-eval.mdtests/python/test_cut_pressure_eval.py在将此工作流视为持久化流程前,需完成一次失败的预技能压力测试。场景和依赖项敏感度变更规则请参考;AC-12由覆盖。
references/pressure-eval.mdtests/python/test_cut_pressure_eval.pyPipeline
流水线
culture → mold → **cut** → cook → press → age → cure → plateculture → mold → **cut** → cook → press → age → cure → plate