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) } }) } }