feat(library): 死信按精确指纹解除,保留上游记录
build / build (push) Successful in 1m26s

上游 task_dead_letters 没有解决标记,purge/DELETE 会销毁"失败过"的唯一证据。
治理侧新增解除记录(迁移 073):绑定实时行逐字节指纹、重放引用、源侧观测摘要与
操作人;行被改过、重放后又出现新死信、源侧未结清都不命中,封存照旧阻断。
指纹先压紧空白再摘要,避免 PG to_jsonb::text 与 json.Marshal 的空白差异。

试过:go test ./internal/{librarydeadletter,libraryagent,httpapi,releaseadapter/v071,
platform/postgres},make verify 15 项全绿。
This commit is contained in:
姚章浩
2026-10-29 06:55:13 +08:00
parent 958292d1ff
commit c2402947a9
22 changed files with 1267 additions and 23 deletions
+103
View File
@@ -898,6 +898,109 @@
}
}
},
"/api/v1/library/dead-letter-releases": {
"get": {
"tags": [
"Runtime"
],
"operationId": "listLibraryDeadLetterReleases",
"summary": "列出本实例的死信解除记录(只读审计视图;上游死信行保持原样)",
"responses": {
"200": {
"$ref": "#/components/responses/Envelope"
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"500": {
"$ref": "#/components/responses/InternalError"
},
"503": {
"description": "实例身份未配置或解除存储不可用"
}
}
},
"post": {
"tags": [
"Runtime"
],
"operationId": "createLibraryDeadLetterRelease",
"summary": "按精确指纹记录一条死信解除(需要工程师及以上与 X-Governance-Action;不删除上游行,行变化即失效)",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"dead_letter_id": {
"type": "integer"
},
"observation": {
"type": "object"
},
"observation_digest": {
"type": "string"
},
"replay": {
"type": "object",
"properties": {
"queue": {
"type": "string"
},
"task_id": {
"type": "string"
},
"at": {
"type": "string",
"format": "date-time"
},
"evidence": {
"type": "string"
}
},
"required": [
"queue",
"task_id",
"at"
]
},
"note": {
"type": "string"
}
},
"required": [
"dead_letter_id",
"observation",
"observation_digest",
"replay"
]
}
}
}
},
"responses": {
"200": {
"description": "解除记录已落库(或返回同一指纹的已存记录)"
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"403": {
"description": "权限不足或缺少写意图头"
},
"409": {
"description": "解除被拒绝:指纹/结清/重放证据不满足"
},
"500": {
"$ref": "#/components/responses/InternalError"
},
"503": {
"description": "实例身份未配置或解除存储不可用"
}
}
}
},
"/api/v1/library/storage": {
"get": {
"tags": [