mutation-gate

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

RHDH write gate

RHDH 写入管控门(write gate)

An external write is anything the user cannot undo by closing the session: a pushed commit, an opened pull request, a Jira transition, a posted message, a file changed in someone else's repository.
Reading is not a write. A request to fetch, triage, analyse, or report is intent to read, and it approves nothing.
外部写入指用户无法通过关闭会话撤销的操作:已推送的提交、已创建的拉取请求、Jira状态转换、已发布的消息、他人仓库中被修改的文件。
读取操作不属于写入操作。获取、分类、分析或汇报的请求属于读取意图,无需审批。

The gate

管控流程

1. State the operations. List every operation you are about to perform, in the order you will perform them. For each one give:
FieldWhat it carries
TargetThe exact thing being changed:
owner/repo#412
,
RHIDP-1234
, a branch name, a channel
CommandThe exact command or request, as it will run. Not a paraphrase
PreviewThe body, label, field value, or diff that will land
PreconditionWhat must already be true. Check it immediately before executing, and stop the batch if it is not
On failureWhat happens to the operations after this one if it fails
RecoveryHow to undo or contain this operation once it has happened
Render this as a table in the conversation. Approval happens where the user already is, so the plan goes to them rather than to a file.
Recovery is not optional, and it is not the same as failure handling. Failure handling says what happens to the operations that have not run yet. Recovery says what to do about the one that already did. Write it before asking for approval: an operation you cannot say how to undo is one the user is approving blind. Where there is genuinely no undo — a posted message, a triggered pipeline, a published package — say that, in those words. "Cannot be undone; the message stays" is a complete and useful recovery entry. Silence is not.
When a plan is too large to read in the transcript — a multi-repository bump, a catalog change touching dozens of files — write it to a file in the operating system temporary directory instead, following
/handoff
's convention, and print the absolute path. Do not write it into the user's checkout, where it can reach a commit.
2. Get approval for that stated set. The user approves what they were shown. Earlier intent to publish never authorizes an operation whose exact target and payload have not been shown. If the plan changes after approval — a different target, an extra operation, an edited body — it is a new plan and needs new approval.
3. Execute, then report every operation. Report each one as completed, failed, or skipped, in the order it was planned. An operation that never ran because an earlier one failed is reported as skipped, not omitted. A failed write is reported, never quietly retried into a different shape.
1. 说明操作内容。按执行顺序列出即将执行的每一项操作,每项操作需包含以下信息:
字段说明内容
Target(目标)被修改的具体对象:
owner/repo#412
RHIDP-1234
、分支名称、频道等
Command(命令)即将执行的准确命令或请求,不得意译
Preview(预览)即将生效的内容主体、标签、字段值或差异对比
Precondition(前置条件)执行前必须满足的条件。执行前需立即检查,若不满足则终止批量操作
On failure(失败处理)若本操作失败,后续操作将如何处理
Recovery(恢复方案)本操作执行完成后,如何撤销或控制其影响
需在对话中以表格形式呈现上述内容。审批需在当前对话中完成,因此计划需直接展示给用户,而非写入文件。
恢复方案为必填项,且与失败处理不同。失败处理说明未执行的后续操作如何处理,恢复方案则针对已完成的操作说明补救措施。在请求审批前需明确恢复方案:若无法说明如何撤销某项操作,用户相当于在盲目审批。对于确实无法撤销的操作——如已发布的消息、已触发的流水线、已发布的包——需明确说明“无法撤销;消息将保留”等内容,这是完整且有效的恢复方案,不得留白。
若计划内容过长,无法在对话记录中完整展示——如多仓库版本更新、涉及数十个文件的目录变更——需按照
/handoff
的约定将其写入操作系统临时目录的文件中,并打印文件的绝对路径。不得将其写入用户的检出目录,避免被提交到仓库。
2. 获取对上述操作集的审批。用户仅审批所展示的内容。此前的发布意向并不授权执行未明确展示目标和payload(负载)的操作。若审批后计划发生变更——如目标不同、新增操作、内容主体被编辑——则属于新计划,需重新获取审批。
3. 执行操作并汇报每项结果。按计划顺序汇报每项操作的完成、失败或跳过状态。因前置操作失败而未执行的操作需汇报为“跳过”,不得省略。写入操作失败需如实汇报,不得擅自以不同形式重试。

Credentials never reach a preview

凭证不得出现在预览中

A preview shows a command as it will run, so it can carry a token that was pasted, interpolated from the environment, or returned by a tool. Scan before showing:
bash
uv run scripts/scan_credentials.py <plan.json> --json
uv run scripts/scan_credentials.py --text "<a single command or body>"
It exits non-zero and names the offending path when it finds a credential-shaped field or value — an authorization header, a PEM private key, a
ghp_
,
glpat-
,
xox
,
sk-
, or
AKIA
token, or a field named like a secret at any depth. It reports the field, never the secret.
A credential in a plan is a bug in how the command was built, not something to redact and continue past. Fix the construction so the secret is supplied by the authenticated tool at run time.
预览需展示即将执行的命令,因此可能包含粘贴的令牌、从环境变量插值获取的内容或工具返回的令牌。展示前需扫描:
bash
uv run scripts/scan_credentials.py <plan.json> --json
uv run scripts/scan_credentials.py --text "<a single command or body>"
当检测到凭证格式的字段或值时——如授权头、PEM私钥、
ghp_
glpat-
xox
sk-
AKIA
令牌,或任何层级下名称类似密钥的字段——该脚本将返回非零退出码并指出违规路径,但不会泄露密钥本身。
计划中出现凭证属于命令构建环节的错误,不可通过脱敏处理继续执行。需修改命令构建逻辑,确保密钥在运行时由已认证的工具提供。

Who executes

执行主体

The skill that owns the target executes it. A caller that needs a Jira write invokes
/rhdh-jira-update
; one that needs a forge write builds the command and runs it itself.
/rhdh-forge
constructs forge payloads and never executes them — that separation is what makes this gate enforceable, because the module that knows how to build the command cannot run it.
目标所属的技能负责执行操作。需要写入Jira的调用方需调用
/rhdh-jira-update
;需要写入Forge的调用方需构建命令并自行执行。
/rhdh-forge
仅负责构建Forge负载,从不执行操作——这种分离是本管控门可强制执行的关键,因为构建命令的模块无法执行命令。

Completion

完成标准

Complete when every operation the user approved has an outcome, the outcomes are in the planned order, and each one names its target. An operation missing from the report, or reported without the target it changed, means the gate did not close.
当用户审批的所有操作均有结果、结果按计划顺序呈现且每项结果均注明其所修改的目标时,管控流程完成。若某项操作未出现在汇报中,或汇报未注明其修改的目标,则说明管控流程未正常结束。