tableState 非 resources 分支恢复直接扫描 text 身份,避免 queryRows 把普通 doc id/UUID/复合键/数字 id 当 JSON canonical 校验而失败;resources 仍使用 F01 精确引用闭包。隔离 PG 覆盖字符串、UUID、复合键与数字 ID。 F11:快照 HTTP 投影补 bindings/wiki_log_entries;作业统计按本作业 target_snapshot_id/snapshot_id 取对应快照,取不到显示未知,不借最新封存; running/pending/failed/unknown 不再在无 detail 时显示完成。 F03:verifications 支持 snapshot_id 精确查询,返回 snapshot_latest 并只按 该快照回答 verified;抽屉“查看校验记录”按选中快照加载,不借用最新记录。 F08:显示主机探测时间;无真实 next-run 时说明尚未核验下一次执行;最近成功 单列未知,不以最近运行冒充。 验证:Go/前端全量、隔离 PG tableState/F01 对拍与 make verify 17 项通过。 实际 Current→Prepare→Verify ES 集成被共享 ES 磁盘 watermark 阻塞,未冒充。
This commit is contained in:
@@ -31,6 +31,7 @@ import {
|
||||
import { useOptionalAuth } from './auth'
|
||||
import './releaseTargets.css'
|
||||
import { RestoreVerificationSection } from './RestoreVerificationSection'
|
||||
import { fetchSnapshotVerification } from './restoreVerification'
|
||||
|
||||
// 发布管理:按已确认稿实现——顶部两个知识库页签,下面是**一个**作业区。
|
||||
//
|
||||
@@ -1064,9 +1065,20 @@ function ProgressBody({ view, now, onOpen }: { view: ScopeView; now: number; onO
|
||||
const running = job?.state === 'running' || job?.state === 'pending'
|
||||
const stage = (name: string) => dataJob?.stages.find((item) => item.stage === name)
|
||||
|
||||
const sealed = view.overview?.test_sealed
|
||||
// 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.
|
||||
const jobSnapshotID = job?.target_snapshot_id || job?.snapshot_id || ''
|
||||
const sealed = jobSnapshotID
|
||||
? view.history.find((item) => item.snapshot_id === jobSnapshotID)
|
||||
: job
|
||||
? undefined
|
||||
: view.overview?.test_sealed
|
||||
const breakdown = (keys: [string, string][]) =>
|
||||
sealed ? keys.map(([key, label]) => `${label} ${sealed.totals[key] ?? 0}`).join(' · ') : ''
|
||||
sealed
|
||||
? keys
|
||||
.map(([key, label]) => `${label} ${typeof sealed.totals[key] === 'number' ? sealed.totals[key] : '未知'}`)
|
||||
.join(' · ')
|
||||
: ''
|
||||
const cards = [
|
||||
// F11: these totals are storage rows, not business document/page counts.
|
||||
{
|
||||
@@ -1185,9 +1197,17 @@ function ProgressBody({ view, now, onOpen }: { view: ScopeView; now: number; onO
|
||||
{card.row?.detail
|
||||
? card.row.detail
|
||||
: card.row
|
||||
? card.row.total != null
|
||||
? `已完成 ${card.row.completed ?? card.row.total} / ${card.row.total} 条存储行`
|
||||
: '该分项已完成,执行器未提供可核对总量'
|
||||
? card.row.state === 'running'
|
||||
? '执行中;执行器尚未提供该分项明细'
|
||||
: card.row.state === 'pending'
|
||||
? '等待执行;不能按完成展示'
|
||||
: card.row.state === 'failed'
|
||||
? '失败;没有可核对完成量'
|
||||
: card.row.state === 'succeeded'
|
||||
? card.row.total != null
|
||||
? `已完成 ${card.row.completed ?? card.row.total} / ${card.row.total} 条存储行`
|
||||
: '该分项已完成,执行器未提供可核对总量'
|
||||
: '状态未知;不按完成展示'
|
||||
: dataJob
|
||||
? '本次作业没有产生该分项阶段记录'
|
||||
: '目标同步执行链未接通,分项不会产生数据'}
|
||||
@@ -1267,6 +1287,57 @@ function ProgressBody({ view, now, onOpen }: { view: ScopeView; now: number; onO
|
||||
)
|
||||
}
|
||||
|
||||
// F03: exact snapshot evidence. This component deliberately reads
|
||||
// snapshot_latest, not latest: a passed record for another snapshot must not
|
||||
// make this one look verified.
|
||||
function SnapshotVerification({ scope, snapshotID }: { scope: Scope; snapshotID: string }) {
|
||||
const [state, setState] = useState<'loading' | 'loaded' | 'error'>('loading')
|
||||
const [record, setRecord] = useState<Awaited<ReturnType<typeof fetchSnapshotVerification>>['snapshot_latest']>(null)
|
||||
const [error, setError] = useState('')
|
||||
useEffect(() => {
|
||||
const controller = new AbortController()
|
||||
setState('loading')
|
||||
setRecord(null)
|
||||
setError('')
|
||||
fetchSnapshotVerification(scope, snapshotID, controller.signal)
|
||||
.then((value) => {
|
||||
setRecord(value.snapshot_latest ?? null)
|
||||
setState('loaded')
|
||||
})
|
||||
.catch((reason: unknown) => {
|
||||
if ((reason as Error)?.name === 'AbortError') return
|
||||
setError(reason instanceof Error ? reason.message : '读取该快照的恢复验证记录失败')
|
||||
setState('error')
|
||||
})
|
||||
return () => controller.abort()
|
||||
}, [scope, snapshotID])
|
||||
return (
|
||||
<details className="rel-snapshot-verification">
|
||||
<summary>查看校验记录</summary>
|
||||
{state === 'loading' ? <p className="rel-hint">正在读取该快照的恢复验证记录…</p> : null}
|
||||
{state === 'error' ? <p className="rel-warn">{error}</p> : null}
|
||||
{state === 'loaded' && !record ? (
|
||||
<p className="rel-hint">该快照没有真实恢复验证记录;未验证,原因不是加载失败。</p>
|
||||
) : null}
|
||||
{record ? (
|
||||
<div>
|
||||
<p className="rel-hint">
|
||||
该快照最近一次:{record.status === 'passed' ? '通过' : '未通过'} · {record.finished_at} · 作业{' '}
|
||||
{record.job_id}
|
||||
</p>
|
||||
{record.failure ? <p className="rel-warn">原因:{record.failure}</p> : null}
|
||||
{record.report ? (
|
||||
<details>
|
||||
<summary>本次恢复验证报告</summary>
|
||||
<pre>{JSON.stringify(record.report, null, 2)}</pre>
|
||||
</details>
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
</details>
|
||||
)
|
||||
}
|
||||
|
||||
interface DrawerProps {
|
||||
view: ScopeView
|
||||
page: LibrarySnapshotList | null
|
||||
@@ -1534,9 +1605,7 @@ function Drawer({
|
||||
以上是同一恢复点的配套内容,不支持只选择 Wiki 或某张数据表恢复。恢复速度需实测;“有备份文件”不等于可恢复。
|
||||
</p>
|
||||
<div className="rel-drawer-actions">
|
||||
<button type="button" disabled title="逐项校验证据在同步/恢复执行时产生,作业详情里可见">
|
||||
查看校验记录
|
||||
</button>
|
||||
<SnapshotVerification scope={view.scope} snapshotID={selected.snapshot_id} />
|
||||
{canRestore && restore && restore.authorization.state !== 'active' ? (
|
||||
<button type="button" className="rel-secondary" onClick={onGrantRestore} disabled={pendingGrant}>
|
||||
{pendingGrant ? '签发中…' : '签发恢复授权(30 分钟)'}
|
||||
|
||||
Reference in New Issue
Block a user