fix(library): 幂等重放、跨版本去重用量与契约复核
build / build (push) Failing after 15s

- 同作业号重跑读持久日志+已封存清单按首次请求重放(source_read=false,
  writers_stopped=false),换范围/绑定库或清单校验失败即拒绝
- 归档用量按跨版本去重统计内容字节,清单/未引用 blob/实际分配单列,
  不再用各版本 unique 之和冒充归档占用
- 冻结窗口内复核来源契约,不一致即中止;拒绝组外同镜像运行容器
- 补齐整库只读接口的 OpenAPI 契约
- 按用户确认取消 A06:文档/页面/接口不再把效果测试列为封版门槛
This commit is contained in:
姚章浩
2026-10-28 12:01:09 +08:00
parent 20fc40a147
commit c5e033dd0e
15 changed files with 839 additions and 50 deletions
+17 -4
View File
@@ -10,7 +10,7 @@ import './libraryVersions.css'
// 「整库版本」页:只读展示已封存的整库候选产物(对内/对外各一份最新)。
// 页面不提供封存按钮:封存要停真实写入者并读来源凭据,只能在目标主机用
// scripts/library-capture.sh 执行。候选 != 验收通过,也 != 可发布。
// scripts/library-capture.sh 执行。通过完整性检查 != 已发布,授权仍走发布管理。
const stamp = (value: string) =>
value && Number.isFinite(new Date(value).getTime())
? new Date(value).toLocaleString('zh-CN', {
@@ -74,8 +74,11 @@ export function LibraryVersions() {
</p>
</div>
<div className="library-versions-actions">
<span className="library-versions-usage">
共 {snapshots.length} 份 · 归档占用 {formatBytes(page?.stored_bytes ?? 0)}
<span
className="library-versions-usage"
title="跨版本去重后被版本引用的内容字节;不是磁盘占用,也不是可回收空间"
>
共 {snapshots.length} 份 · 被引用的去重内容 {formatBytes(page?.content_bytes ?? 0)}
</span>
<button type="button" onClick={() => void load()} disabled={loading}>
{loading ? '刷新中…' : '刷新'}
@@ -173,6 +176,14 @@ export function LibraryVersions() {
<span className="library-versions-note">{page.capture_note}</span>
</div>
<div className="library-versions-toolbar library-versions-accounting">
<span>
磁盘事实(不是可回收空间):清单 {formatBytes(page.manifest_file_bytes)} · blob 文件{' '}
{formatBytes(page.blob_file_bytes)}(实际分配 {formatBytes(page.blob_allocated_bytes)})· 未被任何版本引用{' '}
{page.unreferenced_blobs} 个 / {formatBytes(page.unreferenced_bytes)}
</span>
</div>
{visible.length === 0 ? (
<p className="library-versions-empty">还没有封存产物。</p>
) : (
@@ -201,7 +212,9 @@ export function LibraryVersions() {
<td>{metric(snapshot, 'index_documents')}</td>
<td>{metric(snapshot, 'resources')}</td>
<td>{metric(snapshot, 'wiki_pages')}</td>
<td title={`逻辑 ${snapshot.logical_bytes} 字节 · 去重后 ${snapshot.unique_bytes} 字节`}>
<td
title={`本版逻辑 ${snapshot.logical_bytes} 字节 · 本版内去重 ${snapshot.unique_bytes} 字节(跨版本去重见上方合计)`}
>
{formatBytes(snapshot.logical_bytes)}
</td>
<td>
+18 -2
View File
@@ -42,7 +42,16 @@ export interface LibrarySnapshotList {
reason: string
archive_root: string
snapshots: LibrarySnapshot[]
stored_bytes: number
// 归档级口径:content_bytes 是跨版本去重后、被版本引用的内容字节;
// 其余字段是文件系统事实,都不是可回收空间。
versions: number
content_bytes: number
blob_file_bytes: number
blob_allocated_bytes: number
unreferenced_blobs: number
unreferenced_bytes: number
manifest_file_bytes: number
manifest_allocated_bytes: number
capture_note: string
}
@@ -113,7 +122,14 @@ export async function fetchLibrarySnapshots(signal?: AbortSignal): Promise<Libra
reason: text(value.reason),
archive_root: text(value.archive_root),
snapshots,
stored_bytes: num(value.stored_bytes),
versions: num(value.versions),
content_bytes: num(value.content_bytes),
blob_file_bytes: num(value.blob_file_bytes),
blob_allocated_bytes: num(value.blob_allocated_bytes),
unreferenced_blobs: num(value.unreferenced_blobs),
unreferenced_bytes: num(value.unreferenced_bytes),
manifest_file_bytes: num(value.manifest_file_bytes),
manifest_allocated_bytes: num(value.manifest_allocated_bytes),
capture_note: text(value.capture_note),
}
}
+6
View File
@@ -165,6 +165,12 @@
max-width: 70ch;
line-height: 1.5;
}
.library-versions-accounting {
justify-content: flex-start;
font-size: 12px;
color: var(--ink-mute, #64748b);
line-height: 1.6;
}
.library-versions-empty {
margin: 0;
padding: 24px;