eaa388f76b
build / build (push) Successful in 1m42s
按用户明确要求,治理封存不再替 WeKnora 判断正文块“应该”有独立索引: 删除 status/chunk_type/parent/mixed/flat 推导的 needOriginal、mixedDocs 及覆盖门槛;删除 parent 类型搭配限制,仅保留父引用存在与同 knowledge。 capture/preflight/archive/load/replay/writeset 共用校验同步更新,移除已无 用途的 worker 永久失败分类。 保留真实导出范围、PG/ES 原始正文/问题 metadata/vector、tenant/KB/ knowledge/chunk 身份、清单摘要、资源字节、Wiki/问题索引 source_id 及真实 悬空引用等完整性检查;不修改源端,不补数据/索引。旧测试改为原样捕获正例, 新增 status0/2 缺正文索引和父类型不匹配的接受回归,以及 archive/readback 逐行/逐记录比对。 验证:v071、cmd/worker、Go 全量、make verify 17 项。
37 lines
1.3 KiB
Go
37 lines
1.3 KiB
Go
package v071
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
)
|
|
|
|
// R3f: status and chunk type are source metadata, not a governance index
|
|
// requirement. The exact PG/ES sets are captured as-is; only question
|
|
// metadata/index identity remains independently checked.
|
|
func TestLibraryCandidateLegacyChunkKindsDoNotGateCapture(t *testing.T) {
|
|
for _, tc := range []struct {
|
|
name, kind string
|
|
status int
|
|
}{
|
|
{"legacy text missing", "text", 0},
|
|
{"legacy unknown type missing", "", 0},
|
|
{"context parent not indexed", "parent_text", 0},
|
|
{"stored parent not indexed", "parent_text", 1},
|
|
{"indexed parent missing", "parent_text", 2},
|
|
} {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
pg, es, _ := libraryCandidateFixture()
|
|
raw, err := json.Marshal(map[string]any{"id": "chunk-safe", "tenant_id": 10000, "knowledge_base_id": "kb-safe", "knowledge_id": "doc-safe", "content": "chunk", "status": tc.status, "chunk_type": tc.kind})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
pg.Tables[1] = newTableSnapshot("chunks", []json.RawMessage{raw})
|
|
es.Documents = nil
|
|
es.DocumentsSHA256, _ = searchDocumentsDigest(es.Documents)
|
|
if err := validateLibraryCandidate(PostgresIdentity{TenantID: 10000, KnowledgeBaseID: "kb-safe"}, pg, es); err != nil {
|
|
t.Fatalf("source shape without body index must be captured as-is: %v", err)
|
|
}
|
|
})
|
|
}
|
|
}
|