- 同作业号重跑读持久日志+已封存清单按首次请求重放(source_read=false, writers_stopped=false),换范围/绑定库或清单校验失败即拒绝 - 归档用量按跨版本去重统计内容字节,清单/未引用 blob/实际分配单列, 不再用各版本 unique 之和冒充归档占用 - 冻结窗口内复核来源契约,不一致即中止;拒绝组外同镜像运行容器 - 补齐整库只读接口的 OpenAPI 契约 - 按用户确认取消 A06:文档/页面/接口不再把效果测试列为封版门槛
This commit is contained in:
@@ -15,8 +15,8 @@ import (
|
||||
// 边界(刻意不做的事):
|
||||
// - 不触发封存、不停/起写入者:封存需要维护窗口与来源凭据,只能由运维命令
|
||||
// scripts/library-capture.sh 在目标主机执行;
|
||||
// - 不把候选当版本:候选只证明"这一份内容被完整、可核验地封存了",内容/问答/
|
||||
// 性能验收与生产发布是另外的、需要独立授权的事;
|
||||
// - 不把完整性当发布:候选证明"这一份内容被完整、可核验地封存了"(A04 口径),
|
||||
// 而授权与生产同步是另外的、需要独立授权的步骤(A06 效果测试已由用户取消);
|
||||
// - 归档根没接线时返回可用性=false 与原因,不返回空表冒充"没有快照"。
|
||||
type librarySnapshotPart struct {
|
||||
Kind string `json:"kind"`
|
||||
@@ -47,12 +47,22 @@ type librarySnapshotList struct {
|
||||
Reason string `json:"reason,omitempty"`
|
||||
ArchiveRoot string `json:"archive_root,omitempty"`
|
||||
Snapshots []librarySnapshotView `json:"snapshots"`
|
||||
StoredBytes int64 `json:"stored_bytes"`
|
||||
// 归档级口径:ContentBytes 是**跨版本去重后、被版本引用的内容字节**。
|
||||
// 它不是磁盘占用(清单、未引用 blob、块对齐与元数据都不在里面),
|
||||
// 更不是可回收空间——清理需要保留策略、依赖保护与在线作业引用。
|
||||
Versions int `json:"versions"`
|
||||
ContentBytes int64 `json:"content_bytes"`
|
||||
BlobFileBytes int64 `json:"blob_file_bytes"`
|
||||
BlobAllocatedBytes int64 `json:"blob_allocated_bytes"`
|
||||
UnreferencedBlobs int `json:"unreferenced_blobs"`
|
||||
UnreferencedBytes int64 `json:"unreferenced_bytes"`
|
||||
ManifestFileBytes int64 `json:"manifest_file_bytes"`
|
||||
ManifestAllocatedBytes int64 `json:"manifest_allocated_bytes"`
|
||||
// 页面必须能说清"封存由谁执行",不能让人以为页面上有个没实现的按钮。
|
||||
CaptureNote string `json:"capture_note"`
|
||||
}
|
||||
|
||||
const libraryCaptureNote = "封存由运维命令 scripts/library-capture.sh capture -scope internal|external 在目标主机执行(停写入者→导出→恢复)。页面只读展示已封存的候选;候选不等于验收通过或可发布。"
|
||||
const libraryCaptureNote = "封存由运维命令 scripts/library-capture.sh capture -scope internal|external 在目标主机执行(停写入者→导出→恢复)。页面只读展示已封存的完整版本:它通过了数据完整性检查(身份、双向正文覆盖、生成问题、资源与摘要),这已满足封版所需的完整性口径;授权与生产同步仍是独立步骤。"
|
||||
|
||||
func librarySnapshotsList(w http.ResponseWriter, r *http.Request, config Config) {
|
||||
view, err := readLibrarySnapshots(config.LibraryArchiveRoot)
|
||||
@@ -114,10 +124,24 @@ func readLibrarySnapshots(root string) (librarySnapshotList, error) {
|
||||
if err != nil {
|
||||
return view, errors.New("归档用量不可读")
|
||||
}
|
||||
// Per-version UniqueBytes deduplicates only inside one version, so summing it
|
||||
// over versions over-reports shared blobs. The archive-wide accounting below
|
||||
// deduplicates across versions and keeps filesystem facts separate.
|
||||
total, err := archive.ContentUsage()
|
||||
if err != nil {
|
||||
return view, errors.New("归档用量不可读")
|
||||
}
|
||||
view.Versions = total.Versions
|
||||
view.ContentBytes = total.ContentBytes
|
||||
view.BlobFileBytes = total.BlobFileBytes
|
||||
view.BlobAllocatedBytes = total.BlobAllocatedBytes
|
||||
view.UnreferencedBlobs = total.UnreferencedBlobs
|
||||
view.UnreferencedBytes = total.UnreferencedBytes
|
||||
view.ManifestFileBytes = total.ManifestFileBytes
|
||||
view.ManifestAllocatedBytes = total.ManifestAllocatedBytes
|
||||
byID := map[string]librarysnapshot.Usage{}
|
||||
for _, item := range usage {
|
||||
byID[item.VersionID] = item
|
||||
view.StoredBytes += item.UniqueBytes
|
||||
}
|
||||
for id, item := range byID {
|
||||
manifest, loadErr := archive.Load(id)
|
||||
|
||||
@@ -101,10 +101,13 @@ func TestReadLibrarySnapshotsReportsSealedTotals(t *testing.T) {
|
||||
t.Fatalf("total %s = %d, want %d", key, snapshot.Totals[key], value)
|
||||
}
|
||||
}
|
||||
// Stored bytes are deduplicated per blob, so they can be smaller than the
|
||||
// logical sum but never larger.
|
||||
if snapshot.LogicalBytes <= 0 || list.StoredBytes <= 0 || list.StoredBytes > snapshot.LogicalBytes {
|
||||
t.Fatalf("bytes not reported: logical=%d stored=%d", snapshot.LogicalBytes, list.StoredBytes)
|
||||
// The archive-wide content figure deduplicates blobs across versions, so it
|
||||
// can be smaller than a version's logical sum but never larger.
|
||||
if snapshot.LogicalBytes <= 0 || list.ContentBytes <= 0 || list.ContentBytes > snapshot.LogicalBytes {
|
||||
t.Fatalf("bytes not reported: logical=%d content=%d", snapshot.LogicalBytes, list.ContentBytes)
|
||||
}
|
||||
if list.BlobAllocatedBytes < list.BlobFileBytes || list.ManifestFileBytes <= 0 {
|
||||
t.Fatalf("filesystem facts not separated: %+v", list)
|
||||
}
|
||||
if snapshot.Compatibility.EmbeddingDimension != 1024 || snapshot.ValidationPolicy != librarysnapshot.ArtifactAcceptancePolicy {
|
||||
t.Fatalf("contract not reported: %+v", snapshot)
|
||||
|
||||
Reference in New Issue
Block a user