feat(qa-ops): 建立独立正式主表并保真导入历史问答
build / build (push) Successful in 1m7s

将可维护总表与可替换2.0镜像分离,稳定来源关联和原始事件键保留;
源端更新/删除不覆盖主表或人工复核。首次收录保留原评估审计,
主表输入/复核独立持久化;历史原标注不冒充新AI或冻结证据。

历史导入绑定源哈希、逐行批准清单与真实恢复备份;三字段精确去重,
批次及原字段留档,重复执行不覆盖后续修改。仅操作本地治理库。

验证:完整make verify退出0;镜像与区域两组隔离PG race退出0;
真实恢复数据隔离导入12522、跳过792、暂缓1,总表15050;
重放保留模拟修改,结构down拒绝丢历史;真实浏览器第41周551条完整,
历史原标注和独立主表复核读回通过,移动布局及JS异常0。
This commit is contained in:
姚章浩
2026-10-19 08:49:18 +08:00
parent 6e67034fbd
commit f5e0f8d20f
22 changed files with 1350 additions and 41 deletions
+458
View File
@@ -207,6 +207,464 @@
}
}
},
"/api/v1/qa-ops/master/records": {
"get": {
"tags": [
"QA operations"
],
"operationId": "listQAOperationsRecordsMaster",
"summary": "正式主表:按半开提问时间范围、原问题关键词、稳定游标列出钉钉问答;租户由后端固定;答案包含暂无已发布则治理侧未覆盖",
"parameters": [
{
"name": "start",
"in": "query",
"required": true,
"schema": {
"type": "string",
"format": "date-time"
}
},
{
"name": "end",
"in": "query",
"required": true,
"schema": {
"type": "string",
"format": "date-time"
}
},
{
"name": "keyword",
"in": "query",
"schema": {
"type": "string",
"maxLength": 200
}
},
{
"name": "cursor",
"in": "query",
"schema": {
"type": "string",
"maxLength": 2048
}
},
{
"name": "limit",
"in": "query",
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 100,
"default": 20
}
}
],
"responses": {
"200": {
"$ref": "#/components/responses/Envelope"
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"description": "需要登录"
},
"403": {
"description": "未获员工问答查看授权"
},
"503": {
"description": "源库未接入、不可用或权限护栏阻断,不返回空列表伪装成功"
},
"500": {
"$ref": "#/components/responses/InternalError"
}
},
"description": "仅读治理正式主表,不回退源库;评估/复核采用独立主表命名空间,不被2.0同步覆盖。历史Excel原标注保留,不冒充新AI评估。"
}
},
"/api/v1/qa-ops/master/records/{id}": {
"get": {
"tags": [
"QA operations"
],
"operationId": "getQAOperationsRecordMaster",
"summary": "正式主表:读取授权租户内的完整问答与源端覆盖对照;治理覆盖规则独立,不写回源库",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"maxLength": 256
}
}
],
"responses": {
"200": {
"$ref": "#/components/responses/Envelope"
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"description": "需要登录"
},
"403": {
"description": "未获员工问答查看授权"
},
"404": {
"description": "当前授权范围内不存在此问答"
},
"503": {
"description": "独立只读源不可用或权限校验阻断"
},
"500": {
"$ref": "#/components/responses/InternalError"
}
},
"description": "仅读治理正式主表,不回退源库;评估/复核采用独立主表命名空间,不被2.0同步覆盖。历史Excel原标注保留,不冒充新AI评估。"
}
},
"/api/v1/qa-ops/master/quality/query": {
"post": {
"operationId": "queryQAQualityCountsMaster",
"summary": "正式主表:按完整筛选范围读取指纹/规则元数据并留档统计,最多5000条;summary.rates 返回 quality-rates-human-first-v1、原始分子/分母、百分比与分母构成。覆盖率=covered/(covered+uncovered+partial),正确率=covered_correct/(covered_correct+covered_incorrect);失效/不计入/相应待确认与未评估排除,零分母percent=null。原文仅在读取问答/复核时采集",
"parameters": [
{
"name": "X-Governance-Action",
"in": "header",
"required": true,
"schema": {
"type": "string",
"enum": [
"qa-quality"
]
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"start": {
"type": "string",
"format": "date-time"
},
"end": {
"type": "string",
"format": "date-time"
},
"keyword": {
"type": "string",
"maxLength": 200
}
},
"required": [
"start",
"end"
]
}
}
}
},
"tags": [
"QA operations"
],
"responses": {
"200": {
"$ref": "#/components/responses/Envelope"
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"description": "需要登录"
},
"403": {
"description": "仅管理员访问"
},
"503": {
"description": "独立只读源或治理组织存储不可用,不返回伪造的零值"
},
"500": {
"$ref": "#/components/responses/InternalError"
},
"409": {
"description": "输入或复核版本变化/重复操作载荷不一致,未覆盖原结论"
},
"404": {
"description": "当前授权范围内未找到记录/历史输入"
}
},
"description": "仅读治理正式主表,不回退源库;评估/复核采用独立主表命名空间,不被2.0同步覆盖。历史Excel原标注保留,不冒充新AI评估。"
}
},
"/api/v1/qa-ops/master/records/{id}/reviews": {
"post": {
"operationId": "saveQAQualityReviewMaster",
"summary": "正式主表:治理库追加人工复核,登录身份审计,源端只读,输入/复核乐观锁和nonce幂等;正确时根因为空,不计入须说明原因",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "X-Governance-Action",
"in": "header",
"required": true,
"schema": {
"type": "string",
"enum": [
"qa-quality"
]
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"input_hash": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
},
"input_epoch": {
"type": "integer",
"minimum": 1
},
"base_revision": {
"type": "integer",
"minimum": 0
},
"nonce": {
"type": "string",
"pattern": "^[A-Za-z0-9_-]{16,128}$"
},
"fields": {
"type": "object",
"additionalProperties": false,
"properties": {
"coverage": {
"type": "string",
"enum": [
"covered",
"uncovered",
"partial",
"pending",
"excluded"
]
},
"correctness": {
"type": "string",
"enum": [
"correct",
"incorrect",
"pending"
]
},
"product_category": {
"type": "string",
"maxLength": 128
},
"problem_type": {
"type": "string",
"maxLength": 128
},
"root_cause": {
"type": "string",
"maxLength": 2000
},
"exclusion_reason": {
"type": "string",
"maxLength": 2000
}
},
"required": [
"coverage",
"correctness"
]
},
"reason": {
"type": "string",
"minLength": 1,
"maxLength": 4000
}
},
"required": [
"input_hash",
"input_epoch",
"base_revision",
"nonce",
"fields",
"reason"
]
}
}
}
},
"tags": [
"QA operations"
],
"responses": {
"200": {
"$ref": "#/components/responses/Envelope"
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"description": "需要登录"
},
"403": {
"description": "仅管理员访问"
},
"503": {
"description": "独立只读源或治理组织存储不可用,不返回伪造的零值"
},
"500": {
"$ref": "#/components/responses/InternalError"
},
"409": {
"description": "输入或复核版本变化/重复操作载荷不一致,未覆盖原结论"
},
"404": {
"description": "当前授权范围内未找到记录/历史输入"
}
},
"description": "仅读治理正式主表,不回退源库;评估/复核采用独立主表命名空间,不被2.0同步覆盖。历史Excel原标注保留,不冒充新AI评估。"
}
},
"/api/v1/qa-ops/master/records/{id}/quality/history": {
"get": {
"operationId": "listQAQualityHistoryMaster",
"summary": "正式主表:按当前固定租户查询不可变复检/人工历史,分别倒序分页,各20条",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "review_before",
"in": "query",
"schema": {
"type": "integer",
"minimum": 1
}
},
{
"name": "check_before",
"in": "query",
"schema": {
"type": "integer",
"minimum": 1
}
}
],
"tags": [
"QA operations"
],
"responses": {
"200": {
"$ref": "#/components/responses/Envelope"
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"description": "需要登录"
},
"403": {
"description": "仅管理员访问"
},
"503": {
"description": "独立只读源或治理组织存储不可用,不返回伪造的零值"
},
"500": {
"$ref": "#/components/responses/InternalError"
},
"409": {
"description": "输入或复核版本变化/重复操作载荷不一致,未覆盖原结论"
},
"404": {
"description": "当前授权范围内未找到记录/历史输入"
}
},
"description": "仅读治理正式主表,不回退源库;评估/复核采用独立主表命名空间,不被2.0同步覆盖。历史Excel原标注保留,不冒充新AI评估。"
}
},
"/api/v1/qa-ops/master/records/{id}/quality/inputs/{epoch}": {
"get": {
"operationId": "getQAQualityInputSnapshotMaster",
"summary": "正式主表:管理员读取已采集的历史质量输入快照,不另存人员关联/反馈字段;元数据留档但未采集原文返回409,不编造空快照",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "epoch",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"minimum": 1
}
}
],
"tags": [
"QA operations"
],
"responses": {
"200": {
"$ref": "#/components/responses/Envelope"
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"description": "需要登录"
},
"403": {
"description": "仅管理员访问"
},
"503": {
"description": "独立只读源或治理组织存储不可用,不返回伪造的零值"
},
"500": {
"$ref": "#/components/responses/InternalError"
},
"409": {
"description": "该输入版本仅有指纹/规则元数据、原文未采集"
},
"404": {
"description": "当前授权范围内未找到记录/历史输入"
}
},
"description": "仅读治理正式主表,不回退源库;评估/复核采用独立主表命名空间,不被2.0同步覆盖。历史Excel原标注保留,不冒充新AI评估。"
}
},
"/api/v1/qa-ops/records": {
"get": {
"tags": ["QA operations"],