feat(release): 发布到生产一键完成(建批+锁定+授权合成一个动作)

用户的反馈是对的:上一轮只砍掉了"冻结/锁定"两个按钮,但一条文档从"已批准"到"发出"实际仍要
~9 次交互(找条目→勾选→填名→建批→滚到清单→找批次→授权→输语句→提交),因为"批次仪式"本身
还留在路径上。

- 新端点 POST /api/v1/release-batches/publish-now:在同一操作里先建批(SealImmediately,冻结
  即锁定)再授权生产发布,返回 {batch, execution}。
- 不放松任何约束:请求门禁(403)、备份恢复验证门禁(412)、管理员身份(401)、固定确认语句(400)、
  发布前快照硬门禁(409)、建批门禁(422) 全部沿用既有实现,无旁路;名称可省(服务端固定回退名,
  保证重放指纹一致)。
- 界面:审核行上直接「发布到生产」(管理员 + 门禁开启时显示),工具栏支持选中多条一次发布;
  复用既有确认弹窗(固定语句)。批次名不再是必经步骤。
- 实测(面板):点行级按钮 → 输 `publish-to-production` → 提交 → 批次 rb-bee80550…(sealed)
  + 执行 rx-3d831129…(completed, 项级 verified) → 页面回滚 rx-43835fac…(rolled_back, absent)。

测试:publish_now_test.go(四道关卡 + 组合调用 + 名称回退)与 reviewRelease.test.ts(请求体/回传/错误原因);
Go 26 包、前端 183 条全过。
This commit is contained in:
姚章浩
2026-10-10 15:48:30 +08:00
parent 70131c6161
commit f8faed0b21
8 changed files with 378 additions and 14 deletions
+85
View File
@@ -3252,6 +3252,46 @@
}
}
}
},
"/api/v1/release-batches/publish-now": {
"post": {
"tags": [
"Release"
],
"operationId": "publishNowPublications",
"summary": "一个动作完成「建批(冻结+锁定)→ 授权生产发布」(沿用门禁、固定语句与管理员身份)",
"parameters": [
{
"$ref": "#/components/parameters/IdempotencyKey"
}
],
"responses": {
"202": {
"$ref": "#/components/responses/OperationEnvelope"
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"409": {
"$ref": "#/components/responses/Conflict"
},
"412": {
"$ref": "#/components/responses/PreconditionFailed"
},
"422": {
"$ref": "#/components/responses/Unprocessable"
},
"500": {
"$ref": "#/components/responses/InternalError"
}
}
}
}
},
"components": {
@@ -3394,6 +3434,51 @@
}
}
}
},
"Unauthorized": {
"description": "需要生产发布授权(管理员会话或运维通道)",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}
}
}
},
"PreconditionFailed": {
"description": "生产门禁未满足(例如备份恢复验证未通过)",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}
}
}
},
"Unprocessable": {
"description": "请求内容不满足发布条件",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}
}
}
}
},
"schemas": {