Refactor ingestion_db.py and ingestion_processor.py: Simplify comments and documentation for clarity, enhance artifact purging logic to protect against accidental deletions, and improve symmetry injection process descriptions. Update versioning to reflect changes in functionality and maintainability.

This commit is contained in:
Lars committed 2026-01-10 06:54:11 +01:00
1 parent 114cea80de
commit 29e334625e
2 files changed
+14 -48

No files matched your search

+3 -4
View File
@@ -22,7 +22,7 @@ from app.core.parser import (
validate_required_frontmatter, NoteContext
)
from app.core.chunking import assemble_chunks
# WP-24c: Import für die deterministische UUID-Vorabberechnung
# WP-24c: Import für die deterministische ID-Vorabberechnung
from app.core.graph.graph_utils import _mk_edge_id
# Datenbank-Ebene (Modularisierte database-Infrastruktur)
@@ -83,7 +83,7 @@ class IngestionService:
# WP-15b: Kontext-Gedächtnis für ID-Auflösung
self.batch_cache: Dict[str, NoteContext] = {}
# WP-24c: Puffer für Phase 2 (Symmetrie-Injektion)
# WP-24c: Puffer für Phase 2 (Symmetrie-Injektion nach Persistierung)
self.symmetry_buffer: List[Dict[str, Any]] = []
try:
@@ -143,7 +143,7 @@ class IngestionService:
success_count += 1
# 3. Schritt: SYMMETRY INJECTION (PHASE 2)
# Erst jetzt, wo alle manuellen Kanten in Qdrant liegen, prüfen wir die Symmetrien.
# Erst jetzt, wo alle manuellen Kanten in Qdrant liegen, schreiben wir die Symmetrien.
if self.symmetry_buffer:
logger.info(f"🔄 PHASE 2: Validiere {len(self.symmetry_buffer)} Symmetrie-Kanten gegen Live-DB...")
final_virtuals = []
@@ -244,7 +244,6 @@ class IngestionService:
is_valid = await validate_edge_candidate(
ch.text, cand, self.batch_cache, self.llm, profile_name="ingest_validator"
)
# Fix (v3.3.2): Sicherer Zugriff via .get() verhindert Crash
t_id = cand.get('target_id') or cand.get('note_id') or "Unknown"
logger.info(f" 🧠 [SMART EDGE] {t_id} -> {'✅ OK' if is_valid else '❌ SKIP'}")
if is_valid: new_pool.append(cand)