修复 varchar 状态参数在 AdvanceLibraryJob 的 42P08;worker 开始/终态写入失败 不再吞掉。新增管理员核对路由,仅在 completed capture queue、export succeeded、 精确 test_sealed 版本、来源身份和归档复核一致时,以条件更新修复仍为 pending/running 的同一作业;已有不同快照或并发失败/取消行拒绝覆盖。保留 第一因与历史记录,不重新封存、不产生快照、不写源或目标知识。 验证:真实 varchar DDL PG 路径、handler 负例/幂等、worker 注入、web 组件; umask022 与真实隔离 kg_library_test_* 下 Go 全量与 make verify 17 项通过。
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
fetchLibraryOverview,
|
||||
fetchLibraryRestoreAvailability,
|
||||
fetchLibrarySnapshots,
|
||||
reconcileLibraryCapture,
|
||||
formatBytes,
|
||||
scopeLabel,
|
||||
type LibraryCaptureJob,
|
||||
@@ -117,6 +118,10 @@ interface ViewProps {
|
||||
pendingCapture: boolean
|
||||
canCapture: boolean
|
||||
canWrite: boolean
|
||||
// 管理员核对已完成 queue/精确版本/归档后修复 pending 封存作业终态。
|
||||
canReconcileCapture: boolean
|
||||
pendingReconcileCapture: string
|
||||
onReconcileCapture: (jobID: string) => void
|
||||
// 发布动作:签发授权(管理员)与启动同步是两个独立步骤,页面绝不自动签发。
|
||||
sync: ReleaseSyncActions
|
||||
// 目标非空又没有生效版本时,唯一入口是"建立目标权威基线"(管理员)。
|
||||
@@ -1081,14 +1086,28 @@ function ReadyBody({
|
||||
)
|
||||
}
|
||||
|
||||
function ProgressBody({ view, now, onOpen }: { view: ScopeView; now: number; onOpen: () => void }) {
|
||||
function ProgressBody({
|
||||
view,
|
||||
now,
|
||||
onOpen,
|
||||
canReconcileCapture,
|
||||
pendingReconcileCapture,
|
||||
onReconcileCapture,
|
||||
}: {
|
||||
view: ScopeView
|
||||
now: number
|
||||
onOpen: () => void
|
||||
canReconcileCapture: boolean
|
||||
pendingReconcileCapture: string
|
||||
onReconcileCapture: (jobID: string) => void
|
||||
}) {
|
||||
const job = view.job
|
||||
const sealJob = job?.kind === 'seal' ? job : undefined
|
||||
// 四类数据阶段对同步/恢复/基线都成立:分项读的是这份作业自己的阶段,
|
||||
// 不是"只有 sync 才有"。写死 sync 会让恢复作业的分项全显示"未接入"。
|
||||
const dataJob = job && job.kind !== 'seal' ? job : undefined
|
||||
const running = job?.state === 'running' || job?.state === 'pending'
|
||||
const stage = (name: string) => dataJob?.stages.find((item) => item.stage === name)
|
||||
const stage = (name: string) => (dataJob ?? sealJob)?.stages.find((item) => item.stage === name)
|
||||
|
||||
// F11: counts must belong to the snapshot this job actually used. A newly
|
||||
// sealed test version must not decorate an older sync/restore/verify job.
|
||||
@@ -1176,6 +1195,22 @@ function ProgressBody({ view, now, onOpen }: { view: ScopeView; now: number; onO
|
||||
{job?.recovery ? ` · 恢复:${job.recovery}` : ''}
|
||||
</p>
|
||||
<StageBar view={view} />
|
||||
{sealJob &&
|
||||
canReconcileCapture &&
|
||||
(sealJob.state === 'pending' || sealJob.state === 'running') &&
|
||||
stage('export')?.state === 'succeeded' ? (
|
||||
<div className="rel-between rel-progress-foot" aria-label="核对封存结果">
|
||||
<span>队列已完成、导出阶段已成功,但作业终态尚未回写。</span>
|
||||
<button
|
||||
type="button"
|
||||
className="rel-secondary"
|
||||
onClick={() => onReconcileCapture(sealJob.id)}
|
||||
disabled={pendingReconcileCapture === sealJob.id}
|
||||
>
|
||||
{pendingReconcileCapture === sealJob.id ? '核对中…' : '核对封存结果'}
|
||||
</button>
|
||||
</div>
|
||||
) : null}
|
||||
<div className="rel-between rel-progress-foot">
|
||||
<span>
|
||||
当前:
|
||||
@@ -1806,6 +1841,9 @@ export function ReleaseTargetsView(props: ViewProps) {
|
||||
pendingCapture,
|
||||
canCapture,
|
||||
canWrite,
|
||||
canReconcileCapture,
|
||||
pendingReconcileCapture,
|
||||
onReconcileCapture,
|
||||
sync,
|
||||
baseline,
|
||||
verification,
|
||||
@@ -2046,7 +2084,14 @@ export function ReleaseTargetsView(props: ViewProps) {
|
||||
/>
|
||||
|
||||
{active ? (
|
||||
<ProgressBody view={view} now={now} onOpen={() => onDrawer(true)} />
|
||||
<ProgressBody
|
||||
view={view}
|
||||
now={now}
|
||||
onOpen={() => onDrawer(true)}
|
||||
canReconcileCapture={canReconcileCapture}
|
||||
pendingReconcileCapture={pendingReconcileCapture}
|
||||
onReconcileCapture={onReconcileCapture}
|
||||
/>
|
||||
) : (
|
||||
<ReadyBody
|
||||
view={view}
|
||||
@@ -2117,6 +2162,7 @@ export function ReleaseTargets() {
|
||||
const [drawerOpen, setDrawerOpen] = useState(false)
|
||||
const [expandedSnapshot, setExpandedSnapshot] = useState<string | null>(null)
|
||||
const [pendingCapture, setPendingCapture] = useState(false)
|
||||
const [pendingReconcileCapture, setPendingReconcileCapture] = useState('')
|
||||
const [now, setNow] = useState(() => Date.now())
|
||||
|
||||
const load = useCallback(async (signal?: AbortSignal) => {
|
||||
@@ -2348,6 +2394,24 @@ export function ReleaseTargets() {
|
||||
}
|
||||
}
|
||||
|
||||
const reconcileCapture = async (jobID: string) => {
|
||||
setPendingReconcileCapture(jobID)
|
||||
setNotice(null)
|
||||
try {
|
||||
const result = await reconcileLibraryCapture(jobID)
|
||||
setNotice(
|
||||
result.already_succeeded
|
||||
? `封存作业 ${jobID} 已是成功终态,未重复写入`
|
||||
: `已核对封存结果:${jobID} → ${result.snapshot_id.slice(0, 12)}(审计 ${result.audit_operation_id ?? '已记录'})`
|
||||
)
|
||||
await load()
|
||||
} catch (reconcileError) {
|
||||
setNotice(reconcileError instanceof Error ? reconcileError.message : '核对封存结果失败')
|
||||
} finally {
|
||||
setPendingReconcileCapture('')
|
||||
}
|
||||
}
|
||||
|
||||
const recover = async (windowJobID: string) => {
|
||||
setNotice(null)
|
||||
try {
|
||||
@@ -2400,6 +2464,9 @@ export function ReleaseTargets() {
|
||||
pendingCapture={pendingCapture}
|
||||
canCapture={canCapture}
|
||||
canWrite={canWrite}
|
||||
canReconcileCapture={role === 'admin'}
|
||||
pendingReconcileCapture={pendingReconcileCapture}
|
||||
onReconcileCapture={(jobID) => void reconcileCapture(jobID)}
|
||||
sync={{
|
||||
canSign: canSignSync,
|
||||
pendingGrant: pendingSyncGrant,
|
||||
|
||||
Reference in New Issue
Block a user