BugFix
release-tag / release-image (push) Successful in 2m24s

This commit is contained in:
2026-08-05 11:58:25 +02:00
parent 31d3efb8a2
commit b3bd3d5ffd
25 changed files with 679 additions and 719 deletions
+9 -13
View File
@@ -73,34 +73,30 @@ func TestNextPairUsesBoundedRotatingAnchors(t *testing.T) {
}
}
func TestCategoryFiltersLimitEmbeddingAndThinkingCandidates(t *testing.T) {
func TestSourceFiltersLimitEmbeddingAndThinkingCandidates(t *testing.T) {
s, err := Open(t.TempDir())
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { _ = s.Close() })
nodes := []model.Node{
{ID: "net-a", Kind: "knowledge", Label: "Net A", Categories: []string{"Netzwerk"}, Origin: "test"},
{ID: "net-b", Kind: "knowledge", Label: "Net B", Categories: []string{"Netzwerk"}, Origin: "test"},
{ID: "app-a", Kind: "knowledge", Label: "App A", Categories: []string{"Applikation"}, Origin: "test"},
{ID: "internal-a", Kind: "knowledge", Label: "Internal A", Categories: []string{"Netzwerk"}, Origin: "test", Metadata: map[string]any{"source": "internal-category"}},
{ID: "internal-b", Kind: "knowledge", Label: "Internal B", Categories: []string{"Applikation"}, Origin: "test", Metadata: map[string]any{"source": "internal-category"}},
{ID: "glpi-a", Kind: "knowledge", Label: "GLPI A", Categories: []string{"Netzwerk"}, Origin: "glpi-kb", Metadata: map[string]any{"source": "GLPI Knowledge Base"}},
{ID: "none", Kind: "knowledge", Label: "Ohne", Origin: "test"},
}
for _, node := range nodes {
s.UpsertNode(node)
}
pending := s.NodesForEmbeddingFiltered([]string{"Netzwerk"})
pending := s.NodesForEmbeddingFiltered([]string{"internal-category"})
if len(pending) != 2 {
t.Fatalf("expected two network embeddings, got %d", len(pending))
}
uncategorized := s.NodesForEmbeddingFiltered([]string{"__uncategorized__"})
if len(uncategorized) != 1 || uncategorized[0].ID != "none" {
t.Fatalf("unexpected uncategorized nodes: %#v", uncategorized)
t.Fatalf("expected two internal source embeddings, got %d", len(pending))
}
for _, node := range nodes {
s.SetVector(node.ID, []float64{1, .01})
}
a, b, _, ok, _ := s.NextPairFiltered(.5, 8, []string{"Netzwerk"})
if !ok || a.Categories[0] != "Netzwerk" || b.Categories[0] != "Netzwerk" {
t.Fatalf("thinking filter returned wrong pair: ok=%v a=%+v b=%+v", ok, a, b)
a, b, _, ok, _ := s.NextPairFiltered(.5, 8, []string{"internal-category"})
if !ok || NodeSource(a) != "internal-category" || NodeSource(b) != "internal-category" {
t.Fatalf("thinking source filter returned wrong pair: ok=%v a=%+v b=%+v", ok, a, b)
}
}