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:
@@ -33,6 +33,7 @@ export interface LibraryVerificationView {
|
||||
verified: boolean
|
||||
reason: string
|
||||
latest?: LibraryVerificationRecord | null
|
||||
snapshot_latest?: LibraryVerificationRecord | null
|
||||
history: LibraryVerificationRecord[]
|
||||
running?: boolean
|
||||
job_id?: string
|
||||
@@ -91,6 +92,7 @@ export function parseVerificationView(value: unknown): LibraryVerificationView |
|
||||
? value.history.map(parseVerificationRecord).filter((item): item is LibraryVerificationRecord => item !== null)
|
||||
: []
|
||||
const latest = parseVerificationRecord(value.latest) ?? null
|
||||
const snapshotLatest = parseVerificationRecord(value.snapshot_latest) ?? null
|
||||
return {
|
||||
scope: text(value.scope),
|
||||
target,
|
||||
@@ -98,6 +100,7 @@ export function parseVerificationView(value: unknown): LibraryVerificationView |
|
||||
verified: bool(value.verified),
|
||||
reason: text(value.reason),
|
||||
latest,
|
||||
snapshot_latest: snapshotLatest,
|
||||
history,
|
||||
running: bool(value.running),
|
||||
job_id: text(value.job_id) || undefined,
|
||||
@@ -109,6 +112,26 @@ export function parseVerificationView(value: unknown): LibraryVerificationView |
|
||||
// fetchLibraryVerification 只返回**这份 scope** 的观测:
|
||||
// HTTP 非 2xx、响应不可解析、或响应 scope 与请求不一致都抛错。
|
||||
// 调用方据此把"读失败"和"没有证据"分开显示,不能拿旧绿色遮住失败(审核 B5)。
|
||||
|
||||
// F03: exact snapshot report. Never fall back to the scope's latest record.
|
||||
export async function fetchSnapshotVerification(
|
||||
scope: string,
|
||||
snapshotID: string,
|
||||
signal?: AbortSignal
|
||||
): Promise<LibraryVerificationView> {
|
||||
const query = `scope=${encodeURIComponent(scope)}&snapshot_id=${encodeURIComponent(snapshotID)}`
|
||||
const response = await fetch(`/api/v1/library/verifications?${query}`, {
|
||||
headers: { Accept: 'application/json' },
|
||||
signal,
|
||||
})
|
||||
const value = (await response.json().catch(() => null)) as unknown
|
||||
if (!response.ok) throw new Error(`读取该快照的恢复验证记录失败(HTTP ${response.status})`)
|
||||
const parsed = parseVerificationView(value)
|
||||
if (!parsed) throw new Error('读取该快照的恢复验证记录失败:响应不可解析')
|
||||
if (parsed.scope !== scope) throw new Error('读取该快照的恢复验证记录失败:scope 不一致')
|
||||
return parsed
|
||||
}
|
||||
|
||||
export async function fetchLibraryVerification(scope: string, signal?: AbortSignal): Promise<LibraryVerificationView> {
|
||||
const response = await fetch(`/api/v1/library/verifications?scope=${encodeURIComponent(scope)}`, {
|
||||
headers: { Accept: 'application/json' },
|
||||
|
||||
Reference in New Issue
Block a user