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) } // LibrarySourceSettledWithReleases 是同一检查,但带上治理平台已审计的精确死信解除 // 指纹:只有逐字节命中的行不再阻断。 func LibrarySourceSettledWithReleases(ctx context.Context, db *pgxpool.Pool, released []string) error { return checkLibrarySourceSettlementReleased(ctx, db, released) } // 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