Files
knowledge-governance/internal/releaseadapter/v071/library_preflight.go
T
姚章浩 045fc44f0e
build / build (push) Failing after 19s
feat(library): 接通整库封存真实入口与只读版本页
- libraryctl:status/preflight/capture/list/verify/recover,只读来源会话、
  结清检查、契约推导、维护窗口内停写者、导出十表+索引+对象+Wiki、封存候选后恢复
- libraryfreeze.ProjectController:按 Compose 项目逐服务声明固定身份,
  未声明服务/容器重建即拒绝,仅 SIGTERM,恢复后必须 healthy
- httpapi:GET /api/v1/library/snapshots[/{id}] 只读列出封存产物
- web:「整库版本」页(只读、未接线显示原因、无假按钮)
- api:LIBRARY_ARCHIVE_ROOT + 归档根只读挂载
- docs/library-capture.md:运维手册与 2026-10-28 两次真实封存实测

不代表整库业务验收通过:内容/问答/性能验收、跨系统切点、Wiki 删除语义重算、
生产预备份/恢复演练/双闸/同步协调仍未完成。
2026-10-28 11:39:50 +08:00

47 lines
1.9 KiB
Go

package v071
import (
"context"
"github.com/jackc/pgx/v5/pgxpool"
"knowledge-governance/internal/librarysnapshot"
)
// Operator preflight surface. These wrappers expose the *same* checks used by
// the capture path so an operator command can inspect a real source without
// sealing an artifact, stopping a writer, or writing anything. They add no new
// acceptance rule: a preflight which passes here is still only a candidate.
//
// Nothing here authorizes publication: artifact-acceptance-v1 still requires
// snapshot-bound content, question/answer and performance acceptance, and
// production release remains a separate, double-gated decision.
// LibrarySourceSettled reports whether the whole source database has finished
// recorded processing. It is the identical query CaptureLibrary enforces before
// and inside the maintenance window.
func LibrarySourceSettled(ctx context.Context, db *pgxpool.Pool) error {
return checkLibrarySourceSettlement(ctx, db)
}
// ValidateLibraryCandidateForPreflight runs the candidate validator used by
// ArchiveLibraryCandidate (identity, bidirectional content coverage, generated
// question coverage, resources and digests) without archiving anything.
func ValidateLibraryCandidateForPreflight(identity PostgresIdentity, pg PostgresSnapshot, es SearchSnapshot) error {
return validateLibraryCandidate(identity, pg, es)
}
// LibraryContentTables is the stable list of PostgreSQL tables a library
// snapshot must contain, so an operator view does not hard-code table names.
func LibraryContentTables() []string {
names := make([]string, 0, len(libraryContentQueries)+1)
names = append(names, "resources")
for _, entry := range libraryContentQueries {
names = append(names, entry.name)
}
return names
}
// LibrarySnapshotCompatibility is the archive-level compatibility contract.
type LibrarySnapshotCompatibility = librarysnapshot.Compatibility