feat(library): 按版本恢复入口与失败作业续作
build / build (push) Successful in 1m25s

为什么:恢复此前只有"失败自动回滚",没有手动按版本恢复;失败作业也只能重发封存。
- 迁移 000068 允许 kind=restore;POST /library/restores(管理员 + 该快照恢复授权 + 闸口)。
- POST /library/jobs/{id}/resume 对失败/取消的同步/恢复作业按原参数续作。
- worker 统一 runLibraryRelease,同步与恢复共用链路;成功后登记 production_effective 版本。
This commit is contained in:
姚章浩
2026-10-28 16:27:46 +08:00
parent 0b9dbe12cf
commit a2d051f6b3
11 changed files with 548 additions and 91 deletions
+95
View File
@@ -1025,6 +1025,101 @@
}
}
},
"/api/v1/library/restores": {
"post": {
"tags": [
"Runtime"
],
"operationId": "startLibraryRestore",
"summary": "按指定整库版本恢复生产(仅管理员;需要针对该快照的恢复授权,闸口与恢复演练证据同样适用)",
"responses": {
"202": {
"description": "已创建恢复作业并入队"
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"403": {
"description": "仅管理员可发起恢复"
},
"409": {
"description": "该目标已有在飞作业,或同一恢复请求参数冲突"
},
"500": {
"$ref": "#/components/responses/InternalError"
},
"503": {
"description": "闸口关闭、缺恢复演练证据或缺该快照的授权,返回具体原因"
}
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": false,
"required": [
"scope",
"snapshot_id"
],
"properties": {
"scope": {
"type": "string",
"enum": [
"internal",
"external"
]
},
"snapshot_id": {
"type": "string"
}
}
}
}
}
}
}
},
"/api/v1/library/jobs/{id}/resume": {
"post": {
"tags": [
"Runtime"
],
"operationId": "resumeLibraryJob",
"summary": "续作失败或已取消的同步/恢复作业:按原参数重新排队,旧作业保留为审计记录",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"202": {
"description": "已创建续作作业"
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"403": {
"description": "需要知识工程师及以上权限"
},
"404": {
"description": "作业不存在"
},
"409": {
"description": "作业状态不允许续作,或该目标已有在飞作业"
},
"500": {
"$ref": "#/components/responses/InternalError"
}
}
}
},
"/api/v1/library/authorizations": {
"get": {
"tags": [