|
4 | 4 | "context" |
5 | 5 | "encoding/json" |
6 | 6 | "fmt" |
| 7 | + "os" |
7 | 8 | "strings" |
8 | 9 | "time" |
9 | 10 |
|
@@ -265,7 +266,9 @@ func (s *Service) ingestNodesWithIndex(ctx context.Context, findings []core.Find |
265 | 266 | } |
266 | 267 | } |
267 | 268 |
|
268 | | - if err := s.repo.UpsertNodeBySummary(node); err == nil { |
| 269 | + if err := s.repo.UpsertNodeBySummary(node); err != nil { |
| 270 | + fmt.Fprintf(os.Stderr, "⚠️ failed to upsert node %q: %v\n", f.Title, err) |
| 271 | + } else { |
269 | 272 | nodesCreated++ |
270 | 273 | nodesByTitle[strings.ToLower(f.Title)] = nodeID |
271 | 274 | } |
@@ -366,7 +369,9 @@ func (s *Service) linkByEvidence(allNodes []memory.Node) int { |
366 | 369 | "shared_file": filePath, |
367 | 370 | "shared_count": sharedFiles, |
368 | 371 | } |
369 | | - if err := s.repo.LinkNodes(nodeA, nodeB, memory.NodeRelationSharesEvidence, weight, props); err == nil { |
| 372 | + if err := s.repo.LinkNodes(nodeA, nodeB, memory.NodeRelationSharesEvidence, weight, props); err != nil { |
| 373 | + fmt.Fprintf(os.Stderr, "⚠️ failed to link nodes (evidence): %v\n", err) |
| 374 | + } else { |
370 | 375 | count++ |
371 | 376 | } |
372 | 377 | } |
@@ -414,7 +419,9 @@ func (s *Service) linkSemantic(allNodes []memory.Node) int { |
414 | 419 | similarity := CosineSimilarity(nodeA.Embedding, nodeB.Embedding) |
415 | 420 | if similarity >= float32(threshold) { |
416 | 421 | props := map[string]any{"similarity": similarity} |
417 | | - if err := s.repo.LinkNodes(nodeA.ID, nodeB.ID, memory.NodeRelationSemanticallySimilar, float64(similarity), props); err == nil { |
| 422 | + if err := s.repo.LinkNodes(nodeA.ID, nodeB.ID, memory.NodeRelationSemanticallySimilar, float64(similarity), props); err != nil { |
| 423 | + fmt.Fprintf(os.Stderr, "⚠️ failed to link nodes (semantic): %v\n", err) |
| 424 | + } else { |
418 | 425 | count++ |
419 | 426 | } |
420 | 427 | } |
@@ -466,7 +473,9 @@ func (s *Service) linkByLLMRelationships(relationships []core.Relationship, node |
466 | 473 | "reason": rel.Reason, |
467 | 474 | } |
468 | 475 |
|
469 | | - if err := s.repo.LinkNodes(fromID, toID, relationType, weight, props); err == nil { |
| 476 | + if err := s.repo.LinkNodes(fromID, toID, relationType, weight, props); err != nil { |
| 477 | + fmt.Fprintf(os.Stderr, "⚠️ failed to link nodes (llm): %v\n", err) |
| 478 | + } else { |
470 | 479 | count++ |
471 | 480 | } |
472 | 481 | } |
|
0 commit comments