feat(library): 发布写入支持 WeKnora 0.9.0 schema 134
build / build (push) Successful in 1m54s

整库发布写入路径原先按 0.7.1 的固定表集合工作:0.9.0 没有 wiki_log_entries,
Current/清理/编目/整实例指纹都会在不存在表上失败,跨版本闸门也因快照丢掉
SchemaVersion 而失效(未知版本被当作 74)。

改为在装配时解析目标 profile,表集合与清理顺序按解析结果;快照复制与范围改写
带上 SchemaVersion/Profile;跨版本发布显式拒绝并同时点名两个版本。单文档发布包
仍只支持 0.7.1,但改为明确拒绝并说明原因。

本机隔离验证:真实 0.9.0 schema 源库→导出→封存→写入干净 134 目标→逐表核对→
写前镜像回滚;74→134 拒绝与 134 缺表不报错两个负例通过。make verify 17 项全绿。
This commit is contained in:
姚章浩
2026-11-16 20:42:23 +08:00
parent 10568943af
commit fba2713b4e
21 changed files with 630 additions and 56 deletions
+11 -2
View File
@@ -5,6 +5,7 @@ import (
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"sort"
"strings"
"time"
@@ -152,8 +153,16 @@ func Validate(manifest Manifest, target TargetContract, mapping KnowledgeBaseMap
}
func validateManifestFields(manifest Manifest) error {
if manifest.FormatVersion != FormatVersionV1 || manifest.Contract.WeKnoraVersion != WeKnoraVersionV071 ||
manifest.Contract.MigrationVersion != WeKnoraMigrationV071 || manifest.Contract.EmbeddingDimension != EmbeddingDimensionV071 ||
// 单文档发布包只认 0.7.1 的表集合与契约。别的版本必须**明确拒绝并说明原因**,
// 不能落进下面那句泛化的 "unsupported release contract"——那让人分不清是版本
// 不支持还是字段写错了。0.9.0 的整库内容走整库发布路径(libraryprofile v090)。
if manifest.Contract.MigrationVersion != WeKnoraMigrationV071 ||
manifest.Contract.WeKnoraVersion != WeKnoraVersionV071 {
return fmt.Errorf("release bundle schema contract %s/%d is not supported: single-document release handles only v0.7.1 (74); WeKnora 0.9.0 (134) requires the library-level publish path",
manifest.Contract.WeKnoraVersion, manifest.Contract.MigrationVersion)
}
if manifest.FormatVersion != FormatVersionV1 ||
manifest.Contract.EmbeddingDimension != EmbeddingDimensionV071 ||
manifest.Contract.RetrieverEngine != "elasticsearch_v8" || manifest.Contract.TenantID == 0 || manifest.CreatedAt.IsZero() {
return errors.New("unsupported release contract")
}