fix(settings): 绑定留档名称并按旧目标重指向待入库
build / build (push) Successful in 1m48s

- 迁移 000084 保存对内/对外绑定名称快照;清除密钥后仍显示已绑定库,不再只显示裸 ID
- 测试/生产换绑只重指向同一侧的旧目标,避免测试保存误改另一环境的待入库
- 已保存连接但没有可用密钥时拒绝改绑定,禁止静默回落文件 Key
- 生产换绑返回重指向/退休数量,页面提示与测试侧一致

验证:make verify(含隔离 PostgreSQL 集成用例)15/15 通过
This commit is contained in:
狐友 GXXP & LEN
2026-11-23 12:47:22 +08:00
committed by 姚章浩
parent 8b900a9ffb
commit aac8538372
19 changed files with 633 additions and 140 deletions
+5 -2
View File
@@ -45,9 +45,12 @@ export function ProductionBindingsSection() {
const frozen = next.frozen + next.retargetable > 0
? `;已冻结目标 ${next.frozen} 条(不会被改写),仍可改指向 ${next.retargetable} 条`
: ''
const replan = next.replanned || next.retired_duplicates
? `;同时把 ${next.replanned} 项还没上传的待入库重新指向新库${next.retired_duplicates ? `,${next.retired_duplicates} 项因新库里已有同篇而被退休` : ''}`
: ''
setMessage(next.production_connected
? `发布目标已更新:${where}${frozen}。之后新发布的“对内/对外”内容会写入这两个生产库。`
: `发布目标已保存:${where}${frozen};但当前核对不了生产端(${next.production_message}),下次发布前请确认。`)
? `发布目标已更新:${where}${replan}${frozen}。之后新发布的“对内/对外”内容会写入这两个生产库。`
: `发布目标已保存:${where}${replan}${frozen};但当前核对不了生产端(${next.production_message}),下次发布前请确认。`)
} catch (cause) { setError(cause instanceof Error ? cause.message : '保存生产知识库绑定失败') }
finally { setSaving(false) }
}
+4
View File
@@ -13,6 +13,8 @@ export interface ProductionBindings {
production_message: string
frozen: number
retargetable: number
replanned: number
retired_duplicates: number
}
const record = (value: unknown): value is Record<string, unknown> => Boolean(value) && typeof value === 'object' && !Array.isArray(value)
@@ -29,6 +31,8 @@ function projection(item: Record<string, unknown>): ProductionBindings {
production_message: typeof item.production_message === 'string' ? item.production_message : '',
frozen: typeof item.frozen === 'number' ? item.frozen : 0,
retargetable: typeof item.retargetable === 'number' ? item.retargetable : 0,
replanned: typeof item.replanned === 'number' ? item.replanned : 0,
retired_duplicates: typeof item.retired_duplicates === 'number' ? item.retired_duplicates : 0,
}
}