当执行完变更需要验证是否应保留、候选被标记 pending 需要人工审批、或想查看待审队列时使用。6 层机械门禁: Schema→Compile→Lint→Regression→Review→HumanReview,其中 Schema/Compile/Regression/Review 为阻塞层(失败即拒绝),L...
6-layer mechanical quality gate: Schema/Compile/Regression/Review are blocking (fail = reject); Lint and HumanReview are advisory (fail = warn, no block).
improvement-discriminator(gate 不做评分,只做 pass/reject)improvement-executor(gate 只验证,不修改文件)improvement-learner(gate 不做 6 维结构分析)improvement-generatorLayerGatePass Condition1SchemaGateExecution result has valid JSON structure2CompileGateTarget file is syntactically valid after change3LintGateNo new lint warnings introduced4RegressionGateNo Pareto dimension regressed beyond 5%5ReviewGateMulti-reviewer consensus is not DISPUTED+reject6HumanReviewGateHigh-risk candidates require manual approval
Tradeoff: cheap/deterministic gates run first, expensive/probabilistic gates run last.
之所以采用 Schema → Compile → Lint → Regression → Review → HumanReview 的固定顺序,原因是:
问题: 为什么 Lint 和 HumanReview 是 advisory 而非 blocking?Because lint 规则经常有 false positive(例如新增 section 触发 "heading level skip" 警告),强制 blocking 会产生过多误杀。HumanReview 设为 advisory 是因为大部分低风险变更不应该阻塞在人工队列里——只有被标记 high-risk 的候选才真正需要人工确认。
正确: gate 返回 pending → 查看待审队列 → 人工审批 $ python3 scripts/review.py --list --state-root /tmp/state → 显示待审项列表 $ python3 scripts/review.py --complete REQ_001 --decision approve --reason "低风险文档变更"
错误: gate 返回 reject 后仍然保留变更 → reject 意味着必须回滚。用 improvement-executor 的 rollback 恢复
gate.py 是核心入口,接收 ranking 和 execution artifact,输出 receipt。
review.py 管理人工审核队列,支持 list/complete 两个子命令。
所有命令都支持 --verbose 查看每层详细日志。
建议在 CI 中使用 --strict 模式,将 advisory 层也视为 blocking。
输出的 receipt.json 可直接传给 orchestrator 或存档用于审计。
review.py 的 --decision 支持 approve / reject / defer 三种选项。
bash
# Run gate validation (requires ranking + execution artifacts)
python3 scripts/gate.py --ranking ranking.json --execution execution.json --output receipt.json
# List pending human reviews
python3 scripts/review.py --list --state-root /path/to/state
# Complete a review
python3 scripts/review.py --complete REVIEW_ID --decision approve --reason "LGTM"
Skip specific layers when you know they are irrelevant (e.g., YAML-only change does not need CompileGate):
bash
# Skip Lint and Regression layers (only run Schema, Compile, Review, HumanReview)
python3 scripts/gate.py \
--ranking ranking.json \
--execution execution.json \
--skip-layers lint,regression \
--output receipt.json
Batch-validate multiple candidates in one invocation. Batch mode会为每个候选独立运行 6 层,单个候选失败不影响其他候选的验证。
bash
# Batch mode: validate all candidates in a ranking file
python3 scripts/gate.py \
--ranking ranking.json \
--execution-dir ./executions/ \
--batch \
--output receipts/
RequestDeliverableGate checkJSON receipt: gate_decision (pass/reject/pending), per-layer results arrayReview listJSON array of pending reviews with candidate ID, risk level, timestampReview completeUpdated receipt with human decision, reviewer ID, reason textBatch modeDirectory of individual receipt JSON files, one per candidate
Receipt 结构示例: gate_decision 为顶层字段, layers 数组记录每层的 name、 status (pass/fail/warn/skip)、 message。
当任一 blocking 层 fail 时, gate_decision 立即设为 reject,后续层不再执行。
当所有 blocking 层 pass 但 HumanReview 触发时, gate_decision 设为 pending。
advisory 层的 warn 状态会记录在 warnings 数组中,供下游参考但不影响决策。
Pipeline 中的数据流: generator → discriminator → evaluator → executor → gate → (optional) human review